All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 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 getter(Function g) { return obj -> g.apply((UpdateServiceInstanceRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ProtonRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The client token of the service instance to update. *

* * @param clientToken * The client token of the service instance to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientToken(String 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. *

*
*
* * @param 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. *

*
* @see DeploymentUpdateType * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentUpdateType */ Builder deploymentType(String 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. *

*
*
* * @param 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. *

*
* @see DeploymentUpdateType * @return Returns a reference to this object so that method calls can be chained together. * @see DeploymentUpdateType */ Builder deploymentType(DeploymentUpdateType deploymentType); /** *

* The name of the service instance to update. *

* * @param name * The name of the service instance to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The name of the service that the service instance belongs to. *

* * @param serviceName * The name of the service that the service instance belongs to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceName(String serviceName); /** *

* The formatted specification that defines the service instance update. *

* * @param spec * The formatted specification that defines the service instance update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder spec(String spec); /** *

* The major version of the service template to update. *

* * @param templateMajorVersion * The major version of the service template to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateMajorVersion(String templateMajorVersion); /** *

* The minor version of the service template to update. *

* * @param templateMinorVersion * The minor version of the service template to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateMinorVersion(String templateMinorVersion); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ProtonRequest.BuilderImpl implements Builder { private String clientToken; private String deploymentType; private String name; private String serviceName; private String spec; private String templateMajorVersion; private String templateMinorVersion; private BuilderImpl() { } private BuilderImpl(UpdateServiceInstanceRequest model) { super(model); clientToken(model.clientToken); deploymentType(model.deploymentType); name(model.name); serviceName(model.serviceName); spec(model.spec); templateMajorVersion(model.templateMajorVersion); templateMinorVersion(model.templateMinorVersion); } public final String getClientToken() { return clientToken; } public final void setClientToken(String clientToken) { this.clientToken = clientToken; } @Override public final Builder clientToken(String clientToken) { this.clientToken = clientToken; return this; } public final String getDeploymentType() { return deploymentType; } public final void setDeploymentType(String deploymentType) { this.deploymentType = deploymentType; } @Override public final Builder deploymentType(String deploymentType) { this.deploymentType = deploymentType; return this; } @Override public final Builder deploymentType(DeploymentUpdateType deploymentType) { this.deploymentType(deploymentType == null ? null : deploymentType.toString()); return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getServiceName() { return serviceName; } public final void setServiceName(String serviceName) { this.serviceName = serviceName; } @Override public final Builder serviceName(String serviceName) { this.serviceName = serviceName; return this; } public final String getSpec() { return spec; } public final void setSpec(String spec) { this.spec = spec; } @Override public final Builder spec(String spec) { this.spec = spec; return this; } public final String getTemplateMajorVersion() { return templateMajorVersion; } public final void setTemplateMajorVersion(String templateMajorVersion) { this.templateMajorVersion = templateMajorVersion; } @Override public final Builder templateMajorVersion(String templateMajorVersion) { this.templateMajorVersion = templateMajorVersion; return this; } public final String getTemplateMinorVersion() { return templateMinorVersion; } public final void setTemplateMinorVersion(String templateMinorVersion) { this.templateMinorVersion = templateMinorVersion; } @Override public final Builder templateMinorVersion(String templateMinorVersion) { this.templateMinorVersion = templateMinorVersion; 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 UpdateServiceInstanceRequest build() { return new UpdateServiceInstanceRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy