Search in sources :

Example 1 with TenantListUserResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse in project ozone by apache.

the class OzoneManagerProtocolClientSideTranslatorPB method listUsersInTenant.

/**
 * {@inheritDoc}
 */
@Override
public TenantUserList listUsersInTenant(String tenantId, String prefix) throws IOException {
    final TenantListUserRequest.Builder requestBuilder = TenantListUserRequest.newBuilder().setTenantId(tenantId);
    if (prefix != null) {
        requestBuilder.setPrefix(prefix);
    }
    TenantListUserRequest request = requestBuilder.build();
    final OMRequest omRequest = createOMRequest(Type.TenantListUser).setTenantListUserRequest(request).build();
    final OMResponse response = submitRequest(omRequest);
    final TenantListUserResponse resp = handleError(response).getTenantListUserResponse();
    return TenantUserList.fromProtobuf(resp);
}
Also used : TenantListUserResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse) TenantListUserRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserRequest) OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse)

Example 2 with TenantListUserResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse in project ozone by apache.

the class OzoneManagerRequestHandler method tenantListUsers.

@DisallowedUntilLayoutVersion(MULTITENANCY_SCHEMA)
private TenantListUserResponse tenantListUsers(TenantListUserRequest request) throws IOException {
    TenantListUserResponse.Builder builder = TenantListUserResponse.newBuilder();
    TenantUserList usersInTenant = impl.listUsersInTenant(request.getTenantId(), request.getPrefix());
    // Note impl.listUsersInTenant() throws if errs
    if (usersInTenant != null) {
        builder.addAllUserAccessIdInfo(usersInTenant.getUserAccessIds());
    }
    return builder.build();
}
Also used : TenantListUserResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse) TenantUserList(org.apache.hadoop.ozone.om.helpers.TenantUserList) DisallowedUntilLayoutVersion(org.apache.hadoop.ozone.om.upgrade.DisallowedUntilLayoutVersion)

Example 3 with TenantListUserResponse

use of org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse in project ozone by apache.

the class OzoneManagerRequestHandler method handleReadRequest.

// TODO simplify it to make it shorter
@SuppressWarnings("methodlength")
@Override
public OMResponse handleReadRequest(OMRequest request) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Received OMRequest: {}, ", request);
    }
    Type cmdType = request.getCmdType();
    OMResponse.Builder responseBuilder = OmResponseUtil.getOMResponseBuilder(request);
    try {
        switch(cmdType) {
            case CheckVolumeAccess:
                CheckVolumeAccessResponse checkVolumeAccessResponse = checkVolumeAccess(request.getCheckVolumeAccessRequest());
                responseBuilder.setCheckVolumeAccessResponse(checkVolumeAccessResponse);
                break;
            case InfoVolume:
                InfoVolumeResponse infoVolumeResponse = infoVolume(request.getInfoVolumeRequest());
                responseBuilder.setInfoVolumeResponse(infoVolumeResponse);
                break;
            case ListVolume:
                ListVolumeResponse listVolumeResponse = listVolumes(request.getListVolumeRequest());
                responseBuilder.setListVolumeResponse(listVolumeResponse);
                break;
            case InfoBucket:
                InfoBucketResponse infoBucketResponse = infoBucket(request.getInfoBucketRequest());
                responseBuilder.setInfoBucketResponse(infoBucketResponse);
                break;
            case ListBuckets:
                ListBucketsResponse listBucketsResponse = listBuckets(request.getListBucketsRequest());
                responseBuilder.setListBucketsResponse(listBucketsResponse);
                break;
            case LookupKey:
                LookupKeyResponse lookupKeyResponse = lookupKey(request.getLookupKeyRequest(), request.getVersion());
                responseBuilder.setLookupKeyResponse(lookupKeyResponse);
                break;
            case ListKeys:
                ListKeysResponse listKeysResponse = listKeys(request.getListKeysRequest(), request.getVersion());
                responseBuilder.setListKeysResponse(listKeysResponse);
                break;
            case ListTrash:
                ListTrashResponse listTrashResponse = listTrash(request.getListTrashRequest(), request.getVersion());
                responseBuilder.setListTrashResponse(listTrashResponse);
                break;
            case ListMultiPartUploadParts:
                MultipartUploadListPartsResponse listPartsResponse = listParts(request.getListMultipartUploadPartsRequest());
                responseBuilder.setListMultipartUploadPartsResponse(listPartsResponse);
                break;
            case ListMultipartUploads:
                ListMultipartUploadsResponse response = listMultipartUploads(request.getListMultipartUploadsRequest());
                responseBuilder.setListMultipartUploadsResponse(response);
                break;
            case ServiceList:
                ServiceListResponse serviceListResponse = getServiceList(request.getServiceListRequest());
                responseBuilder.setServiceListResponse(serviceListResponse);
                break;
            case DBUpdates:
                DBUpdatesResponse dbUpdatesResponse = getOMDBUpdates(request.getDbUpdatesRequest());
                responseBuilder.setDbUpdatesResponse(dbUpdatesResponse);
                break;
            case GetFileStatus:
                GetFileStatusResponse getFileStatusResponse = getOzoneFileStatus(request.getGetFileStatusRequest(), request.getVersion());
                responseBuilder.setGetFileStatusResponse(getFileStatusResponse);
                break;
            case LookupFile:
                LookupFileResponse lookupFileResponse = lookupFile(request.getLookupFileRequest(), request.getVersion());
                responseBuilder.setLookupFileResponse(lookupFileResponse);
                break;
            case ListStatus:
                ListStatusResponse listStatusResponse = listStatus(request.getListStatusRequest(), request.getVersion());
                responseBuilder.setListStatusResponse(listStatusResponse);
                break;
            case GetAcl:
                GetAclResponse getAclResponse = getAcl(request.getGetAclRequest());
                responseBuilder.setGetAclResponse(getAclResponse);
                break;
            case FinalizeUpgradeProgress:
                FinalizeUpgradeProgressResponse upgradeProgressResponse = reportUpgradeProgress(request.getFinalizeUpgradeProgressRequest());
                responseBuilder.setFinalizeUpgradeProgressResponse(upgradeProgressResponse);
                break;
            case PrepareStatus:
                PrepareStatusResponse prepareStatusResponse = getPrepareStatus();
                responseBuilder.setPrepareStatusResponse(prepareStatusResponse);
                break;
            case GetS3VolumeContext:
                GetS3VolumeContextResponse s3VolumeContextResponse = getS3VolumeContext();
                responseBuilder.setGetS3VolumeContextResponse(s3VolumeContextResponse);
                break;
            case TenantGetUserInfo:
                impl.checkS3MultiTenancyEnabled();
                TenantGetUserInfoResponse getUserInfoResponse = tenantGetUserInfo(request.getTenantGetUserInfoRequest());
                responseBuilder.setTenantGetUserInfoResponse(getUserInfoResponse);
                break;
            case ListTenant:
                impl.checkS3MultiTenancyEnabled();
                ListTenantResponse listTenantResponse = listTenant(request.getListTenantRequest());
                responseBuilder.setListTenantResponse(listTenantResponse);
                break;
            case TenantListUser:
                impl.checkS3MultiTenancyEnabled();
                TenantListUserResponse listUserResponse = tenantListUsers(request.getTenantListUserRequest());
                responseBuilder.setTenantListUserResponse(listUserResponse);
                break;
            default:
                responseBuilder.setSuccess(false);
                responseBuilder.setMessage("Unrecognized Command Type: " + cmdType);
                break;
        }
        responseBuilder.setSuccess(true);
    } catch (IOException ex) {
        responseBuilder.setSuccess(false);
        responseBuilder.setStatus(exceptionToResponseStatus(ex));
        if (ex.getMessage() != null) {
            responseBuilder.setMessage(ex.getMessage());
        }
    }
    return responseBuilder.build();
}
Also used : FinalizeUpgradeProgressResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse) InfoBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse) LookupKeyResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupKeyResponse) DBUpdatesResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse) TenantGetUserInfoResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantGetUserInfoResponse) ServiceListResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ServiceListResponse) CheckVolumeAccessResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessResponse) GetAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse) TenantListUserResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse) ListVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse) ListTrashResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse) GetS3VolumeContextResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3VolumeContextResponse) InfoVolumeResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse) LookupFileResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.LookupFileResponse) ListKeysResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse) IOException(java.io.IOException) ListTenantResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantResponse) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) ListMultipartUploadsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse) ListBucketsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse) Type(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type) ListStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse) MultipartUploadListPartsResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.MultipartUploadListPartsResponse) GetFileStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse) PrepareStatusResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.PrepareStatusResponse)

Aggregations

TenantListUserResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.TenantListUserResponse)3 OMResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse)2 IOException (java.io.IOException)1 TenantUserList (org.apache.hadoop.ozone.om.helpers.TenantUserList)1 DisallowedUntilLayoutVersion (org.apache.hadoop.ozone.om.upgrade.DisallowedUntilLayoutVersion)1 CheckVolumeAccessResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CheckVolumeAccessResponse)1 DBUpdatesResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.DBUpdatesResponse)1 FinalizeUpgradeProgressResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.FinalizeUpgradeProgressResponse)1 GetAclResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetAclResponse)1 GetFileStatusResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetFileStatusResponse)1 GetS3VolumeContextResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.GetS3VolumeContextResponse)1 InfoBucketResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoBucketResponse)1 InfoVolumeResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.InfoVolumeResponse)1 ListBucketsResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListBucketsResponse)1 ListKeysResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListKeysResponse)1 ListMultipartUploadsResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListMultipartUploadsResponse)1 ListStatusResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListStatusResponse)1 ListTenantResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTenantResponse)1 ListTrashResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListTrashResponse)1 ListVolumeResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.ListVolumeResponse)1