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();
}
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();
}
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();
}
Aggregations