software.amazon.awssdk.services.proton.model.UpdateEnvironmentRequest Maven / Gradle / Ivy
Show all versions of proton 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.proton.model;
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.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 UpdateEnvironmentRequest extends ProtonRequest implements
ToCopyableBuilder {
private static final SdkField CODEBUILD_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("codebuildRoleArn").getter(getter(UpdateEnvironmentRequest::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(UpdateEnvironmentRequest::componentRoleArn))
.setter(setter(Builder::componentRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("componentRoleArn").build()).build();
private static final SdkField DEPLOYMENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentType").getter(getter(UpdateEnvironmentRequest::deploymentTypeAsString))
.setter(setter(Builder::deploymentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentType").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(UpdateEnvironmentRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField ENVIRONMENT_ACCOUNT_CONNECTION_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("environmentAccountConnectionId")
.getter(getter(UpdateEnvironmentRequest::environmentAccountConnectionId))
.setter(setter(Builder::environmentAccountConnectionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentAccountConnectionId")
.build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(UpdateEnvironmentRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField PROTON_SERVICE_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("protonServiceRoleArn").getter(getter(UpdateEnvironmentRequest::protonServiceRoleArn))
.setter(setter(Builder::protonServiceRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("protonServiceRoleArn").build())
.build();
private static final SdkField PROVISIONING_REPOSITORY_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("provisioningRepository")
.getter(getter(UpdateEnvironmentRequest::provisioningRepository)).setter(setter(Builder::provisioningRepository))
.constructor(RepositoryBranchInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("provisioningRepository").build())
.build();
private static final SdkField SPEC_FIELD = SdkField. builder(MarshallingType.STRING).memberName("spec")
.getter(getter(UpdateEnvironmentRequest::spec)).setter(setter(Builder::spec))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("spec").build()).build();
private static final SdkField TEMPLATE_MAJOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("templateMajorVersion").getter(getter(UpdateEnvironmentRequest::templateMajorVersion))
.setter(setter(Builder::templateMajorVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateMajorVersion").build())
.build();
private static final SdkField TEMPLATE_MINOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("templateMinorVersion").getter(getter(UpdateEnvironmentRequest::templateMinorVersion))
.setter(setter(Builder::templateMinorVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateMinorVersion").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CODEBUILD_ROLE_ARN_FIELD,
COMPONENT_ROLE_ARN_FIELD, DEPLOYMENT_TYPE_FIELD, DESCRIPTION_FIELD, ENVIRONMENT_ACCOUNT_CONNECTION_ID_FIELD,
NAME_FIELD, PROTON_SERVICE_ROLE_ARN_FIELD, PROVISIONING_REPOSITORY_FIELD, SPEC_FIELD, TEMPLATE_MAJOR_VERSION_FIELD,
TEMPLATE_MINOR_VERSION_FIELD));
private final String codebuildRoleArn;
private final String componentRoleArn;
private final String deploymentType;
private final String description;
private final String environmentAccountConnectionId;
private final String name;
private final String protonServiceRoleArn;
private final RepositoryBranchInput provisioningRepository;
private final String spec;
private final String templateMajorVersion;
private final String templateMinorVersion;
private UpdateEnvironmentRequest(BuilderImpl builder) {
super(builder);
this.codebuildRoleArn = builder.codebuildRoleArn;
this.componentRoleArn = builder.componentRoleArn;
this.deploymentType = builder.deploymentType;
this.description = builder.description;
this.environmentAccountConnectionId = builder.environmentAccountConnectionId;
this.name = builder.name;
this.protonServiceRoleArn = builder.protonServiceRoleArn;
this.provisioningRepository = builder.provisioningRepository;
this.spec = builder.spec;
this.templateMajorVersion = builder.templateMajorVersion;
this.templateMinorVersion = builder.templateMinorVersion;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM service role that allows Proton to provision infrastructure using
* CodeBuild-based provisioning on your behalf.
*
*
* @return The Amazon Resource Name (ARN) of the IAM service role that allows Proton to provision infrastructure
* using CodeBuild-based provisioning on your behalf.
*/
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 this environment. It determines the scope of infrastructure that a component can provision.
*
*
* The environment must have a componentRoleArn
to allow directly defined components to be associated
* with the environment.
*
*
* 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 this environment. It determines the scope of infrastructure that a component can
* provision.
*
* The environment must have a componentRoleArn
to allow directly defined components to be
* associated with the environment.
*
*
* For more information about components, see Proton components in
* the Proton User Guide.
*/
public final String componentRoleArn() {
return componentRoleArn;
}
/**
*
* There are four modes for updating an environment. The deploymentType
field defines the mode.
*
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the environment is deployed and updated with the new spec that you provide. Only requested
* parameters are updated. Don’t include major or minor version parameters when you use this
* deployment-type
.
*
*
*
* -
*
* MINOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) minor version of
* the current major version in use, by default. You can also specify a different minor version of the current major
* version in use.
*
*
*
* -
*
* MAJOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) major and minor
* version of the current template, by default. You can also specify a different major version that is higher than
* the major version in use and a minor version (optional).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentType}
* will return {@link DeploymentUpdateType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #deploymentTypeAsString}.
*
*
* @return There are four modes for updating an environment. The deploymentType
field defines the
* mode.
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the environment is deployed and updated with the new spec that you provide. Only requested
* parameters are updated. Don’t include major or minor version parameters when you use this
* deployment-type
.
*
*
*
* -
*
* MINOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) minor
* version of the current major version in use, by default. You can also specify a different minor version
* of the current major version in use.
*
*
*
* -
*
* MAJOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) major and
* minor version of the current template, by default. You can also specify a different major version that is
* higher than the major version in use and a minor version (optional).
*
*
* @see DeploymentUpdateType
*/
public final DeploymentUpdateType deploymentType() {
return DeploymentUpdateType.fromValue(deploymentType);
}
/**
*
* There are four modes for updating an environment. The deploymentType
field defines the mode.
*
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the environment is deployed and updated with the new spec that you provide. Only requested
* parameters are updated. Don’t include major or minor version parameters when you use this
* deployment-type
.
*
*
*
* -
*
* MINOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) minor version of
* the current major version in use, by default. You can also specify a different minor version of the current major
* version in use.
*
*
*
* -
*
* MAJOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) major and minor
* version of the current template, by default. You can also specify a different major version that is higher than
* the major version in use and a minor version (optional).
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #deploymentType}
* will return {@link DeploymentUpdateType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #deploymentTypeAsString}.
*
*
* @return There are four modes for updating an environment. The deploymentType
field defines the
* mode.
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the environment is deployed and updated with the new spec that you provide. Only requested
* parameters are updated. Don’t include major or minor version parameters when you use this
* deployment-type
.
*
*
*
* -
*
* MINOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) minor
* version of the current major version in use, by default. You can also specify a different minor version
* of the current major version in use.
*
*
*
* -
*
* MAJOR_VERSION
*
*
* In this mode, the environment is deployed and updated with the published, recommended (latest) major and
* minor version of the current template, by default. You can also specify a different major version that is
* higher than the major version in use and a minor version (optional).
*
*
* @see DeploymentUpdateType
*/
public final String deploymentTypeAsString() {
return deploymentType;
}
/**
*
* A description of the environment update.
*
*
* @return A description of the environment update.
*/
public final String description() {
return description;
}
/**
*
* The ID of the environment account connection.
*
*
* You can only update to a new environment account connection if it was created in the same environment account
* that the current environment account connection was created in and is associated with the current environment.
*
*
* @return The ID of the environment account connection.
*
* You can only update to a new environment account connection if it was created in the same environment
* account that the current environment account connection was created in and is associated with the current
* environment.
*/
public final String environmentAccountConnectionId() {
return environmentAccountConnectionId;
}
/**
*
* The name of the environment to update.
*
*
* @return The name of the environment to update.
*/
public final String name() {
return name;
}
/**
*
* The Amazon Resource Name (ARN) of the Proton service role that allows Proton to make API calls to other services
* your behalf.
*
*
* @return The Amazon Resource Name (ARN) of the Proton service role that allows Proton to make API calls to other
* services your behalf.
*/
public final String protonServiceRoleArn() {
return protonServiceRoleArn;
}
/**
*
* The linked repository that you use to host your rendered infrastructure templates for self-managed provisioning.
* A linked repository is a repository that has been registered with Proton. For more information, see
* CreateRepository.
*
*
* @return The linked repository that you use to host your rendered infrastructure templates for self-managed
* provisioning. A linked repository is a repository that has been registered with Proton. For more
* information, see CreateRepository.
*/
public final RepositoryBranchInput provisioningRepository() {
return provisioningRepository;
}
/**
*
* The formatted specification that defines the update.
*
*
* @return The formatted specification that defines the update.
*/
public final String spec() {
return spec;
}
/**
*
* The major version of the environment to update.
*
*
* @return The major version of the environment to update.
*/
public final String templateMajorVersion() {
return templateMajorVersion;
}
/**
*
* The minor version of the environment to update.
*
*
* @return The minor version of the environment to update.
*/
public final String templateMinorVersion() {
return templateMinorVersion;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(codebuildRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(componentRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(deploymentTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(environmentAccountConnectionId());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(protonServiceRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(provisioningRepository());
hashCode = 31 * hashCode + Objects.hashCode(spec());
hashCode = 31 * hashCode + Objects.hashCode(templateMajorVersion());
hashCode = 31 * hashCode + Objects.hashCode(templateMinorVersion());
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 UpdateEnvironmentRequest)) {
return false;
}
UpdateEnvironmentRequest other = (UpdateEnvironmentRequest) obj;
return Objects.equals(codebuildRoleArn(), other.codebuildRoleArn())
&& Objects.equals(componentRoleArn(), other.componentRoleArn())
&& Objects.equals(deploymentTypeAsString(), other.deploymentTypeAsString())
&& Objects.equals(description(), other.description())
&& Objects.equals(environmentAccountConnectionId(), other.environmentAccountConnectionId())
&& Objects.equals(name(), other.name()) && Objects.equals(protonServiceRoleArn(), other.protonServiceRoleArn())
&& Objects.equals(provisioningRepository(), other.provisioningRepository())
&& Objects.equals(spec(), other.spec()) && Objects.equals(templateMajorVersion(), other.templateMajorVersion())
&& Objects.equals(templateMinorVersion(), other.templateMinorVersion());
}
/**
* 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("UpdateEnvironmentRequest").add("CodebuildRoleArn", codebuildRoleArn())
.add("ComponentRoleArn", componentRoleArn()).add("DeploymentType", deploymentTypeAsString())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("EnvironmentAccountConnectionId", environmentAccountConnectionId()).add("Name", name())
.add("ProtonServiceRoleArn", protonServiceRoleArn()).add("ProvisioningRepository", provisioningRepository())
.add("Spec", spec() == null ? null : "*** Sensitive Data Redacted ***")
.add("TemplateMajorVersion", templateMajorVersion()).add("TemplateMinorVersion", templateMinorVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "codebuildRoleArn":
return Optional.ofNullable(clazz.cast(codebuildRoleArn()));
case "componentRoleArn":
return Optional.ofNullable(clazz.cast(componentRoleArn()));
case "deploymentType":
return Optional.ofNullable(clazz.cast(deploymentTypeAsString()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "environmentAccountConnectionId":
return Optional.ofNullable(clazz.cast(environmentAccountConnectionId()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "protonServiceRoleArn":
return Optional.ofNullable(clazz.cast(protonServiceRoleArn()));
case "provisioningRepository":
return Optional.ofNullable(clazz.cast(provisioningRepository()));
case "spec":
return Optional.ofNullable(clazz.cast(spec()));
case "templateMajorVersion":
return Optional.ofNullable(clazz.cast(templateMajorVersion()));
case "templateMinorVersion":
return Optional.ofNullable(clazz.cast(templateMinorVersion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function