
software.amazon.awssdk.services.guardduty.model.UpdateDetectorRequest Maven / Gradle / Ivy
/*
* Copyright 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 software.amazon.awssdk.services.guardduty.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateDetectorRequest extends GuardDutyRequest implements
ToCopyableBuilder {
private static final SdkField DETECTOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DetectorId").getter(getter(UpdateDetectorRequest::detectorId)).setter(setter(Builder::detectorId))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("detectorId").build()).build();
private static final SdkField ENABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("Enable").getter(getter(UpdateDetectorRequest::enable)).setter(setter(Builder::enable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enable").build()).build();
private static final SdkField FINDING_PUBLISHING_FREQUENCY_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("FindingPublishingFrequency")
.getter(getter(UpdateDetectorRequest::findingPublishingFrequencyAsString))
.setter(setter(Builder::findingPublishingFrequency))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("findingPublishingFrequency").build())
.build();
private static final SdkField DATA_SOURCES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataSources")
.getter(getter(UpdateDetectorRequest::dataSources)).setter(setter(Builder::dataSources))
.constructor(DataSourceConfigurations::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataSources").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DETECTOR_ID_FIELD,
ENABLE_FIELD, FINDING_PUBLISHING_FREQUENCY_FIELD, DATA_SOURCES_FIELD));
private final String detectorId;
private final Boolean enable;
private final String findingPublishingFrequency;
private final DataSourceConfigurations dataSources;
private UpdateDetectorRequest(BuilderImpl builder) {
super(builder);
this.detectorId = builder.detectorId;
this.enable = builder.enable;
this.findingPublishingFrequency = builder.findingPublishingFrequency;
this.dataSources = builder.dataSources;
}
/**
*
* The unique ID of the detector to update.
*
*
* @return The unique ID of the detector to update.
*/
public final String detectorId() {
return detectorId;
}
/**
*
* Specifies whether the detector is enabled or not enabled.
*
*
* @return Specifies whether the detector is enabled or not enabled.
*/
public final Boolean enable() {
return enable;
}
/**
*
* An enum value that specifies how frequently findings are exported, such as to CloudWatch Events.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #findingPublishingFrequency} will return {@link FindingPublishingFrequency#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #findingPublishingFrequencyAsString}.
*
*
* @return An enum value that specifies how frequently findings are exported, such as to CloudWatch Events.
* @see FindingPublishingFrequency
*/
public final FindingPublishingFrequency findingPublishingFrequency() {
return FindingPublishingFrequency.fromValue(findingPublishingFrequency);
}
/**
*
* An enum value that specifies how frequently findings are exported, such as to CloudWatch Events.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #findingPublishingFrequency} will return {@link FindingPublishingFrequency#UNKNOWN_TO_SDK_VERSION}. The
* raw value returned by the service is available from {@link #findingPublishingFrequencyAsString}.
*
*
* @return An enum value that specifies how frequently findings are exported, such as to CloudWatch Events.
* @see FindingPublishingFrequency
*/
public final String findingPublishingFrequencyAsString() {
return findingPublishingFrequency;
}
/**
*
* Describes which data sources will be updated.
*
*
* @return Describes which data sources will be updated.
*/
public final DataSourceConfigurations dataSources() {
return dataSources;
}
@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(detectorId());
hashCode = 31 * hashCode + Objects.hashCode(enable());
hashCode = 31 * hashCode + Objects.hashCode(findingPublishingFrequencyAsString());
hashCode = 31 * hashCode + Objects.hashCode(dataSources());
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 UpdateDetectorRequest)) {
return false;
}
UpdateDetectorRequest other = (UpdateDetectorRequest) obj;
return Objects.equals(detectorId(), other.detectorId()) && Objects.equals(enable(), other.enable())
&& Objects.equals(findingPublishingFrequencyAsString(), other.findingPublishingFrequencyAsString())
&& Objects.equals(dataSources(), other.dataSources());
}
/**
* 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("UpdateDetectorRequest").add("DetectorId", detectorId()).add("Enable", enable())
.add("FindingPublishingFrequency", findingPublishingFrequencyAsString()).add("DataSources", dataSources())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DetectorId":
return Optional.ofNullable(clazz.cast(detectorId()));
case "Enable":
return Optional.ofNullable(clazz.cast(enable()));
case "FindingPublishingFrequency":
return Optional.ofNullable(clazz.cast(findingPublishingFrequencyAsString()));
case "DataSources":
return Optional.ofNullable(clazz.cast(dataSources()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function