public class ClientConfiguration extends java.lang.Object implements ProcessingConfiguration
AWSCloudTrailProcessingExecutor
as an alternative to using a class path properties file.Modifier and Type | Field and Description |
---|---|
AWSCredentialsProvider |
awsCredentialsProvider
The AWS credentials provider
used to obtain credentials.
|
boolean |
deleteMessageUponFailure
whether or not to delete SQS messages when there is any failure during
SqsManager.parseMessage(List) and
EventReader.processSource(CloudTrailSource) . |
boolean |
enableRawEventInfo
Whether to include raw event information in
CloudTrailEventMetadata . |
int |
maxEventsPerEmit
The maximum number of AWSCloudTrailClientEvents sent to a single invocation of processEvents().
|
int |
numOfParallelReaders
The number of SQS reader threads
|
java.lang.String |
s3Region
The S3 endpoint specific to a region.
|
java.lang.String |
sqsRegion
The SQS region to use.
|
java.lang.String |
sqsUrl
The SQS Queue URL used to receive events.
|
int |
threadCount
The number of threads used to download log files from S3 in parallel.
|
int |
threadTerminationDelaySeconds
The time allowed, in seconds, for threads to shut down after
AWSCloudTrailProcessingExecutor.stop() is
called. |
int |
visibilityTimeout
A period of time, in seconds, during which Amazon SQS prevents other consuming components from receiving and
processing messages that are currently being processed by the CloudTrail Processing Library on your behalf.
|
DEFAULT_DELETE_MESSAGE_UPON_FAILURE, DEFAULT_ENABLE_RAW_EVENT_INFO, DEFAULT_MAX_EVENTS_PER_EMIT, DEFAULT_NUM_OF_PARALLEL_READERS, DEFAULT_S3_REGION, DEFAULT_SQS_REGION, DEFAULT_THREAD_COUNT, DEFAULT_THREAD_TERMINATION_DELAY_SECONDS, DEFAULT_VISIBILITY_TIMEOUT
Constructor and Description |
---|
ClientConfiguration(java.lang.String sqsUrl,
AWSCredentialsProvider awsCredentialsProvider)
Initializes a new
ClientConfiguration . |
Modifier and Type | Method and Description |
---|---|
AWSCredentialsProvider |
getAwsCredentialsProvider()
Get the AWS Credentials provider used to access AWS.
|
int |
getMaxEventsPerEmit()
Get the maximum number of AWSCloudTrailClientEvents sent to a single invocation of processEvents().
|
int |
getNumOfParallelReaders()
Get a number of reader threads
|
java.lang.String |
getS3Region()
Get the AWS S3 Region.
|
java.lang.String |
getSqsRegion()
Gets the SQS Region from which CloudTrail logs are obtained.
|
java.lang.String |
getSqsUrl()
Gets the SQS URL used to obtain CloudTrail logs.
|
int |
getThreadCount()
Get the number of threads used to download S3 files in parallel.
|
int |
getThreadTerminationDelaySeconds()
Get the thread termination delay value.
|
int |
getVisibilityTimeout()
Get the visibility timeout value for the SQS queue.
|
boolean |
isDeleteMessageUponFailure()
Indicates whether to delete SQS messages when there is a failure during
SqsManager.parseMessage(List)
and EventReader.processSource(CloudTrailSource) . |
boolean |
isEnableRawEventInfo()
Indicates whether raw event information is returned in
CloudTrailEventMetadata . |
void |
setAwsCredentialsProvider(AWSCredentialsProvider awsCredentialsProvider)
Set the AWS Credentials Provider used to access AWS.
|
void |
setDeleteMessageUponFailure(boolean deleteMessageUponFailure)
Set whether or not to delete SQS messages when there is any failure during
SqsManager.parseMessage(List)
and EventReader.processSource(CloudTrailSource) . |
void |
setEnableRawEventInfo(boolean enableRawEventInfo)
Set whether or not raw event information should be returned in
CloudTrailEventMetadata . |
void |
setMaxEventsPerEmit(int maxEventsPerEmit)
Set the maximum number of events that can be buffered per call to
processEvents() . |
void |
setNumOfParallelReaders(int numOfParallelReaders)
The number of reader threads that pull messages from the SQS
|
void |
setS3Region(java.lang.String s3Region)
The S3 endpoint specific to a region.
|
void |
setSqsRegion(java.lang.String sqsRegion)
Sets the SQS Region to use to get CloudTrail logs.
|
void |
setThreadCount(int threadCount)
The number of threads used to download log files from S3 in parallel.
|
void |
setThreadTerminationDelaySeconds(int threadTerminationDelaySeconds)
Set the time allowed, in seconds, for threads to shut down after
AWSCloudTrailProcessingExecutor.stop() is called. |
void |
setVisibilityTimeout(int visibilityTimeout)
Sets the SQS visibility timeout, during which SQS ignores other requests
for the message.
|
void |
validate()
Validate that all necessary parameters are set in the provided configuration.
|
public AWSCredentialsProvider awsCredentialsProvider
public java.lang.String sqsUrl
The Queue must be subscribed to AWS CloudTrail.
public java.lang.String sqsRegion
If not specified, the will be used.
public int visibilityTimeout
public java.lang.String s3Region
If not specified, the will be used.
public int threadCount
Callbacks can be invoked from any thread.
public int numOfParallelReaders
public int threadTerminationDelaySeconds
AWSCloudTrailProcessingExecutor.stop()
is
called.
Any threads still running beyond this time will be forcibly terminated.
public int maxEventsPerEmit
public boolean enableRawEventInfo
CloudTrailEventMetadata
.public boolean deleteMessageUponFailure
SqsManager.parseMessage(List)
and
EventReader.processSource(CloudTrailSource)
.public ClientConfiguration(java.lang.String sqsUrl, AWSCredentialsProvider awsCredentialsProvider)
ClientConfiguration
.
Both parameters are required.
sqsUrl
- the SQS URL to use to get CloudTrail events.awsCredentialsProvider
- The AWS Credentials provider to use to
obtain AWS access credentials.public AWSCredentialsProvider getAwsCredentialsProvider()
getAwsCredentialsProvider
in interface ProcessingConfiguration
public java.lang.String getSqsUrl()
getSqsUrl
in interface ProcessingConfiguration
public java.lang.String getSqsRegion()
getSqsRegion
in interface ProcessingConfiguration
public int getVisibilityTimeout()
The period of time during which Amazon SQS prevents other consuming components from receiving and processing a message.
getVisibilityTimeout
in interface ProcessingConfiguration
public java.lang.String getS3Region()
getS3Region
in interface ProcessingConfiguration
public int getThreadCount()
getThreadCount
in interface ProcessingConfiguration
public int getNumOfParallelReaders()
getNumOfParallelReaders
in interface ProcessingConfiguration
public int getThreadTerminationDelaySeconds()
getThreadTerminationDelaySeconds
in interface ProcessingConfiguration
public int getMaxEventsPerEmit()
getMaxEventsPerEmit
in interface ProcessingConfiguration
public boolean isEnableRawEventInfo()
CloudTrailEventMetadata
.isEnableRawEventInfo
in interface ProcessingConfiguration
true
if raw event information is enabled; false
otherwise.public boolean isDeleteMessageUponFailure()
SqsManager.parseMessage(List)
and EventReader.processSource(CloudTrailSource)
.
The SQS message will be deleted upon success regardless of the setting for deleteMessageUponFailure.isDeleteMessageUponFailure
in interface ProcessingConfiguration
true
if delete SQS message upon failure is enabled. Otherwise, false
.public void validate()
This method throws an exception if any of the required parameters are null
.
validate
in interface ProcessingConfiguration
public void setAwsCredentialsProvider(AWSCredentialsProvider awsCredentialsProvider)
awsCredentialsProvider
- the
AWSCredentialsProvider
to set.public void setSqsRegion(java.lang.String sqsRegion)
sqsRegion
- the
AWS region
to use.public void setVisibilityTimeout(int visibilityTimeout)
visibilityTimeout
- the duration, in seconds, to ignore other
requests for SQS messages being processed by the AWS CloudTrail
Processing Library.public void setS3Region(java.lang.String s3Region)
If not specified, the default S3 region will be used.
s3Region
- the s3Region to setpublic void setThreadCount(int threadCount)
Callbacks can be invoked from any thread.
threadCount
- the number of threads to set.public void setNumOfParallelReaders(int numOfParallelReaders)
numOfParallelReaders
- public void setThreadTerminationDelaySeconds(int threadTerminationDelaySeconds)
AWSCloudTrailProcessingExecutor.stop()
is called.
Any threads still running beyond this time will be forcibly terminated.
threadTerminationDelaySeconds
- the termination delay, in seconds, to set.public void setMaxEventsPerEmit(int maxEventsPerEmit)
processEvents()
.
Fewer events than this may be sent; this number represents only the maximum.
maxEventsPerEmit
- the maximum number of events to buffer.public void setEnableRawEventInfo(boolean enableRawEventInfo)
CloudTrailEventMetadata
.enableRawEventInfo
- set to true
to enable raw event information.public void setDeleteMessageUponFailure(boolean deleteMessageUponFailure)
SqsManager.parseMessage(List)
and EventReader.processSource(CloudTrailSource)
.
The SQS message will be deleted upon success regardless the setting of deleteMessageUponFailure
.deleteMessageUponFailure
- set to true
to delete messages upon failure.