-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathProcessingConfiguration.java
175 lines (149 loc) · 5.74 KB
/
ProcessingConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*******************************************************************************
* Copyright 2010-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
******************************************************************************/
package com.amazonaws.services.cloudtrail.processinglibrary.configuration;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.services.cloudtrail.processinglibrary.manager.SqsManager;
import com.amazonaws.services.cloudtrail.processinglibrary.model.CloudTrailEventMetadata;
import com.amazonaws.services.cloudtrail.processinglibrary.model.CloudTrailSource;
import com.amazonaws.services.cloudtrail.processinglibrary.reader.EventReader;
import java.util.List;
/**
* Data used to configure a {@link EventReader}.
* <p>
* You can use a system properties file to load the configuration or create a {@link ClientConfiguration} object and set
* each attribute. If you do not provide a value for an attribute, a default value will be provided.
* </p>
*/
public interface ProcessingConfiguration {
/* default configuration values */
/**
* The default SQS region; {@value}.
*/
public static final String DEFAULT_SQS_REGION = "us-east-1";
/**
* The default S3 region; {@value}.
*/
public static final String DEFAULT_S3_REGION = "us-east-1";
/**
* The default SQS visibility timeout, in seconds; {@value}.
*/
public static final int DEFAULT_VISIBILITY_TIMEOUT = 60;
/**
* The default S3 thread count; {@value}.
*/
public static final int DEFAULT_THREAD_COUNT = 1;
/**
* The default SQS reader thread count
*/
public static final int DEFAULT_NUM_OF_PARALLEL_READERS = 1;
/**
* The default thread termination delay, in seconds; {@value}.
*/
public static final int DEFAULT_THREAD_TERMINATION_DELAY_SECONDS = 60;
/**
* The default number of events accumulated before emitting; {@value}.
*/
public static final int DEFAULT_MAX_EVENTS_PER_EMIT = 1;
/**
* Whether to enable raw event information in event metadata; {@value}.
*/
public static final boolean DEFAULT_ENABLE_RAW_EVENT_INFO = false;
/**
* Whether to delete SQS messages if there is failure
* during {@link SqsManager#parseMessage(List)} and {@link EventReader#processSource(CloudTrailSource)}; {@value}.
*/
public static final boolean DEFAULT_DELETE_MESSAGE_UPON_FAILURE = false;
/**
* Get the AWS Credentials provider used to access AWS.
*
* @return an
* <a href="http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/AWSCredentialsProvider.html">AWSCredentialsProvider</a>
* object.
*/
public AWSCredentialsProvider getAwsCredentialsProvider();
/**
* Gets the SQS URL used to obtain CloudTrail logs.
*
* @return the configured SQS URL used to get CloudTrail logs.
*/
public String getSqsUrl();
/**
* Gets the SQS Region from which CloudTrail logs are obtained.
*
* @return the SQS Region
*/
public String getSqsRegion();
/**
* Get the visibility timeout value for the SQS queue.
* <p>
* The period of time during which Amazon SQS prevents other consuming
* components from receiving and processing a message.
*
* @return the visibility timeout value.
*/
public int getVisibilityTimeout();
/**
* Get the AWS S3 Region.
*
* @return the Amazon S3 region used.
*/
public String getS3Region();
/**
* Get the number of threads used to download S3 files in parallel.
*
* @return the number of threads.
*/
public int getThreadCount();
/**
* Get a number of reader threads
* @return
*/
public int getNumOfParallelReaders();
/**
* Get the thread termination delay value.
*
* @return the thread termination delay, in seconds.
*/
public int getThreadTerminationDelaySeconds();
/**
* Get the maximum number of AWSCloudTrailClientEvents sent to a single invocation of processEvents().
*
* @return the maximum number of events that will be buffered per call to processEvents.
*/
public int getMaxEventsPerEmit();
/**
* Indicates whether raw event information is returned in
* {@link CloudTrailEventMetadata}.
*
* @return <code>true</code> if raw event information is enabled; <code>false</code> otherwise.
*/
public boolean isEnableRawEventInfo();
/**
* Indicates whether to delete SQS messages when there is a failure during {@link SqsManager#parseMessage(List)}
* and {@link EventReader#processSource(CloudTrailSource)}.
* The SQS message will be deleted upon success regardless of the setting for deleteMessageUponFailure.
*
* @return <code>true</code> if delete SQS message upon failure is enabled. Otherwise, <code>false</code>.
*/
public boolean isDeleteMessageUponFailure();
/**
* Validate that all necessary parameters are set in the provided configuration.
* <p>
* This method throws an exception if any of the required parameters are <code>null</code>.
* </p>
* @throws IllegalStateException if any parameters are <code>null</code>.
*/
public void validate();
}