
software.amazon.awssdk.services.iot.model.DescribeMitigationActionResponse 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.beans.Transient;
import java.time.Instant;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeMitigationActionResponse extends IotResponse implements
ToCopyableBuilder {
private static final SdkField ACTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("actionName").getter(getter(DescribeMitigationActionResponse::actionName))
.setter(setter(Builder::actionName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionName").build()).build();
private static final SdkField ACTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("actionType").getter(getter(DescribeMitigationActionResponse::actionTypeAsString))
.setter(setter(Builder::actionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionType").build()).build();
private static final SdkField ACTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("actionArn").getter(getter(DescribeMitigationActionResponse::actionArn))
.setter(setter(Builder::actionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionArn").build()).build();
private static final SdkField ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("actionId").getter(getter(DescribeMitigationActionResponse::actionId)).setter(setter(Builder::actionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionId").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(DescribeMitigationActionResponse::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField ACTION_PARAMS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("actionParams")
.getter(getter(DescribeMitigationActionResponse::actionParams)).setter(setter(Builder::actionParams))
.constructor(MitigationActionParams::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionParams").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationDate").getter(getter(DescribeMitigationActionResponse::creationDate))
.setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationDate").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedDate").getter(getter(DescribeMitigationActionResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_NAME_FIELD,
ACTION_TYPE_FIELD, ACTION_ARN_FIELD, ACTION_ID_FIELD, ROLE_ARN_FIELD, ACTION_PARAMS_FIELD, CREATION_DATE_FIELD,
LAST_MODIFIED_DATE_FIELD));
private final String actionName;
private final String actionType;
private final String actionArn;
private final String actionId;
private final String roleArn;
private final MitigationActionParams actionParams;
private final Instant creationDate;
private final Instant lastModifiedDate;
private DescribeMitigationActionResponse(BuilderImpl builder) {
super(builder);
this.actionName = builder.actionName;
this.actionType = builder.actionType;
this.actionArn = builder.actionArn;
this.actionId = builder.actionId;
this.roleArn = builder.roleArn;
this.actionParams = builder.actionParams;
this.creationDate = builder.creationDate;
this.lastModifiedDate = builder.lastModifiedDate;
}
/**
*
* The friendly name that uniquely identifies the mitigation action.
*
*
* @return The friendly name that uniquely identifies the mitigation action.
*/
public final String actionName() {
return actionName;
}
/**
*
* The type of mitigation action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #actionType} will
* return {@link MitigationActionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #actionTypeAsString}.
*
*
* @return The type of mitigation action.
* @see MitigationActionType
*/
public final MitigationActionType actionType() {
return MitigationActionType.fromValue(actionType);
}
/**
*
* The type of mitigation action.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #actionType} will
* return {@link MitigationActionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #actionTypeAsString}.
*
*
* @return The type of mitigation action.
* @see MitigationActionType
*/
public final String actionTypeAsString() {
return actionType;
}
/**
*
* The ARN that identifies this migration action.
*
*
* @return The ARN that identifies this migration action.
*/
public final String actionArn() {
return actionArn;
}
/**
*
* A unique identifier for this action.
*
*
* @return A unique identifier for this action.
*/
public final String actionId() {
return actionId;
}
/**
*
* The ARN of the IAM role used to apply this action.
*
*
* @return The ARN of the IAM role used to apply this action.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* Parameters that control how the mitigation action is applied, specific to the type of mitigation action.
*
*
* @return Parameters that control how the mitigation action is applied, specific to the type of mitigation action.
*/
public final MitigationActionParams actionParams() {
return actionParams;
}
/**
*
* The date and time when the mitigation action was added to your AWS account.
*
*
* @return The date and time when the mitigation action was added to your AWS account.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* The date and time when the mitigation action was last changed.
*
*
* @return The date and time when the mitigation action was last changed.
*/
public final Instant lastModifiedDate() {
return lastModifiedDate;
}
@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(actionName());
hashCode = 31 * hashCode + Objects.hashCode(actionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(actionArn());
hashCode = 31 * hashCode + Objects.hashCode(actionId());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(actionParams());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
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 DescribeMitigationActionResponse)) {
return false;
}
DescribeMitigationActionResponse other = (DescribeMitigationActionResponse) obj;
return Objects.equals(actionName(), other.actionName())
&& Objects.equals(actionTypeAsString(), other.actionTypeAsString())
&& Objects.equals(actionArn(), other.actionArn()) && Objects.equals(actionId(), other.actionId())
&& Objects.equals(roleArn(), other.roleArn()) && Objects.equals(actionParams(), other.actionParams())
&& Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate());
}
/**
* 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("DescribeMitigationActionResponse").add("ActionName", actionName())
.add("ActionType", actionTypeAsString()).add("ActionArn", actionArn()).add("ActionId", actionId())
.add("RoleArn", roleArn()).add("ActionParams", actionParams()).add("CreationDate", creationDate())
.add("LastModifiedDate", lastModifiedDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "actionName":
return Optional.ofNullable(clazz.cast(actionName()));
case "actionType":
return Optional.ofNullable(clazz.cast(actionTypeAsString()));
case "actionArn":
return Optional.ofNullable(clazz.cast(actionArn()));
case "actionId":
return Optional.ofNullable(clazz.cast(actionId()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "actionParams":
return Optional.ofNullable(clazz.cast(actionParams()));
case "creationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "lastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function