
software.amazon.awssdk.services.iot.model.MitigationActionParams 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.iot.model;
import java.io.Serializable;
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.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;
/**
*
* The set of parameters for this mitigation action. You can specify only one type of parameter (in other words, you can
* apply only one action for each defined mitigation action).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class MitigationActionParams implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField UPDATE_DEVICE_CERTIFICATE_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("updateDeviceCertificateParams")
.getter(getter(MitigationActionParams::updateDeviceCertificateParams))
.setter(setter(Builder::updateDeviceCertificateParams))
.constructor(UpdateDeviceCertificateParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateDeviceCertificateParams")
.build()).build();
private static final SdkField UPDATE_CA_CERTIFICATE_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("updateCACertificateParams")
.getter(getter(MitigationActionParams::updateCACertificateParams)).setter(setter(Builder::updateCACertificateParams))
.constructor(UpdateCACertificateParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updateCACertificateParams").build())
.build();
private static final SdkField ADD_THINGS_TO_THING_GROUP_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("addThingsToThingGroupParams")
.getter(getter(MitigationActionParams::addThingsToThingGroupParams))
.setter(setter(Builder::addThingsToThingGroupParams))
.constructor(AddThingsToThingGroupParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("addThingsToThingGroupParams")
.build()).build();
private static final SdkField REPLACE_DEFAULT_POLICY_VERSION_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("replaceDefaultPolicyVersionParams")
.getter(getter(MitigationActionParams::replaceDefaultPolicyVersionParams))
.setter(setter(Builder::replaceDefaultPolicyVersionParams))
.constructor(ReplaceDefaultPolicyVersionParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("replaceDefaultPolicyVersionParams")
.build()).build();
private static final SdkField ENABLE_IO_T_LOGGING_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("enableIoTLoggingParams")
.getter(getter(MitigationActionParams::enableIoTLoggingParams)).setter(setter(Builder::enableIoTLoggingParams))
.constructor(EnableIoTLoggingParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enableIoTLoggingParams").build())
.build();
private static final SdkField PUBLISH_FINDING_TO_SNS_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("publishFindingToSnsParams")
.getter(getter(MitigationActionParams::publishFindingToSnsParams)).setter(setter(Builder::publishFindingToSnsParams))
.constructor(PublishFindingToSnsParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("publishFindingToSnsParams").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
UPDATE_DEVICE_CERTIFICATE_PARAMS_FIELD, UPDATE_CA_CERTIFICATE_PARAMS_FIELD, ADD_THINGS_TO_THING_GROUP_PARAMS_FIELD,
REPLACE_DEFAULT_POLICY_VERSION_PARAMS_FIELD, ENABLE_IO_T_LOGGING_PARAMS_FIELD, PUBLISH_FINDING_TO_SNS_PARAMS_FIELD));
private static final long serialVersionUID = 1L;
private final UpdateDeviceCertificateParams updateDeviceCertificateParams;
private final UpdateCACertificateParams updateCACertificateParams;
private final AddThingsToThingGroupParams addThingsToThingGroupParams;
private final ReplaceDefaultPolicyVersionParams replaceDefaultPolicyVersionParams;
private final EnableIoTLoggingParams enableIoTLoggingParams;
private final PublishFindingToSnsParams publishFindingToSnsParams;
private MitigationActionParams(BuilderImpl builder) {
this.updateDeviceCertificateParams = builder.updateDeviceCertificateParams;
this.updateCACertificateParams = builder.updateCACertificateParams;
this.addThingsToThingGroupParams = builder.addThingsToThingGroupParams;
this.replaceDefaultPolicyVersionParams = builder.replaceDefaultPolicyVersionParams;
this.enableIoTLoggingParams = builder.enableIoTLoggingParams;
this.publishFindingToSnsParams = builder.publishFindingToSnsParams;
}
/**
*
* Parameters to define a mitigation action that changes the state of the device certificate to inactive.
*
*
* @return Parameters to define a mitigation action that changes the state of the device certificate to inactive.
*/
public final UpdateDeviceCertificateParams updateDeviceCertificateParams() {
return updateDeviceCertificateParams;
}
/**
*
* Parameters to define a mitigation action that changes the state of the CA certificate to inactive.
*
*
* @return Parameters to define a mitigation action that changes the state of the CA certificate to inactive.
*/
public final UpdateCACertificateParams updateCACertificateParams() {
return updateCACertificateParams;
}
/**
*
* Parameters to define a mitigation action that moves devices associated with a certificate to one or more
* specified thing groups, typically for quarantine.
*
*
* @return Parameters to define a mitigation action that moves devices associated with a certificate to one or more
* specified thing groups, typically for quarantine.
*/
public final AddThingsToThingGroupParams addThingsToThingGroupParams() {
return addThingsToThingGroupParams;
}
/**
*
* Parameters to define a mitigation action that adds a blank policy to restrict permissions.
*
*
* @return Parameters to define a mitigation action that adds a blank policy to restrict permissions.
*/
public final ReplaceDefaultPolicyVersionParams replaceDefaultPolicyVersionParams() {
return replaceDefaultPolicyVersionParams;
}
/**
*
* Parameters to define a mitigation action that enables Amazon Web Services IoT Core logging at a specified level
* of detail.
*
*
* @return Parameters to define a mitigation action that enables Amazon Web Services IoT Core logging at a specified
* level of detail.
*/
public final EnableIoTLoggingParams enableIoTLoggingParams() {
return enableIoTLoggingParams;
}
/**
*
* Parameters to define a mitigation action that publishes findings to Amazon Simple Notification Service (Amazon
* SNS. You can implement your own custom actions in response to the Amazon SNS messages.
*
*
* @return Parameters to define a mitigation action that publishes findings to Amazon Simple Notification Service
* (Amazon SNS. You can implement your own custom actions in response to the Amazon SNS messages.
*/
public final PublishFindingToSnsParams publishFindingToSnsParams() {
return publishFindingToSnsParams;
}
@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 + Objects.hashCode(updateDeviceCertificateParams());
hashCode = 31 * hashCode + Objects.hashCode(updateCACertificateParams());
hashCode = 31 * hashCode + Objects.hashCode(addThingsToThingGroupParams());
hashCode = 31 * hashCode + Objects.hashCode(replaceDefaultPolicyVersionParams());
hashCode = 31 * hashCode + Objects.hashCode(enableIoTLoggingParams());
hashCode = 31 * hashCode + Objects.hashCode(publishFindingToSnsParams());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MitigationActionParams)) {
return false;
}
MitigationActionParams other = (MitigationActionParams) obj;
return Objects.equals(updateDeviceCertificateParams(), other.updateDeviceCertificateParams())
&& Objects.equals(updateCACertificateParams(), other.updateCACertificateParams())
&& Objects.equals(addThingsToThingGroupParams(), other.addThingsToThingGroupParams())
&& Objects.equals(replaceDefaultPolicyVersionParams(), other.replaceDefaultPolicyVersionParams())
&& Objects.equals(enableIoTLoggingParams(), other.enableIoTLoggingParams())
&& Objects.equals(publishFindingToSnsParams(), other.publishFindingToSnsParams());
}
/**
* 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("MitigationActionParams").add("UpdateDeviceCertificateParams", updateDeviceCertificateParams())
.add("UpdateCACertificateParams", updateCACertificateParams())
.add("AddThingsToThingGroupParams", addThingsToThingGroupParams())
.add("ReplaceDefaultPolicyVersionParams", replaceDefaultPolicyVersionParams())
.add("EnableIoTLoggingParams", enableIoTLoggingParams())
.add("PublishFindingToSnsParams", publishFindingToSnsParams()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "updateDeviceCertificateParams":
return Optional.ofNullable(clazz.cast(updateDeviceCertificateParams()));
case "updateCACertificateParams":
return Optional.ofNullable(clazz.cast(updateCACertificateParams()));
case "addThingsToThingGroupParams":
return Optional.ofNullable(clazz.cast(addThingsToThingGroupParams()));
case "replaceDefaultPolicyVersionParams":
return Optional.ofNullable(clazz.cast(replaceDefaultPolicyVersionParams()));
case "enableIoTLoggingParams":
return Optional.ofNullable(clazz.cast(enableIoTLoggingParams()));
case "publishFindingToSnsParams":
return Optional.ofNullable(clazz.cast(publishFindingToSnsParams()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function