* An array containing the ARN of the log group that this anomaly detector will watch. You can specify only one log
* group ARN.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasLogGroupArnList} method.
*
*
* @return An array containing the ARN of the log group that this anomaly detector will watch. You can specify only
* one log group ARN.
*/
public final List logGroupArnList() {
return logGroupArnList;
}
/**
*
* A name for this anomaly detector.
*
*
* @return A name for this anomaly detector.
*/
public final String detectorName() {
return detectorName;
}
/**
*
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to the
* frequency that the log group receives new logs. For example, if the log group receives new log events every 10
* minutes, then 15 minutes might be a good setting for evaluationFrequency
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #evaluationFrequency} will return {@link EvaluationFrequency#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #evaluationFrequencyAsString}.
*
*
* @return Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to
* the frequency that the log group receives new logs. For example, if the log group receives new log events
* every 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
.
* @see EvaluationFrequency
*/
public final EvaluationFrequency evaluationFrequency() {
return EvaluationFrequency.fromValue(evaluationFrequency);
}
/**
*
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to the
* frequency that the log group receives new logs. For example, if the log group receives new log events every 10
* minutes, then 15 minutes might be a good setting for evaluationFrequency
.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #evaluationFrequency} will return {@link EvaluationFrequency#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #evaluationFrequencyAsString}.
*
*
* @return Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to
* the frequency that the log group receives new logs. For example, if the log group receives new log events
* every 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
.
* @see EvaluationFrequency
*/
public final String evaluationFrequencyAsString() {
return evaluationFrequency;
}
/**
*
* You can use this parameter to limit the anomaly detection model to examine only log events that match the pattern
* you specify here. For more information, see Filter and Pattern
* Syntax .
*
*
* @return You can use this parameter to limit the anomaly detection model to examine only log events that match the
* pattern you specify here. For more information, see Filter and
* Pattern Syntax .
*/
public final String filterPattern() {
return filterPattern;
}
/**
*
* Optionally assigns a KMS key to secure this anomaly detector and its findings. If a key is assigned, the
* anomalies found and the model used by this detector are encrypted at rest with the key. If a key is assigned to
* an anomaly detector, a user must have permissions for both this key and for the anomaly detector to retrieve
* information about the anomalies that it finds.
*
*
* For more information about using a KMS key and to see the required IAM policy, see Use a KMS key with
* an anomaly detector .
*
*
* @return Optionally assigns a KMS key to secure this anomaly detector and its findings. If a key is assigned, the
* anomalies found and the model used by this detector are encrypted at rest with the key. If a key is
* assigned to an anomaly detector, a user must have permissions for both this key and for the anomaly
* detector to retrieve information about the anomalies that it finds.
*
* For more information about using a KMS key and to see the required IAM policy, see Use a KMS
* key with an anomaly detector .
*/
public final String kmsKeyId() {
return kmsKeyId;
}
/**
*
* The number of days to have visibility on an anomaly. After this time period has elapsed for an anomaly, it will
* be automatically baselined and the anomaly detector will treat new occurrences of a similar anomaly as normal.
* Therefore, if you do not correct the cause of an anomaly during the time period specified in
* anomalyVisibilityTime
, it will be considered normal going forward and will not be detected as an
* anomaly.
*
*
* @return The number of days to have visibility on an anomaly. After this time period has elapsed for an anomaly,
* it will be automatically baselined and the anomaly detector will treat new occurrences of a similar
* anomaly as normal. Therefore, if you do not correct the cause of an anomaly during the time period
* specified in anomalyVisibilityTime
, it will be considered normal going forward and will not
* be detected as an anomaly.
*/
public final Long anomalyVisibilityTime() {
return anomalyVisibilityTime;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* An optional list of key-value pairs to associate with the resource.
*
*
* For more information about tagging, see Tagging Amazon Web Services resources
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return An optional list of key-value pairs to associate with the resource.
*
* For more information about tagging, see Tagging Amazon Web Services
* resources
*/
public final Map tags() {
return tags;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(hasLogGroupArnList() ? logGroupArnList() : null);
hashCode = 31 * hashCode + Objects.hashCode(detectorName());
hashCode = 31 * hashCode + Objects.hashCode(evaluationFrequencyAsString());
hashCode = 31 * hashCode + Objects.hashCode(filterPattern());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId());
hashCode = 31 * hashCode + Objects.hashCode(anomalyVisibilityTime());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateLogAnomalyDetectorRequest)) {
return false;
}
CreateLogAnomalyDetectorRequest other = (CreateLogAnomalyDetectorRequest) obj;
return hasLogGroupArnList() == other.hasLogGroupArnList() && Objects.equals(logGroupArnList(), other.logGroupArnList())
&& Objects.equals(detectorName(), other.detectorName())
&& Objects.equals(evaluationFrequencyAsString(), other.evaluationFrequencyAsString())
&& Objects.equals(filterPattern(), other.filterPattern()) && Objects.equals(kmsKeyId(), other.kmsKeyId())
&& Objects.equals(anomalyVisibilityTime(), other.anomalyVisibilityTime()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("CreateLogAnomalyDetectorRequest")
.add("LogGroupArnList", hasLogGroupArnList() ? logGroupArnList() : null).add("DetectorName", detectorName())
.add("EvaluationFrequency", evaluationFrequencyAsString()).add("FilterPattern", filterPattern())
.add("KmsKeyId", kmsKeyId()).add("AnomalyVisibilityTime", anomalyVisibilityTime())
.add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "logGroupArnList":
return Optional.ofNullable(clazz.cast(logGroupArnList()));
case "detectorName":
return Optional.ofNullable(clazz.cast(detectorName()));
case "evaluationFrequency":
return Optional.ofNullable(clazz.cast(evaluationFrequencyAsString()));
case "filterPattern":
return Optional.ofNullable(clazz.cast(filterPattern()));
case "kmsKeyId":
return Optional.ofNullable(clazz.cast(kmsKeyId()));
case "anomalyVisibilityTime":
return Optional.ofNullable(clazz.cast(anomalyVisibilityTime()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((CreateLogAnomalyDetectorRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends CloudWatchLogsRequest.Builder, SdkPojo,
CopyableBuilder {
/**
*
* An array containing the ARN of the log group that this anomaly detector will watch. You can specify only one
* log group ARN.
*
*
* @param logGroupArnList
* An array containing the ARN of the log group that this anomaly detector will watch. You can specify
* only one log group ARN.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder logGroupArnList(Collection logGroupArnList);
/**
*
* An array containing the ARN of the log group that this anomaly detector will watch. You can specify only one
* log group ARN.
*
*
* @param logGroupArnList
* An array containing the ARN of the log group that this anomaly detector will watch. You can specify
* only one log group ARN.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder logGroupArnList(String... logGroupArnList);
/**
*
* A name for this anomaly detector.
*
*
* @param detectorName
* A name for this anomaly detector.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder detectorName(String detectorName);
/**
*
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to the
* frequency that the log group receives new logs. For example, if the log group receives new log events every
* 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
.
*
*
* @param evaluationFrequency
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to
* the frequency that the log group receives new logs. For example, if the log group receives new log
* events every 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
* .
* @see EvaluationFrequency
* @return Returns a reference to this object so that method calls can be chained together.
* @see EvaluationFrequency
*/
Builder evaluationFrequency(String evaluationFrequency);
/**
*
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to the
* frequency that the log group receives new logs. For example, if the log group receives new log events every
* 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
.
*
*
* @param evaluationFrequency
* Specifies how often the anomaly detector is to run and look for anomalies. Set this value according to
* the frequency that the log group receives new logs. For example, if the log group receives new log
* events every 10 minutes, then 15 minutes might be a good setting for evaluationFrequency
* .
* @see EvaluationFrequency
* @return Returns a reference to this object so that method calls can be chained together.
* @see EvaluationFrequency
*/
Builder evaluationFrequency(EvaluationFrequency evaluationFrequency);
/**
*
* You can use this parameter to limit the anomaly detection model to examine only log events that match the
* pattern you specify here. For more information, see Filter and
* Pattern Syntax .
*
*
* @param filterPattern
* You can use this parameter to limit the anomaly detection model to examine only log events that match
* the pattern you specify here. For more information, see Filter and
* Pattern Syntax .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder filterPattern(String filterPattern);
/**
*
* Optionally assigns a KMS key to secure this anomaly detector and its findings. If a key is assigned, the
* anomalies found and the model used by this detector are encrypted at rest with the key. If a key is assigned
* to an anomaly detector, a user must have permissions for both this key and for the anomaly detector to
* retrieve information about the anomalies that it finds.
*
*
* For more information about using a KMS key and to see the required IAM policy, see Use a KMS key
* with an anomaly detector .
*
*
* @param kmsKeyId
* Optionally assigns a KMS key to secure this anomaly detector and its findings. If a key is assigned,
* the anomalies found and the model used by this detector are encrypted at rest with the key. If a key
* is assigned to an anomaly detector, a user must have permissions for both this key and for the anomaly
* detector to retrieve information about the anomalies that it finds.
*
* For more information about using a KMS key and to see the required IAM policy, see Use a
* KMS key with an anomaly detector .
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder kmsKeyId(String kmsKeyId);
/**
*
* The number of days to have visibility on an anomaly. After this time period has elapsed for an anomaly, it
* will be automatically baselined and the anomaly detector will treat new occurrences of a similar anomaly as
* normal. Therefore, if you do not correct the cause of an anomaly during the time period specified in
* anomalyVisibilityTime
, it will be considered normal going forward and will not be detected as an
* anomaly.
*
*
* @param anomalyVisibilityTime
* The number of days to have visibility on an anomaly. After this time period has elapsed for an
* anomaly, it will be automatically baselined and the anomaly detector will treat new occurrences of a
* similar anomaly as normal. Therefore, if you do not correct the cause of an anomaly during the time
* period specified in anomalyVisibilityTime
, it will be considered normal going forward and
* will not be detected as an anomaly.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder anomalyVisibilityTime(Long anomalyVisibilityTime);
/**
*
* An optional list of key-value pairs to associate with the resource.
*
*
* For more information about tagging, see Tagging Amazon Web Services
* resources
*
*
* @param tags
* An optional list of key-value pairs to associate with the resource.
*
* For more information about tagging, see Tagging Amazon Web Services
* resources
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CloudWatchLogsRequest.BuilderImpl implements Builder {
private List logGroupArnList = DefaultSdkAutoConstructList.getInstance();
private String detectorName;
private String evaluationFrequency;
private String filterPattern;
private String kmsKeyId;
private Long anomalyVisibilityTime;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateLogAnomalyDetectorRequest model) {
super(model);
logGroupArnList(model.logGroupArnList);
detectorName(model.detectorName);
evaluationFrequency(model.evaluationFrequency);
filterPattern(model.filterPattern);
kmsKeyId(model.kmsKeyId);
anomalyVisibilityTime(model.anomalyVisibilityTime);
tags(model.tags);
}
public final Collection getLogGroupArnList() {
if (logGroupArnList instanceof SdkAutoConstructList) {
return null;
}
return logGroupArnList;
}
public final void setLogGroupArnList(Collection logGroupArnList) {
this.logGroupArnList = LogGroupArnListCopier.copy(logGroupArnList);
}
@Override
public final Builder logGroupArnList(Collection logGroupArnList) {
this.logGroupArnList = LogGroupArnListCopier.copy(logGroupArnList);
return this;
}
@Override
@SafeVarargs
public final Builder logGroupArnList(String... logGroupArnList) {
logGroupArnList(Arrays.asList(logGroupArnList));
return this;
}
public final String getDetectorName() {
return detectorName;
}
public final void setDetectorName(String detectorName) {
this.detectorName = detectorName;
}
@Override
public final Builder detectorName(String detectorName) {
this.detectorName = detectorName;
return this;
}
public final String getEvaluationFrequency() {
return evaluationFrequency;
}
public final void setEvaluationFrequency(String evaluationFrequency) {
this.evaluationFrequency = evaluationFrequency;
}
@Override
public final Builder evaluationFrequency(String evaluationFrequency) {
this.evaluationFrequency = evaluationFrequency;
return this;
}
@Override
public final Builder evaluationFrequency(EvaluationFrequency evaluationFrequency) {
this.evaluationFrequency(evaluationFrequency == null ? null : evaluationFrequency.toString());
return this;
}
public final String getFilterPattern() {
return filterPattern;
}
public final void setFilterPattern(String filterPattern) {
this.filterPattern = filterPattern;
}
@Override
public final Builder filterPattern(String filterPattern) {
this.filterPattern = filterPattern;
return this;
}
public final String getKmsKeyId() {
return kmsKeyId;
}
public final void setKmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
}
@Override
public final Builder kmsKeyId(String kmsKeyId) {
this.kmsKeyId = kmsKeyId;
return this;
}
public final Long getAnomalyVisibilityTime() {
return anomalyVisibilityTime;
}
public final void setAnomalyVisibilityTime(Long anomalyVisibilityTime) {
this.anomalyVisibilityTime = anomalyVisibilityTime;
}
@Override
public final Builder anomalyVisibilityTime(Long anomalyVisibilityTime) {
this.anomalyVisibilityTime = anomalyVisibilityTime;
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagsCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagsCopier.copy(tags);
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateLogAnomalyDetectorRequest build() {
return new CreateLogAnomalyDetectorRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}