software.amazon.awssdk.services.cloudformation.model.RollbackStackRequest Maven / Gradle / Ivy
Show all versions of cloudformation Show documentation
/*
* 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.cloudformation.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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 RollbackStackRequest extends CloudFormationRequest implements
ToCopyableBuilder {
private static final SdkField STACK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StackName").getter(getter(RollbackStackRequest::stackName)).setter(setter(Builder::stackName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StackName").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleARN").getter(getter(RollbackStackRequest::roleARN)).setter(setter(Builder::roleARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleARN").build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ClientRequestToken").getter(getter(RollbackStackRequest::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClientRequestToken").build())
.build();
private static final SdkField RETAIN_EXCEPT_ON_CREATE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RetainExceptOnCreate").getter(getter(RollbackStackRequest::retainExceptOnCreate))
.setter(setter(Builder::retainExceptOnCreate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetainExceptOnCreate").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STACK_NAME_FIELD,
ROLE_ARN_FIELD, CLIENT_REQUEST_TOKEN_FIELD, RETAIN_EXCEPT_ON_CREATE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String stackName;
private final String roleARN;
private final String clientRequestToken;
private final Boolean retainExceptOnCreate;
private RollbackStackRequest(BuilderImpl builder) {
super(builder);
this.stackName = builder.stackName;
this.roleARN = builder.roleARN;
this.clientRequestToken = builder.clientRequestToken;
this.retainExceptOnCreate = builder.retainExceptOnCreate;
}
/**
*
* The name that's associated with the stack.
*
*
* @return The name that's associated with the stack.
*/
public final String stackName() {
return stackName;
}
/**
*
* The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to rollback the stack.
*
*
* @return The Amazon Resource Name (ARN) of an IAM role that CloudFormation assumes to rollback the stack.
*/
public final String roleARN() {
return roleARN;
}
/**
*
* A unique identifier for this RollbackStack
request.
*
*
* @return A unique identifier for this RollbackStack
request.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
/**
*
* When set to true
, newly created resources are deleted when the operation rolls back. This includes
* newly created resources marked with a deletion policy of Retain
.
*
*
* Default: false
*
*
* @return When set to true
, newly created resources are deleted when the operation rolls back. This
* includes newly created resources marked with a deletion policy of Retain
.
*
* Default: false
*/
public final Boolean retainExceptOnCreate() {
return retainExceptOnCreate;
}
@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(stackName());
hashCode = 31 * hashCode + Objects.hashCode(roleARN());
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
hashCode = 31 * hashCode + Objects.hashCode(retainExceptOnCreate());
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 RollbackStackRequest)) {
return false;
}
RollbackStackRequest other = (RollbackStackRequest) obj;
return Objects.equals(stackName(), other.stackName()) && Objects.equals(roleARN(), other.roleARN())
&& Objects.equals(clientRequestToken(), other.clientRequestToken())
&& Objects.equals(retainExceptOnCreate(), other.retainExceptOnCreate());
}
/**
* 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("RollbackStackRequest").add("StackName", stackName()).add("RoleARN", roleARN())
.add("ClientRequestToken", clientRequestToken()).add("RetainExceptOnCreate", retainExceptOnCreate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StackName":
return Optional.ofNullable(clazz.cast(stackName()));
case "RoleARN":
return Optional.ofNullable(clazz.cast(roleARN()));
case "ClientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
case "RetainExceptOnCreate":
return Optional.ofNullable(clazz.cast(retainExceptOnCreate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("StackName", STACK_NAME_FIELD);
map.put("RoleARN", ROLE_ARN_FIELD);
map.put("ClientRequestToken", CLIENT_REQUEST_TOKEN_FIELD);
map.put("RetainExceptOnCreate", RETAIN_EXCEPT_ON_CREATE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function
*
* Default: false
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder retainExceptOnCreate(Boolean retainExceptOnCreate);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CloudFormationRequest.BuilderImpl implements Builder {
private String stackName;
private String roleARN;
private String clientRequestToken;
private Boolean retainExceptOnCreate;
private BuilderImpl() {
}
private BuilderImpl(RollbackStackRequest model) {
super(model);
stackName(model.stackName);
roleARN(model.roleARN);
clientRequestToken(model.clientRequestToken);
retainExceptOnCreate(model.retainExceptOnCreate);
}
public final String getStackName() {
return stackName;
}
public final void setStackName(String stackName) {
this.stackName = stackName;
}
@Override
public final Builder stackName(String stackName) {
this.stackName = stackName;
return this;
}
public final String getRoleARN() {
return roleARN;
}
public final void setRoleARN(String roleARN) {
this.roleARN = roleARN;
}
@Override
public final Builder roleARN(String roleARN) {
this.roleARN = roleARN;
return this;
}
public final String getClientRequestToken() {
return clientRequestToken;
}
public final void setClientRequestToken(String clientRequestToken) {
this.clientRequestToken = clientRequestToken;
}
@Override
public final Builder clientRequestToken(String clientRequestToken) {
this.clientRequestToken = clientRequestToken;
return this;
}
public final Boolean getRetainExceptOnCreate() {
return retainExceptOnCreate;
}
public final void setRetainExceptOnCreate(Boolean retainExceptOnCreate) {
this.retainExceptOnCreate = retainExceptOnCreate;
}
@Override
public final Builder retainExceptOnCreate(Boolean retainExceptOnCreate) {
this.retainExceptOnCreate = retainExceptOnCreate;
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 RollbackStackRequest build() {
return new RollbackStackRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}