Search in sources :

Example 1 with AddAclRequest

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

the class TestOMPrefixAclRequest method createAddAclkeyRequest.

/**
 * Create OMRequest which encapsulates OMKeyAddAclRequest.
 */
private OMRequest createAddAclkeyRequest(OzoneAcl acl) {
    OzoneObj obj = OzoneObjInfo.Builder.newBuilder().setBucketName(bucketName).setVolumeName(volumeName).setKeyName(keyName).setResType(OzoneObj.ResourceType.PREFIX).setStoreType(OzoneObj.StoreType.OZONE).build();
    AddAclRequest addAclRequest = AddAclRequest.newBuilder().setObj(OzoneObj.toProtobuf(obj)).setAcl(OzoneAcl.toProtobuf(acl)).build();
    return OMRequest.newBuilder().setClientId(UUID.randomUUID().toString()).setCmdType(OzoneManagerProtocolProtos.Type.AddAcl).setAddAclRequest(addAclRequest).build();
}
Also used : OzoneObj(org.apache.hadoop.ozone.security.acl.OzoneObj) AddAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest) OMPrefixAddAclRequest(org.apache.hadoop.ozone.om.request.key.acl.prefix.OMPrefixAddAclRequest)

Example 2 with AddAclRequest

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

the class TestOMKeyAclRequest method createAddAclkeyRequest.

/**
 * Create OMRequest which encapsulates OMKeyAddAclRequest.
 */
protected OMRequest createAddAclkeyRequest(OzoneAcl acl) {
    OzoneObj obj = OzoneObjInfo.Builder.newBuilder().setBucketName(bucketName).setVolumeName(volumeName).setKeyName(keyName).setResType(OzoneObj.ResourceType.KEY).setStoreType(OzoneObj.StoreType.OZONE).build();
    AddAclRequest addAclRequest = AddAclRequest.newBuilder().setObj(OzoneObj.toProtobuf(obj)).setAcl(OzoneAcl.toProtobuf(acl)).build();
    return OMRequest.newBuilder().setClientId(UUID.randomUUID().toString()).setCmdType(OzoneManagerProtocolProtos.Type.AddAcl).setAddAclRequest(addAclRequest).build();
}
Also used : OzoneObj(org.apache.hadoop.ozone.security.acl.OzoneObj) AddAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest) OMKeyAddAclRequest(org.apache.hadoop.ozone.om.request.key.acl.OMKeyAddAclRequest)

Example 3 with AddAclRequest

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

the class OzoneManagerProtocolClientSideTranslatorPB method addAcl.

/**
 * Add acl for Ozone object. Return true if acl is added successfully else
 * false.
 *
 * @param obj Ozone object for which acl should be added.
 * @param acl ozone acl to be added.
 * @throws IOException if there is error.
 */
@Override
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException {
    AddAclRequest req = AddAclRequest.newBuilder().setObj(OzoneObj.toProtobuf(obj)).setAcl(OzoneAcl.toProtobuf(acl)).build();
    OMRequest omRequest = createOMRequest(Type.AddAcl).setAddAclRequest(req).build();
    AddAclResponse addAclResponse = handleError(submitRequest(omRequest)).getAddAclResponse();
    return addAclResponse.getResponse();
}
Also used : OMRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest) AddAclResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclResponse) AddAclRequest(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest)

Aggregations

AddAclRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclRequest)3 OzoneObj (org.apache.hadoop.ozone.security.acl.OzoneObj)2 OMKeyAddAclRequest (org.apache.hadoop.ozone.om.request.key.acl.OMKeyAddAclRequest)1 OMPrefixAddAclRequest (org.apache.hadoop.ozone.om.request.key.acl.prefix.OMPrefixAddAclRequest)1 AddAclResponse (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.AddAclResponse)1 OMRequest (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest)1