software.amazon.awssdk.services.redshift.model.ClusterIamRole Maven / Gradle / Ivy
Show all versions of redshift 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.redshift.model;
import java.io.Serializable;
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.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;
/**
*
* An Identity and Access Management (IAM) role that can be used by the associated Amazon Redshift cluster to access
* other Amazon Web Services services.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ClusterIamRole implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField IAM_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("IamRoleArn").getter(getter(ClusterIamRole::iamRoleArn)).setter(setter(Builder::iamRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IamRoleArn").build()).build();
private static final SdkField APPLY_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplyStatus").getter(getter(ClusterIamRole::applyStatus)).setter(setter(Builder::applyStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplyStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(IAM_ROLE_ARN_FIELD,
APPLY_STATUS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("IamRoleArn", IAM_ROLE_ARN_FIELD);
put("ApplyStatus", APPLY_STATUS_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String iamRoleArn;
private final String applyStatus;
private ClusterIamRole(BuilderImpl builder) {
this.iamRoleArn = builder.iamRoleArn;
this.applyStatus = builder.applyStatus;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role, for example,
* arn:aws:iam::123456789012:role/RedshiftCopyUnload
.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role, for example,
* arn:aws:iam::123456789012:role/RedshiftCopyUnload
.
*/
public final String iamRoleArn() {
return iamRoleArn;
}
/**
*
* A value that describes the status of the IAM role's association with an Amazon Redshift cluster.
*
*
* The following are possible statuses and descriptions.
*
*
* -
*
* in-sync
: The role is available for use by the cluster.
*
*
* -
*
* adding
: The role is in the process of being associated with the cluster.
*
*
* -
*
* removing
: The role is in the process of being disassociated with the cluster.
*
*
*
*
* @return A value that describes the status of the IAM role's association with an Amazon Redshift cluster.
*
* The following are possible statuses and descriptions.
*
*
* -
*
* in-sync
: The role is available for use by the cluster.
*
*
* -
*
* adding
: The role is in the process of being associated with the cluster.
*
*
* -
*
* removing
: The role is in the process of being disassociated with the cluster.
*
*
*/
public final String applyStatus() {
return applyStatus;
}
@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(iamRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(applyStatus());
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 ClusterIamRole)) {
return false;
}
ClusterIamRole other = (ClusterIamRole) obj;
return Objects.equals(iamRoleArn(), other.iamRoleArn()) && Objects.equals(applyStatus(), other.applyStatus());
}
/**
* 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("ClusterIamRole").add("IamRoleArn", iamRoleArn()).add("ApplyStatus", applyStatus()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "IamRoleArn":
return Optional.ofNullable(clazz.cast(iamRoleArn()));
case "ApplyStatus":
return Optional.ofNullable(clazz.cast(applyStatus()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function