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

software.amazon.awssdk.services.apprunner.model.UpdateServiceRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for App Runner module holds the client classes that are used for communicating with App Runner.

There is a newer version: 2.30.1
Show newest version
/*
 * 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.apprunner.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 UpdateServiceRequest extends AppRunnerRequest implements
        ToCopyableBuilder {
    private static final SdkField SERVICE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ServiceArn").getter(getter(UpdateServiceRequest::serviceArn)).setter(setter(Builder::serviceArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceArn").build()).build();

    private static final SdkField SOURCE_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("SourceConfiguration")
            .getter(getter(UpdateServiceRequest::sourceConfiguration)).setter(setter(Builder::sourceConfiguration))
            .constructor(SourceConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceConfiguration").build())
            .build();

    private static final SdkField INSTANCE_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("InstanceConfiguration")
            .getter(getter(UpdateServiceRequest::instanceConfiguration)).setter(setter(Builder::instanceConfiguration))
            .constructor(InstanceConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceConfiguration").build())
            .build();

    private static final SdkField AUTO_SCALING_CONFIGURATION_ARN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("AutoScalingConfigurationArn")
            .getter(getter(UpdateServiceRequest::autoScalingConfigurationArn))
            .setter(setter(Builder::autoScalingConfigurationArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AutoScalingConfigurationArn")
                    .build()).build();

    private static final SdkField HEALTH_CHECK_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("HealthCheckConfiguration")
            .getter(getter(UpdateServiceRequest::healthCheckConfiguration)).setter(setter(Builder::healthCheckConfiguration))
            .constructor(HealthCheckConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HealthCheckConfiguration").build())
            .build();

    private static final SdkField NETWORK_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("NetworkConfiguration")
            .getter(getter(UpdateServiceRequest::networkConfiguration)).setter(setter(Builder::networkConfiguration))
            .constructor(NetworkConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NetworkConfiguration").build())
            .build();

    private static final SdkField OBSERVABILITY_CONFIGURATION_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO)
            .memberName("ObservabilityConfiguration")
            .getter(getter(UpdateServiceRequest::observabilityConfiguration))
            .setter(setter(Builder::observabilityConfiguration))
            .constructor(ServiceObservabilityConfiguration::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ObservabilityConfiguration").build())
            .build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SERVICE_ARN_FIELD,
            SOURCE_CONFIGURATION_FIELD, INSTANCE_CONFIGURATION_FIELD, AUTO_SCALING_CONFIGURATION_ARN_FIELD,
            HEALTH_CHECK_CONFIGURATION_FIELD, NETWORK_CONFIGURATION_FIELD, OBSERVABILITY_CONFIGURATION_FIELD));

    private final String serviceArn;

    private final SourceConfiguration sourceConfiguration;

    private final InstanceConfiguration instanceConfiguration;

    private final String autoScalingConfigurationArn;

    private final HealthCheckConfiguration healthCheckConfiguration;

    private final NetworkConfiguration networkConfiguration;

    private final ServiceObservabilityConfiguration observabilityConfiguration;

    private UpdateServiceRequest(BuilderImpl builder) {
        super(builder);
        this.serviceArn = builder.serviceArn;
        this.sourceConfiguration = builder.sourceConfiguration;
        this.instanceConfiguration = builder.instanceConfiguration;
        this.autoScalingConfigurationArn = builder.autoScalingConfigurationArn;
        this.healthCheckConfiguration = builder.healthCheckConfiguration;
        this.networkConfiguration = builder.networkConfiguration;
        this.observabilityConfiguration = builder.observabilityConfiguration;
    }

    /**
     * 

* The Amazon Resource Name (ARN) of the App Runner service that you want to update. *

* * @return The Amazon Resource Name (ARN) of the App Runner service that you want to update. */ public final String serviceArn() { return serviceArn; } /** *

* The source configuration to apply to the App Runner service. *

*

* You can change the configuration of the code or image repository that the service uses. However, you can't switch * from code to image or the other way around. This means that you must provide the same structure member of * SourceConfiguration that you originally included when you created the service. Specifically, you can * include either CodeRepository or ImageRepository. To update the source configuration, * set the values to members of the structure that you include. *

* * @return The source configuration to apply to the App Runner service.

*

* You can change the configuration of the code or image repository that the service uses. However, you * can't switch from code to image or the other way around. This means that you must provide the same * structure member of SourceConfiguration that you originally included when you created the * service. Specifically, you can include either CodeRepository or ImageRepository * . To update the source configuration, set the values to members of the structure that you include. */ public final SourceConfiguration sourceConfiguration() { return sourceConfiguration; } /** *

* The runtime configuration to apply to instances (scaling units) of your service. *

* * @return The runtime configuration to apply to instances (scaling units) of your service. */ public final InstanceConfiguration instanceConfiguration() { return instanceConfiguration; } /** *

* The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to * associate with the App Runner service. *

* * @return The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to * associate with the App Runner service. */ public final String autoScalingConfigurationArn() { return autoScalingConfigurationArn; } /** *

* The settings for the health check that App Runner performs to monitor the health of the App Runner service. *

* * @return The settings for the health check that App Runner performs to monitor the health of the App Runner * service. */ public final HealthCheckConfiguration healthCheckConfiguration() { return healthCheckConfiguration; } /** *

* Configuration settings related to network traffic of the web application that the App Runner service runs. *

* * @return Configuration settings related to network traffic of the web application that the App Runner service * runs. */ public final NetworkConfiguration networkConfiguration() { return networkConfiguration; } /** *

* The observability configuration of your service. *

* * @return The observability configuration of your service. */ public final ServiceObservabilityConfiguration observabilityConfiguration() { return observabilityConfiguration; } @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(serviceArn()); hashCode = 31 * hashCode + Objects.hashCode(sourceConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(instanceConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(autoScalingConfigurationArn()); hashCode = 31 * hashCode + Objects.hashCode(healthCheckConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(networkConfiguration()); hashCode = 31 * hashCode + Objects.hashCode(observabilityConfiguration()); 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 UpdateServiceRequest)) { return false; } UpdateServiceRequest other = (UpdateServiceRequest) obj; return Objects.equals(serviceArn(), other.serviceArn()) && Objects.equals(sourceConfiguration(), other.sourceConfiguration()) && Objects.equals(instanceConfiguration(), other.instanceConfiguration()) && Objects.equals(autoScalingConfigurationArn(), other.autoScalingConfigurationArn()) && Objects.equals(healthCheckConfiguration(), other.healthCheckConfiguration()) && Objects.equals(networkConfiguration(), other.networkConfiguration()) && Objects.equals(observabilityConfiguration(), other.observabilityConfiguration()); } /** * 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("UpdateServiceRequest").add("ServiceArn", serviceArn()) .add("SourceConfiguration", sourceConfiguration()).add("InstanceConfiguration", instanceConfiguration()) .add("AutoScalingConfigurationArn", autoScalingConfigurationArn()) .add("HealthCheckConfiguration", healthCheckConfiguration()).add("NetworkConfiguration", networkConfiguration()) .add("ObservabilityConfiguration", observabilityConfiguration()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ServiceArn": return Optional.ofNullable(clazz.cast(serviceArn())); case "SourceConfiguration": return Optional.ofNullable(clazz.cast(sourceConfiguration())); case "InstanceConfiguration": return Optional.ofNullable(clazz.cast(instanceConfiguration())); case "AutoScalingConfigurationArn": return Optional.ofNullable(clazz.cast(autoScalingConfigurationArn())); case "HealthCheckConfiguration": return Optional.ofNullable(clazz.cast(healthCheckConfiguration())); case "NetworkConfiguration": return Optional.ofNullable(clazz.cast(networkConfiguration())); case "ObservabilityConfiguration": return Optional.ofNullable(clazz.cast(observabilityConfiguration())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((UpdateServiceRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends AppRunnerRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the App Runner service that you want to update. *

* * @param serviceArn * The Amazon Resource Name (ARN) of the App Runner service that you want to update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serviceArn(String serviceArn); /** *

* The source configuration to apply to the App Runner service. *

*

* You can change the configuration of the code or image repository that the service uses. However, you can't * switch from code to image or the other way around. This means that you must provide the same structure member * of SourceConfiguration that you originally included when you created the service. Specifically, * you can include either CodeRepository or ImageRepository. To update the source * configuration, set the values to members of the structure that you include. *

* * @param sourceConfiguration * The source configuration to apply to the App Runner service.

*

* You can change the configuration of the code or image repository that the service uses. However, you * can't switch from code to image or the other way around. This means that you must provide the same * structure member of SourceConfiguration that you originally included when you created the * service. Specifically, you can include either CodeRepository or * ImageRepository. To update the source configuration, set the values to members of the * structure that you include. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceConfiguration(SourceConfiguration sourceConfiguration); /** *

* The source configuration to apply to the App Runner service. *

*

* You can change the configuration of the code or image repository that the service uses. However, you can't * switch from code to image or the other way around. This means that you must provide the same structure member * of SourceConfiguration that you originally included when you created the service. Specifically, * you can include either CodeRepository or ImageRepository. To update the source * configuration, set the values to members of the structure that you include. *

* This is a convenience method that creates an instance of the {@link SourceConfiguration.Builder} avoiding the * need to create one manually via {@link SourceConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link SourceConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #sourceConfiguration(SourceConfiguration)}. * * @param sourceConfiguration * a consumer that will call methods on {@link SourceConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sourceConfiguration(SourceConfiguration) */ default Builder sourceConfiguration(Consumer sourceConfiguration) { return sourceConfiguration(SourceConfiguration.builder().applyMutation(sourceConfiguration).build()); } /** *

* The runtime configuration to apply to instances (scaling units) of your service. *

* * @param instanceConfiguration * The runtime configuration to apply to instances (scaling units) of your service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceConfiguration(InstanceConfiguration instanceConfiguration); /** *

* The runtime configuration to apply to instances (scaling units) of your service. *

* This is a convenience method that creates an instance of the {@link InstanceConfiguration.Builder} avoiding * the need to create one manually via {@link InstanceConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link InstanceConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #instanceConfiguration(InstanceConfiguration)}. * * @param instanceConfiguration * a consumer that will call methods on {@link InstanceConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #instanceConfiguration(InstanceConfiguration) */ default Builder instanceConfiguration(Consumer instanceConfiguration) { return instanceConfiguration(InstanceConfiguration.builder().applyMutation(instanceConfiguration).build()); } /** *

* The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to * associate with the App Runner service. *

* * @param autoScalingConfigurationArn * The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want * to associate with the App Runner service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder autoScalingConfigurationArn(String autoScalingConfigurationArn); /** *

* The settings for the health check that App Runner performs to monitor the health of the App Runner service. *

* * @param healthCheckConfiguration * The settings for the health check that App Runner performs to monitor the health of the App Runner * service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthCheckConfiguration(HealthCheckConfiguration healthCheckConfiguration); /** *

* The settings for the health check that App Runner performs to monitor the health of the App Runner service. *

* This is a convenience method that creates an instance of the {@link HealthCheckConfiguration.Builder} * avoiding the need to create one manually via {@link HealthCheckConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link HealthCheckConfiguration.Builder#build()} is called immediately * and its result is passed to {@link #healthCheckConfiguration(HealthCheckConfiguration)}. * * @param healthCheckConfiguration * a consumer that will call methods on {@link HealthCheckConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #healthCheckConfiguration(HealthCheckConfiguration) */ default Builder healthCheckConfiguration(Consumer healthCheckConfiguration) { return healthCheckConfiguration(HealthCheckConfiguration.builder().applyMutation(healthCheckConfiguration).build()); } /** *

* Configuration settings related to network traffic of the web application that the App Runner service runs. *

* * @param networkConfiguration * Configuration settings related to network traffic of the web application that the App Runner service * runs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder networkConfiguration(NetworkConfiguration networkConfiguration); /** *

* Configuration settings related to network traffic of the web application that the App Runner service runs. *

* This is a convenience method that creates an instance of the {@link NetworkConfiguration.Builder} avoiding * the need to create one manually via {@link NetworkConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link NetworkConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #networkConfiguration(NetworkConfiguration)}. * * @param networkConfiguration * a consumer that will call methods on {@link NetworkConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #networkConfiguration(NetworkConfiguration) */ default Builder networkConfiguration(Consumer networkConfiguration) { return networkConfiguration(NetworkConfiguration.builder().applyMutation(networkConfiguration).build()); } /** *

* The observability configuration of your service. *

* * @param observabilityConfiguration * The observability configuration of your service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder observabilityConfiguration(ServiceObservabilityConfiguration observabilityConfiguration); /** *

* The observability configuration of your service. *

* This is a convenience method that creates an instance of the * {@link ServiceObservabilityConfiguration.Builder} avoiding the need to create one manually via * {@link ServiceObservabilityConfiguration#builder()}. * *

* When the {@link Consumer} completes, {@link ServiceObservabilityConfiguration.Builder#build()} is called * immediately and its result is passed to * {@link #observabilityConfiguration(ServiceObservabilityConfiguration)}. * * @param observabilityConfiguration * a consumer that will call methods on {@link ServiceObservabilityConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #observabilityConfiguration(ServiceObservabilityConfiguration) */ default Builder observabilityConfiguration(Consumer observabilityConfiguration) { return observabilityConfiguration(ServiceObservabilityConfiguration.builder() .applyMutation(observabilityConfiguration).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends AppRunnerRequest.BuilderImpl implements Builder { private String serviceArn; private SourceConfiguration sourceConfiguration; private InstanceConfiguration instanceConfiguration; private String autoScalingConfigurationArn; private HealthCheckConfiguration healthCheckConfiguration; private NetworkConfiguration networkConfiguration; private ServiceObservabilityConfiguration observabilityConfiguration; private BuilderImpl() { } private BuilderImpl(UpdateServiceRequest model) { super(model); serviceArn(model.serviceArn); sourceConfiguration(model.sourceConfiguration); instanceConfiguration(model.instanceConfiguration); autoScalingConfigurationArn(model.autoScalingConfigurationArn); healthCheckConfiguration(model.healthCheckConfiguration); networkConfiguration(model.networkConfiguration); observabilityConfiguration(model.observabilityConfiguration); } public final String getServiceArn() { return serviceArn; } public final void setServiceArn(String serviceArn) { this.serviceArn = serviceArn; } @Override public final Builder serviceArn(String serviceArn) { this.serviceArn = serviceArn; return this; } public final SourceConfiguration.Builder getSourceConfiguration() { return sourceConfiguration != null ? sourceConfiguration.toBuilder() : null; } public final void setSourceConfiguration(SourceConfiguration.BuilderImpl sourceConfiguration) { this.sourceConfiguration = sourceConfiguration != null ? sourceConfiguration.build() : null; } @Override public final Builder sourceConfiguration(SourceConfiguration sourceConfiguration) { this.sourceConfiguration = sourceConfiguration; return this; } public final InstanceConfiguration.Builder getInstanceConfiguration() { return instanceConfiguration != null ? instanceConfiguration.toBuilder() : null; } public final void setInstanceConfiguration(InstanceConfiguration.BuilderImpl instanceConfiguration) { this.instanceConfiguration = instanceConfiguration != null ? instanceConfiguration.build() : null; } @Override public final Builder instanceConfiguration(InstanceConfiguration instanceConfiguration) { this.instanceConfiguration = instanceConfiguration; return this; } public final String getAutoScalingConfigurationArn() { return autoScalingConfigurationArn; } public final void setAutoScalingConfigurationArn(String autoScalingConfigurationArn) { this.autoScalingConfigurationArn = autoScalingConfigurationArn; } @Override public final Builder autoScalingConfigurationArn(String autoScalingConfigurationArn) { this.autoScalingConfigurationArn = autoScalingConfigurationArn; return this; } public final HealthCheckConfiguration.Builder getHealthCheckConfiguration() { return healthCheckConfiguration != null ? healthCheckConfiguration.toBuilder() : null; } public final void setHealthCheckConfiguration(HealthCheckConfiguration.BuilderImpl healthCheckConfiguration) { this.healthCheckConfiguration = healthCheckConfiguration != null ? healthCheckConfiguration.build() : null; } @Override public final Builder healthCheckConfiguration(HealthCheckConfiguration healthCheckConfiguration) { this.healthCheckConfiguration = healthCheckConfiguration; return this; } public final NetworkConfiguration.Builder getNetworkConfiguration() { return networkConfiguration != null ? networkConfiguration.toBuilder() : null; } public final void setNetworkConfiguration(NetworkConfiguration.BuilderImpl networkConfiguration) { this.networkConfiguration = networkConfiguration != null ? networkConfiguration.build() : null; } @Override public final Builder networkConfiguration(NetworkConfiguration networkConfiguration) { this.networkConfiguration = networkConfiguration; return this; } public final ServiceObservabilityConfiguration.Builder getObservabilityConfiguration() { return observabilityConfiguration != null ? observabilityConfiguration.toBuilder() : null; } public final void setObservabilityConfiguration(ServiceObservabilityConfiguration.BuilderImpl observabilityConfiguration) { this.observabilityConfiguration = observabilityConfiguration != null ? observabilityConfiguration.build() : null; } @Override public final Builder observabilityConfiguration(ServiceObservabilityConfiguration observabilityConfiguration) { this.observabilityConfiguration = observabilityConfiguration; 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 UpdateServiceRequest build() { return new UpdateServiceRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy