Class NoopAuditManagerS3A
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.fs.s3a.audit.impl.NoopAuditManagerS3A
- All Implemented Interfaces:
Closeable,AutoCloseable,AuditManagerS3A,AWSAuditEventCallbacks,NoopSpan.SpanActivationCallbacks,org.apache.hadoop.fs.store.audit.ActiveThreadSpanSource<AuditSpanS3A>,org.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A>,org.apache.hadoop.service.Service,software.amazon.awssdk.core.interceptor.ExecutionInterceptor
@Private
public class NoopAuditManagerS3A
extends org.apache.hadoop.service.CompositeService
implements AuditManagerS3A, NoopSpan.SpanActivationCallbacks
Simple No-op audit manager for use before a real
audit chain is set up, and for testing.
It does have the service lifecycle, so do
create a unique instance whenever used.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService
org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHookNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
Fields inherited from class org.apache.hadoop.service.CompositeService
STOP_ONLY_STARTED_SERVICES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(AuditSpanS3A span) Span was activated.booleancheckAccess(org.apache.hadoop.fs.Path path, S3AFileStatus status, org.apache.hadoop.fs.permission.FsAction mode) Forward to the auditor.List<software.amazon.awssdk.core.interceptor.ExecutionInterceptor>Create the execution interceptor(s) for this audit service.static AuditSpanS3AcreateNewSpan(String name, String path1, String path2) A static source of no-op spans, using the same span ID source as managed spans.createSpan(String operation, String path1, String path2) software.amazon.awssdk.transfer.s3.progress.TransferListenerReturn a transfer callback which fixes the active span context to be that in which the transfer listener was created.voiddeactivate(AuditSpanS3A span) Span was deactivated.Get the auditor; valid once initialized.Get the name of the operation.Return a span ID which must be unique for all spans within everywhere.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) voidsetAuditFlags(EnumSet<AuditorFlags> flags) Update audit flags, especially the out of span rejection option.Methods inherited from class org.apache.hadoop.service.CompositeService
addIfService, addService, getServices, removeService, serviceStart, serviceStopMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.fs.s3a.audit.AWSAuditEventCallbacks
requestCreatedMethods inherited from interface software.amazon.awssdk.core.interceptor.ExecutionInterceptor
afterExecution, afterMarshalling, afterTransmission, afterUnmarshalling, beforeExecution, beforeMarshalling, beforeTransmission, beforeUnmarshalling, modifyAsyncHttpContent, modifyAsyncHttpResponseContent, modifyException, modifyHttpContent, modifyHttpRequest, modifyHttpResponse, modifyHttpResponseContent, modifyRequest, modifyResponse, onExecutionFailureMethods inherited from interface org.apache.hadoop.service.Service
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
-
Constructor Details
-
NoopAuditManagerS3A
public NoopAuditManagerS3A()Constructor. Will create and start a new instance of the auditor.
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
getSpanId
Description copied from interface:AWSAuditEventCallbacksReturn a span ID which must be unique for all spans within everywhere. That effectively means part of the span SHOULD be derived from a UUID. Callers MUST NOT make any assumptions about the actual contents or structure of this string other than the uniqueness.- Specified by:
getSpanIdin interfaceAWSAuditEventCallbacks- Returns:
- a non-empty string
-
getOperationName
Description copied from interface:AWSAuditEventCallbacksGet the name of the operation.- Specified by:
getOperationNamein interfaceAWSAuditEventCallbacks- Returns:
- the operation name.
-
getAuditor
Description copied from interface:AuditManagerS3AGet the auditor; valid once initialized.- Specified by:
getAuditorin interfaceAuditManagerS3A- Returns:
- the auditor.
-
getActiveAuditSpan
- Specified by:
getActiveAuditSpanin interfaceorg.apache.hadoop.fs.store.audit.ActiveThreadSpanSource<AuditSpanS3A>
-
createSpan
public AuditSpanS3A createSpan(String operation, @Nullable String path1, @Nullable String path2) throws IOException - Specified by:
createSpanin interfaceorg.apache.hadoop.fs.store.audit.AuditSpanSource<AuditSpanS3A>- Throws:
IOException
-
createExecutionInterceptors
public List<software.amazon.awssdk.core.interceptor.ExecutionInterceptor> createExecutionInterceptors() throws IOExceptionDescription copied from interface:AuditManagerS3ACreate the execution interceptor(s) for this audit service. The list returned is mutable; new interceptors may be added.- Specified by:
createExecutionInterceptorsin interfaceAuditManagerS3A- Returns:
- list of interceptors for the SDK.
- Throws:
IOException- failure.
-
createTransferListener
public software.amazon.awssdk.transfer.s3.progress.TransferListener createTransferListener()Description copied from interface:AuditManagerS3AReturn a transfer callback which fixes the active span context to be that in which the transfer listener was created. This can be used to audit the creation of the multipart upload initiation request which the transfer manager makes when a file to be copied is split up. This must be invoked/used within the active span.- Specified by:
createTransferListenerin interfaceAuditManagerS3A- Returns:
- a transfer listener.
-
checkAccess
public boolean checkAccess(org.apache.hadoop.fs.Path path, S3AFileStatus status, org.apache.hadoop.fs.permission.FsAction mode) throws IOException Forward to the auditor.- Specified by:
checkAccessin interfaceAuditManagerS3A- Parameters:
path- path to checkstatus- status of the path.mode- access mode.- Returns:
- true if access is allowed.
- Throws:
IOException- failure
-
activate
Description copied from interface:NoopSpan.SpanActivationCallbacksSpan was activated.- Specified by:
activatein interfaceNoopSpan.SpanActivationCallbacks- Parameters:
span- span reference.
-
deactivate
Description copied from interface:NoopSpan.SpanActivationCallbacksSpan was deactivated.- Specified by:
deactivatein interfaceNoopSpan.SpanActivationCallbacks- Parameters:
span- span reference.
-
createNewSpan
A static source of no-op spans, using the same span ID source as managed spans.- Parameters:
name- operation name.path1- first path of operationpath2- second path of operation- Returns:
- a span for the audit
-
setAuditFlags
Description copied from interface:AuditManagerS3AUpdate audit flags, especially the out of span rejection option.- Specified by:
setAuditFlagsin interfaceAuditManagerS3A- Parameters:
flags- audit flags.
-