Package org.apache.hadoop.fs.s3a.audit
Class AuditIntegration
java.lang.Object
org.apache.hadoop.fs.s3a.audit.AuditIntegration
Support for integrating auditing within the S3A code.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidattachSpanToRequest(software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes, AuditSpanS3A span) Attach a span to the execution attributes.static booleancontainsAuditException(Exception exception) static OperationAuditorcreateAndInitAuditor(org.apache.hadoop.conf.Configuration conf, String key, OperationAuditorOptions options) Create and initialize an audit service.static AuditManagerS3AcreateAndStartAuditManager(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.statistics.impl.IOStatisticsStore iostatistics) Create and start an audit manager.static booleanisRejectOutOfSpan(org.apache.hadoop.conf.Configuration conf) Check if the configuration is set to reject operations that are performed outside of an audit span.static IOExceptionmaybeTranslateAuditException(String path, Exception exception) Translate an exception if it or its inner exception is anAuditFailureException.static AuditSpanS3AretrieveAttachedSpan(software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) Get the span from the execution attributes.static AuditManagerS3AReturn a stub audit manager.static IOExceptiontranslateAuditException(String path, AuditFailureException exception) Translate an audit exception.
-
Method Details
-
createAndStartAuditManager
public static AuditManagerS3A createAndStartAuditManager(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.statistics.impl.IOStatisticsStore iostatistics) Create and start an audit manager.- Parameters:
conf- configurationiostatistics- IOStatistics source.- Returns:
- audit manager.
-
stubAuditManager
Return a stub audit manager.- Returns:
- an audit manager.
-
createAndInitAuditor
public static OperationAuditor createAndInitAuditor(org.apache.hadoop.conf.Configuration conf, String key, OperationAuditorOptions options) throws IOException Create and initialize an audit service. The service start operation is not called: that is left to the caller.- Parameters:
conf- configuration to read the key from and to use to init the service.key- key containing the classnameoptions- options to initialize with.- Returns:
- instantiated class.
- Throws:
IOException- failure to initialise.
-
retrieveAttachedSpan
public static AuditSpanS3A retrieveAttachedSpan(software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes) Get the span from the execution attributes.- Parameters:
executionAttributes- the execution attributes- Returns:
- the span callbacks or null
-
attachSpanToRequest
public static void attachSpanToRequest(software.amazon.awssdk.core.interceptor.ExecutionAttributes executionAttributes, AuditSpanS3A span) Attach a span to the execution attributes.- Parameters:
executionAttributes- the execution attributesspan- span to attach
-
translateAuditException
Translate an audit exception.- Parameters:
path- path of operation.exception- exception- Returns:
- the IOE to raise.
-
maybeTranslateAuditException
Translate an exception if it or its inner exception is anAuditFailureException. If this condition is not met, null is returned.- Parameters:
path- path of operation.exception- exception- Returns:
- a translated exception or null.
-
containsAuditException
-
isRejectOutOfSpan
public static boolean isRejectOutOfSpan(org.apache.hadoop.conf.Configuration conf) Check if the configuration is set to reject operations that are performed outside of an audit span.- Parameters:
conf- the configuration to check- Returns:
- true if operations outside of an audit span should be rejected, false otherwise
-