
software.amazon.awssdk.services.proton.model.EnvironmentAccountConnection 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.proton.model;
import java.io.Serializable;
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.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;
/**
*
* Detailed data of an Proton environment account connection resource.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EnvironmentAccountConnection implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(EnvironmentAccountConnection::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField CODEBUILD_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("codebuildRoleArn").getter(getter(EnvironmentAccountConnection::codebuildRoleArn))
.setter(setter(Builder::codebuildRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("codebuildRoleArn").build()).build();
private static final SdkField COMPONENT_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("componentRoleArn").getter(getter(EnvironmentAccountConnection::componentRoleArn))
.setter(setter(Builder::componentRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("componentRoleArn").build()).build();
private static final SdkField ENVIRONMENT_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentAccountId").getter(getter(EnvironmentAccountConnection::environmentAccountId))
.setter(setter(Builder::environmentAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentAccountId").build())
.build();
private static final SdkField ENVIRONMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentName").getter(getter(EnvironmentAccountConnection::environmentName))
.setter(setter(Builder::environmentName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentName").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(EnvironmentAccountConnection::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField LAST_MODIFIED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastModifiedAt").getter(getter(EnvironmentAccountConnection::lastModifiedAt))
.setter(setter(Builder::lastModifiedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedAt").build()).build();
private static final SdkField MANAGEMENT_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("managementAccountId").getter(getter(EnvironmentAccountConnection::managementAccountId))
.setter(setter(Builder::managementAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("managementAccountId").build())
.build();
private static final SdkField REQUESTED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("requestedAt").getter(getter(EnvironmentAccountConnection::requestedAt))
.setter(setter(Builder::requestedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("requestedAt").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(EnvironmentAccountConnection::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(EnvironmentAccountConnection::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD,
CODEBUILD_ROLE_ARN_FIELD, COMPONENT_ROLE_ARN_FIELD, ENVIRONMENT_ACCOUNT_ID_FIELD, ENVIRONMENT_NAME_FIELD, ID_FIELD,
LAST_MODIFIED_AT_FIELD, MANAGEMENT_ACCOUNT_ID_FIELD, REQUESTED_AT_FIELD, ROLE_ARN_FIELD, STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String codebuildRoleArn;
private final String componentRoleArn;
private final String environmentAccountId;
private final String environmentName;
private final String id;
private final Instant lastModifiedAt;
private final String managementAccountId;
private final Instant requestedAt;
private final String roleArn;
private final String status;
private EnvironmentAccountConnection(BuilderImpl builder) {
this.arn = builder.arn;
this.codebuildRoleArn = builder.codebuildRoleArn;
this.componentRoleArn = builder.componentRoleArn;
this.environmentAccountId = builder.environmentAccountId;
this.environmentName = builder.environmentName;
this.id = builder.id;
this.lastModifiedAt = builder.lastModifiedAt;
this.managementAccountId = builder.managementAccountId;
this.requestedAt = builder.requestedAt;
this.roleArn = builder.roleArn;
this.status = builder.status;
}
/**
*
* The Amazon Resource Name (ARN) of the environment account connection.
*
*
* @return The Amazon Resource Name (ARN) of the environment account connection.
*/
public final String arn() {
return arn;
}
/**
*
* The Amazon Resource Name (ARN) of an IAM service role in the environment account. Proton uses this role to
* provision infrastructure resources using CodeBuild-based provisioning in the associated environment account.
*
*
* @return The Amazon Resource Name (ARN) of an IAM service role in the environment account. Proton uses this role
* to provision infrastructure resources using CodeBuild-based provisioning in the associated environment
* account.
*/
public final String codebuildRoleArn() {
return codebuildRoleArn;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly defined
* components in the associated environment account. It determines the scope of infrastructure that a component can
* provision in the account.
*
*
* The environment account connection must have a componentRoleArn
to allow directly defined components
* to be associated with any environments running in the account.
*
*
* For more information about components, see Proton components in the
* Proton User Guide.
*
*
* @return The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly
* defined components in the associated environment account. It determines the scope of infrastructure that
* a component can provision in the account.
*
* The environment account connection must have a componentRoleArn
to allow directly defined
* components to be associated with any environments running in the account.
*
*
* For more information about components, see Proton components in
* the Proton User Guide.
*/
public final String componentRoleArn() {
return componentRoleArn;
}
/**
*
* The environment account that's connected to the environment account connection.
*
*
* @return The environment account that's connected to the environment account connection.
*/
public final String environmentAccountId() {
return environmentAccountId;
}
/**
*
* The name of the environment that's associated with the environment account connection.
*
*
* @return The name of the environment that's associated with the environment account connection.
*/
public final String environmentName() {
return environmentName;
}
/**
*
* The ID of the environment account connection.
*
*
* @return The ID of the environment account connection.
*/
public final String id() {
return id;
}
/**
*
* The time when the environment account connection was last modified.
*
*
* @return The time when the environment account connection was last modified.
*/
public final Instant lastModifiedAt() {
return lastModifiedAt;
}
/**
*
* The ID of the management account that's connected to the environment account connection.
*
*
* @return The ID of the management account that's connected to the environment account connection.
*/
public final String managementAccountId() {
return managementAccountId;
}
/**
*
* The time when the environment account connection request was made.
*
*
* @return The time when the environment account connection request was made.
*/
public final Instant requestedAt() {
return requestedAt;
}
/**
*
* The IAM service role that's associated with the environment account connection.
*
*
* @return The IAM service role that's associated with the environment account connection.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The status of the environment account connection.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EnvironmentAccountConnectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #statusAsString}.
*
*
* @return The status of the environment account connection.
* @see EnvironmentAccountConnectionStatus
*/
public final EnvironmentAccountConnectionStatus status() {
return EnvironmentAccountConnectionStatus.fromValue(status);
}
/**
*
* The status of the environment account connection.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EnvironmentAccountConnectionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #statusAsString}.
*
*
* @return The status of the environment account connection.
* @see EnvironmentAccountConnectionStatus
*/
public final String statusAsString() {
return status;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(codebuildRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(componentRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(environmentAccountId());
hashCode = 31 * hashCode + Objects.hashCode(environmentName());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedAt());
hashCode = 31 * hashCode + Objects.hashCode(managementAccountId());
hashCode = 31 * hashCode + Objects.hashCode(requestedAt());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
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 EnvironmentAccountConnection)) {
return false;
}
EnvironmentAccountConnection other = (EnvironmentAccountConnection) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(codebuildRoleArn(), other.codebuildRoleArn())
&& Objects.equals(componentRoleArn(), other.componentRoleArn())
&& Objects.equals(environmentAccountId(), other.environmentAccountId())
&& Objects.equals(environmentName(), other.environmentName()) && Objects.equals(id(), other.id())
&& Objects.equals(lastModifiedAt(), other.lastModifiedAt())
&& Objects.equals(managementAccountId(), other.managementAccountId())
&& Objects.equals(requestedAt(), other.requestedAt()) && Objects.equals(roleArn(), other.roleArn())
&& Objects.equals(statusAsString(), other.statusAsString());
}
/**
* 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("EnvironmentAccountConnection").add("Arn", arn()).add("CodebuildRoleArn", codebuildRoleArn())
.add("ComponentRoleArn", componentRoleArn()).add("EnvironmentAccountId", environmentAccountId())
.add("EnvironmentName", environmentName()).add("Id", id()).add("LastModifiedAt", lastModifiedAt())
.add("ManagementAccountId", managementAccountId()).add("RequestedAt", requestedAt()).add("RoleArn", roleArn())
.add("Status", statusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "codebuildRoleArn":
return Optional.ofNullable(clazz.cast(codebuildRoleArn()));
case "componentRoleArn":
return Optional.ofNullable(clazz.cast(componentRoleArn()));
case "environmentAccountId":
return Optional.ofNullable(clazz.cast(environmentAccountId()));
case "environmentName":
return Optional.ofNullable(clazz.cast(environmentName()));
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "lastModifiedAt":
return Optional.ofNullable(clazz.cast(lastModifiedAt()));
case "managementAccountId":
return Optional.ofNullable(clazz.cast(managementAccountId()));
case "requestedAt":
return Optional.ofNullable(clazz.cast(requestedAt()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function