Search in sources :

Example 1 with RoleResponse

use of org.apache.cloudstack.api.response.RoleResponse in project cloudstack by apache.

the class ListRolesCmd method setupResponse.

private void setupResponse(final List<Role> roles) {
    final ListResponse<RoleResponse> response = new ListResponse<>();
    final List<RoleResponse> roleResponses = new ArrayList<>();
    for (final Role role : roles) {
        if (role == null) {
            continue;
        }
        final RoleResponse roleResponse = new RoleResponse();
        roleResponse.setId(role.getUuid());
        roleResponse.setRoleName(role.getName());
        roleResponse.setRoleType(role.getRoleType());
        roleResponse.setDescription(role.getDescription());
        roleResponse.setObjectName("role");
        roleResponses.add(roleResponse);
    }
    response.setResponses(roleResponses);
    response.setResponseName(getCommandName());
    setResponseObject(response);
}
Also used : Role(org.apache.cloudstack.acl.Role) ListResponse(org.apache.cloudstack.api.response.ListResponse) ArrayList(java.util.ArrayList) RoleResponse(org.apache.cloudstack.api.response.RoleResponse)

Example 2 with RoleResponse

use of org.apache.cloudstack.api.response.RoleResponse in project cloudstack by apache.

the class CreateRoleCmd method setupResponse.

private void setupResponse(final Role role) {
    final RoleResponse response = new RoleResponse();
    response.setId(role.getUuid());
    response.setRoleName(role.getName());
    response.setRoleType(role.getRoleType());
    response.setResponseName(getCommandName());
    response.setObjectName("role");
    setResponseObject(response);
}
Also used : RoleResponse(org.apache.cloudstack.api.response.RoleResponse)

Aggregations

RoleResponse (org.apache.cloudstack.api.response.RoleResponse)2 ArrayList (java.util.ArrayList)1 Role (org.apache.cloudstack.acl.Role)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1