
software.amazon.awssdk.services.proton.model.UpdateServiceInstanceRequest 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.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.DefaultValueTrait;
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 UpdateServiceInstanceRequest extends ProtonRequest implements
ToCopyableBuilder {
private static final SdkField CLIENT_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientToken")
.getter(getter(UpdateServiceInstanceRequest::clientToken))
.setter(setter(Builder::clientToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final SdkField DEPLOYMENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("deploymentType").getter(getter(UpdateServiceInstanceRequest::deploymentTypeAsString))
.setter(setter(Builder::deploymentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("deploymentType").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(UpdateServiceInstanceRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceName").getter(getter(UpdateServiceInstanceRequest::serviceName))
.setter(setter(Builder::serviceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceName").build()).build();
private static final SdkField SPEC_FIELD = SdkField. builder(MarshallingType.STRING).memberName("spec")
.getter(getter(UpdateServiceInstanceRequest::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(UpdateServiceInstanceRequest::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(UpdateServiceInstanceRequest::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(CLIENT_TOKEN_FIELD,
DEPLOYMENT_TYPE_FIELD, NAME_FIELD, SERVICE_NAME_FIELD, SPEC_FIELD, TEMPLATE_MAJOR_VERSION_FIELD,
TEMPLATE_MINOR_VERSION_FIELD));
private final String clientToken;
private final String deploymentType;
private final String name;
private final String serviceName;
private final String spec;
private final String templateMajorVersion;
private final String templateMinorVersion;
private UpdateServiceInstanceRequest(BuilderImpl builder) {
super(builder);
this.clientToken = builder.clientToken;
this.deploymentType = builder.deploymentType;
this.name = builder.name;
this.serviceName = builder.serviceName;
this.spec = builder.spec;
this.templateMajorVersion = builder.templateMajorVersion;
this.templateMinorVersion = builder.templateMinorVersion;
}
/**
*
* The client token of the service instance to update.
*
*
* @return The client token of the service instance to update.
*/
public final String clientToken() {
return clientToken;
}
/**
*
* The deployment type. It defines the mode for updating a service instance, as follows:
*
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the service instance 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 service instance 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 service instance is deployed and updated with the published, recommended (latest) major and
* minor version of the current template, by default. You can specify a different major version that's higher than
* the major version in use and a minor version.
*
*
*
*
* 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 The deployment type. It defines the mode for updating a service instance, as follows:
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the service instance 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 service instance 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 service instance is deployed and updated with the published, recommended (latest) major
* and minor version of the current template, by default. You can specify a different major version that's
* higher than the major version in use and a minor version.
*
*
* @see DeploymentUpdateType
*/
public final DeploymentUpdateType deploymentType() {
return DeploymentUpdateType.fromValue(deploymentType);
}
/**
*
* The deployment type. It defines the mode for updating a service instance, as follows:
*
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the service instance 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 service instance 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 service instance is deployed and updated with the published, recommended (latest) major and
* minor version of the current template, by default. You can specify a different major version that's higher than
* the major version in use and a minor version.
*
*
*
*
* 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 The deployment type. It defines the mode for updating a service instance, as follows:
*
*
* -
*
* NONE
*
*
* In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.
*
*
*
* -
*
* CURRENT_VERSION
*
*
* In this mode, the service instance 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 service instance 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 service instance is deployed and updated with the published, recommended (latest) major
* and minor version of the current template, by default. You can specify a different major version that's
* higher than the major version in use and a minor version.
*
*
* @see DeploymentUpdateType
*/
public final String deploymentTypeAsString() {
return deploymentType;
}
/**
*
* The name of the service instance to update.
*
*
* @return The name of the service instance to update.
*/
public final String name() {
return name;
}
/**
*
* The name of the service that the service instance belongs to.
*
*
* @return The name of the service that the service instance belongs to.
*/
public final String serviceName() {
return serviceName;
}
/**
*
* The formatted specification that defines the service instance update.
*
*
* @return The formatted specification that defines the service instance update.
*/
public final String spec() {
return spec;
}
/**
*
* The major version of the service template to update.
*
*
* @return The major version of the service template to update.
*/
public final String templateMajorVersion() {
return templateMajorVersion;
}
/**
*
* The minor version of the service template to update.
*
*
* @return The minor version of the service template 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 extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(clientToken());
hashCode = 31 * hashCode + Objects.hashCode(deploymentTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(serviceName());
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 UpdateServiceInstanceRequest)) {
return false;
}
UpdateServiceInstanceRequest other = (UpdateServiceInstanceRequest) obj;
return Objects.equals(clientToken(), other.clientToken())
&& Objects.equals(deploymentTypeAsString(), other.deploymentTypeAsString())
&& Objects.equals(name(), other.name()) && Objects.equals(serviceName(), other.serviceName())
&& 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("UpdateServiceInstanceRequest").add("ClientToken", clientToken())
.add("DeploymentType", deploymentTypeAsString()).add("Name", name()).add("ServiceName", serviceName())
.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 "clientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
case "deploymentType":
return Optional.ofNullable(clazz.cast(deploymentTypeAsString()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "serviceName":
return Optional.ofNullable(clazz.cast(serviceName()));
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