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

software.amazon.awssdk.services.apigateway.model.DeploymentCanarySettings Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon API Gateway module holds the client classes that are used for communicating with Amazon API Gateway

There is a newer version: 2.28.3
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.apigateway.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The input configuration for a canary deployment. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DeploymentCanarySettings implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField PERCENT_TRAFFIC_FIELD = SdkField. builder(MarshallingType.DOUBLE) .memberName("percentTraffic").getter(getter(DeploymentCanarySettings::percentTraffic)) .setter(setter(Builder::percentTraffic)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("percentTraffic").build()).build(); private static final SdkField> STAGE_VARIABLE_OVERRIDES_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("stageVariableOverrides") .getter(getter(DeploymentCanarySettings::stageVariableOverrides)) .setter(setter(Builder::stageVariableOverrides)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stageVariableOverrides").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField USE_STAGE_CACHE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("useStageCache").getter(getter(DeploymentCanarySettings::useStageCache)) .setter(setter(Builder::useStageCache)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("useStageCache").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PERCENT_TRAFFIC_FIELD, STAGE_VARIABLE_OVERRIDES_FIELD, USE_STAGE_CACHE_FIELD)); private static final long serialVersionUID = 1L; private final Double percentTraffic; private final Map stageVariableOverrides; private final Boolean useStageCache; private DeploymentCanarySettings(BuilderImpl builder) { this.percentTraffic = builder.percentTraffic; this.stageVariableOverrides = builder.stageVariableOverrides; this.useStageCache = builder.useStageCache; } /** *

* The percentage (0.0-100.0) of traffic routed to the canary deployment. *

* * @return The percentage (0.0-100.0) of traffic routed to the canary deployment. */ public final Double percentTraffic() { return percentTraffic; } /** * For responses, this returns true if the service returned a value for the StageVariableOverrides property. This * DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the * property). This is useful because the SDK will never return a null collection or map, but you may need to * differentiate between the service returning nothing (or null) and the service returning an empty collection or * map. For requests, this returns true if a value for the property was specified in the request builder, and false * if a value was not specified. */ public final boolean hasStageVariableOverrides() { return stageVariableOverrides != null && !(stageVariableOverrides instanceof SdkAutoConstructMap); } /** *

* A stage variable overrides used for the canary release deployment. They can override existing stage variables or * add new stage variables for the canary release deployment. These stage variables are represented as a * string-to-string map between stage variable names and their values. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasStageVariableOverrides} method. *

* * @return A stage variable overrides used for the canary release deployment. They can override existing stage * variables or add new stage variables for the canary release deployment. These stage variables are * represented as a string-to-string map between stage variable names and their values. */ public final Map stageVariableOverrides() { return stageVariableOverrides; } /** *

* A Boolean flag to indicate whether the canary release deployment uses the stage cache or not. *

* * @return A Boolean flag to indicate whether the canary release deployment uses the stage cache or not. */ public final Boolean useStageCache() { return useStageCache; } @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 + Objects.hashCode(percentTraffic()); hashCode = 31 * hashCode + Objects.hashCode(hasStageVariableOverrides() ? stageVariableOverrides() : null); hashCode = 31 * hashCode + Objects.hashCode(useStageCache()); 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 DeploymentCanarySettings)) { return false; } DeploymentCanarySettings other = (DeploymentCanarySettings) obj; return Objects.equals(percentTraffic(), other.percentTraffic()) && hasStageVariableOverrides() == other.hasStageVariableOverrides() && Objects.equals(stageVariableOverrides(), other.stageVariableOverrides()) && Objects.equals(useStageCache(), other.useStageCache()); } /** * 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("DeploymentCanarySettings").add("PercentTraffic", percentTraffic()) .add("StageVariableOverrides", hasStageVariableOverrides() ? stageVariableOverrides() : null) .add("UseStageCache", useStageCache()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "percentTraffic": return Optional.ofNullable(clazz.cast(percentTraffic())); case "stageVariableOverrides": return Optional.ofNullable(clazz.cast(stageVariableOverrides())); case "useStageCache": return Optional.ofNullable(clazz.cast(useStageCache())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DeploymentCanarySettings) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The percentage (0.0-100.0) of traffic routed to the canary deployment. *

* * @param percentTraffic * The percentage (0.0-100.0) of traffic routed to the canary deployment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder percentTraffic(Double percentTraffic); /** *

* A stage variable overrides used for the canary release deployment. They can override existing stage variables * or add new stage variables for the canary release deployment. These stage variables are represented as a * string-to-string map between stage variable names and their values. *

* * @param stageVariableOverrides * A stage variable overrides used for the canary release deployment. They can override existing stage * variables or add new stage variables for the canary release deployment. These stage variables are * represented as a string-to-string map between stage variable names and their values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stageVariableOverrides(Map stageVariableOverrides); /** *

* A Boolean flag to indicate whether the canary release deployment uses the stage cache or not. *

* * @param useStageCache * A Boolean flag to indicate whether the canary release deployment uses the stage cache or not. * @return Returns a reference to this object so that method calls can be chained together. */ Builder useStageCache(Boolean useStageCache); } static final class BuilderImpl implements Builder { private Double percentTraffic; private Map stageVariableOverrides = DefaultSdkAutoConstructMap.getInstance(); private Boolean useStageCache; private BuilderImpl() { } private BuilderImpl(DeploymentCanarySettings model) { percentTraffic(model.percentTraffic); stageVariableOverrides(model.stageVariableOverrides); useStageCache(model.useStageCache); } public final Double getPercentTraffic() { return percentTraffic; } public final void setPercentTraffic(Double percentTraffic) { this.percentTraffic = percentTraffic; } @Override public final Builder percentTraffic(Double percentTraffic) { this.percentTraffic = percentTraffic; return this; } public final Map getStageVariableOverrides() { if (stageVariableOverrides instanceof SdkAutoConstructMap) { return null; } return stageVariableOverrides; } public final void setStageVariableOverrides(Map stageVariableOverrides) { this.stageVariableOverrides = MapOfStringToStringCopier.copy(stageVariableOverrides); } @Override public final Builder stageVariableOverrides(Map stageVariableOverrides) { this.stageVariableOverrides = MapOfStringToStringCopier.copy(stageVariableOverrides); return this; } public final Boolean getUseStageCache() { return useStageCache; } public final void setUseStageCache(Boolean useStageCache) { this.useStageCache = useStageCache; } @Override public final Builder useStageCache(Boolean useStageCache) { this.useStageCache = useStageCache; return this; } @Override public DeploymentCanarySettings build() { return new DeploymentCanarySettings(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy