Class EndpointBase
java.lang.Object
org.apache.hadoop.ozone.s3.endpoint.EndpointBase
- All Implemented Interfaces:
org.apache.hadoop.ozone.audit.Auditor
- Direct Known Subclasses:
BucketEndpoint,ObjectEndpoint,RootEndpoint
Basic helpers for all the REST endpoints.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.hadoop.ozone.audit.AuditLoggerprotected static final Stringprotected SignatureInfo -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomMetadataHeaders(javax.ws.rs.core.Response.ResponseBuilder responseBuilder, org.apache.hadoop.ozone.client.OzoneKey key) protected voidauditReadFailure(org.apache.hadoop.ozone.audit.AuditAction action, Exception ex) protected voidauditWriteFailure(org.apache.hadoop.ozone.audit.AuditAction action, Throwable ex) org.apache.hadoop.ozone.audit.AuditMessagebuildAuditMessageForFailure(org.apache.hadoop.ozone.audit.AuditAction op, Map<String, String> auditMap, Throwable throwable) org.apache.hadoop.ozone.audit.AuditMessagebuildAuditMessageForSuccess(org.apache.hadoop.ozone.audit.AuditAction op, Map<String, String> auditMap) org.apache.hadoop.ozone.audit.AuditMessagebuildAuditMessageForSuccess(org.apache.hadoop.ozone.audit.AuditAction op, Map<String, String> auditMap, org.apache.hadoop.ozone.audit.AuditLogger.PerformanceStringBuilder performance) protected StringcreateS3Bucket(String bucketName) Create an S3Bucket, and also it creates mapping needed to access via ozone and S3.protected voiddeleteS3Bucket(String s3BucketName) Deletes an s3 bucket and removes mapping of Ozone volume/bucket.protected org.apache.hadoop.ozone.client.OzoneBucketprotected org.apache.hadoop.ozone.client.OzoneBucketorg.apache.hadoop.ozone.client.OzoneClientprotected org.apache.hadoop.ozone.client.protocol.ClientProtocolgetCustomMetadataFromHeaders(javax.ws.rs.core.MultivaluedMap<String, String> requestHeaders) getTaggingFromHeaders(javax.ws.rs.core.HttpHeaders httpHeaders) protected org.apache.hadoop.ozone.client.OzoneVolumeabstract voidinit()voidInitializes the object post construction.protected booleanisAccessDenied(org.apache.hadoop.ozone.om.exceptions.OMException ex) protected Iterator<? extends org.apache.hadoop.ozone.client.OzoneBucket> listS3Buckets(String prefix, String previousBucket, Consumer<org.apache.hadoop.ozone.client.OzoneVolume> volumeProcessor) Returns Iterator to iterate over all buckets after prevBucket for a specific user.protected Iterator<? extends org.apache.hadoop.ozone.client.OzoneBucket> listS3Buckets(String prefix, Consumer<org.apache.hadoop.ozone.client.OzoneVolume> volumeProcessor) Returns Iterator to iterate over all buckets for a specific user.voidsetClient(org.apache.hadoop.ozone.client.OzoneClient ozoneClient) voidsetRequestIdentifier(RequestIdentifier requestIdentifier) voidsetSignatureInfo(SignatureInfo signatureInfo) validateAndGetTagging(List<KV> tagList, Function<KV, String> getTagKey, Function<KV, String> getTagValue)
-
Field Details
-
ETAG_CUSTOM
- See Also:
-
signatureInfo
-
AUDIT
protected static final org.apache.hadoop.ozone.audit.AuditLogger AUDIT
-
-
Constructor Details
-
EndpointBase
public EndpointBase()
-
-
Method Details
-
getBucket
protected org.apache.hadoop.ozone.client.OzoneBucket getBucket(org.apache.hadoop.ozone.client.OzoneVolume volume, String bucketName) throws OS3Exception, IOException - Throws:
OS3ExceptionIOException
-
initialization
Initializes the object post construction. Calls init() from any child classes to work around the issue of only one method can be annotated. -
init
public abstract void init() -
getBucket
protected org.apache.hadoop.ozone.client.OzoneBucket getBucket(String bucketName) throws OS3Exception, IOException - Throws:
OS3ExceptionIOException
-
getVolume
- Throws:
IOException
-
createS3Bucket
Create an S3Bucket, and also it creates mapping needed to access via ozone and S3.- Parameters:
bucketName-- Returns:
- location of the S3Bucket.
- Throws:
IOExceptionOS3Exception
-
deleteS3Bucket
Deletes an s3 bucket and removes mapping of Ozone volume/bucket.- Parameters:
s3BucketName- - S3 Bucket Name.- Throws:
IOException- in case the bucket cannot be deleted.OS3Exception
-
listS3Buckets
protected Iterator<? extends org.apache.hadoop.ozone.client.OzoneBucket> listS3Buckets(String prefix, Consumer<org.apache.hadoop.ozone.client.OzoneVolume> volumeProcessor) throws IOException, OS3Exception Returns Iterator to iterate over all buckets for a specific user. The result can be restricted using bucket prefix, will return all buckets if bucket prefix is null.- Parameters:
prefix- Bucket prefix to matchvolumeProcessor- Volume processor to operate on volume- Returns:
Iterator<OzoneBucket>- Throws:
IOExceptionOS3Exception
-
listS3Buckets
protected Iterator<? extends org.apache.hadoop.ozone.client.OzoneBucket> listS3Buckets(String prefix, String previousBucket, Consumer<org.apache.hadoop.ozone.client.OzoneVolume> volumeProcessor) throws IOException, OS3Exception Returns Iterator to iterate over all buckets after prevBucket for a specific user. If prevBucket is null it returns an iterator to iterate over all buckets for this user. The result can be restricted using bucket prefix, will return all buckets if bucket prefix is null.- Parameters:
prefix- Bucket prefix to matchpreviousBucket- Buckets are listed after this bucket- Returns:
Iterator<OzoneBucket>- Throws:
IOExceptionOS3Exception
-
getCustomMetadataFromHeaders
protected Map<String,String> getCustomMetadataFromHeaders(javax.ws.rs.core.MultivaluedMap<String, String> requestHeaders) throws OS3Exception- Throws:
OS3Exception
-
addCustomMetadataHeaders
protected void addCustomMetadataHeaders(javax.ws.rs.core.Response.ResponseBuilder responseBuilder, org.apache.hadoop.ozone.client.OzoneKey key) -
getTaggingFromHeaders
protected Map<String,String> getTaggingFromHeaders(javax.ws.rs.core.HttpHeaders httpHeaders) throws OS3Exception - Throws:
OS3Exception
-
validateAndGetTagging
protected static <KV> Map<String,String> validateAndGetTagging(List<KV> tagList, Function<KV, String> getTagKey, Function<KV, throws OS3ExceptionString> getTagValue) - Throws:
OS3Exception
-
buildAuditMessageForSuccess
public org.apache.hadoop.ozone.audit.AuditMessage buildAuditMessageForSuccess(org.apache.hadoop.ozone.audit.AuditAction op, Map<String, String> auditMap) - Specified by:
buildAuditMessageForSuccessin interfaceorg.apache.hadoop.ozone.audit.Auditor
-
buildAuditMessageForSuccess
-
buildAuditMessageForFailure
public org.apache.hadoop.ozone.audit.AuditMessage buildAuditMessageForFailure(org.apache.hadoop.ozone.audit.AuditAction op, Map<String, String> auditMap, Throwable throwable) - Specified by:
buildAuditMessageForFailurein interfaceorg.apache.hadoop.ozone.audit.Auditor
-
setClient
public void setClient(org.apache.hadoop.ozone.client.OzoneClient ozoneClient) -
setRequestIdentifier
-
setSignatureInfo
-
getClient
public org.apache.hadoop.ozone.client.OzoneClient getClient() -
getClientProtocol
protected org.apache.hadoop.ozone.client.protocol.ClientProtocol getClientProtocol() -
getMetrics
-
getAuditParameters
-
auditWriteFailure
-
auditReadFailure
-
isAccessDenied
protected boolean isAccessDenied(org.apache.hadoop.ozone.om.exceptions.OMException ex)
-