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

software.amazon.awssdk.services.elasticbeanstalk.model.CreatePlatformVersionRequest 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.elasticbeanstalk.model;

import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Request to create a new platform version. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CreatePlatformVersionRequest extends ElasticBeanstalkRequest implements ToCopyableBuilder { private static final SdkField PLATFORM_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PlatformName").getter(getter(CreatePlatformVersionRequest::platformName)) .setter(setter(Builder::platformName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlatformName").build()).build(); private static final SdkField PLATFORM_VERSION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("PlatformVersion").getter(getter(CreatePlatformVersionRequest::platformVersion)) .setter(setter(Builder::platformVersion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlatformVersion").build()).build(); private static final SdkField PLATFORM_DEFINITION_BUNDLE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("PlatformDefinitionBundle") .getter(getter(CreatePlatformVersionRequest::platformDefinitionBundle)) .setter(setter(Builder::platformDefinitionBundle)).constructor(S3Location::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlatformDefinitionBundle").build()) .build(); private static final SdkField ENVIRONMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("EnvironmentName").getter(getter(CreatePlatformVersionRequest::environmentName)) .setter(setter(Builder::environmentName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnvironmentName").build()).build(); private static final SdkField> OPTION_SETTINGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("OptionSettings") .getter(getter(CreatePlatformVersionRequest::optionSettings)) .setter(setter(Builder::optionSettings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptionSettings").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ConfigurationOptionSetting::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(CreatePlatformVersionRequest::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PLATFORM_NAME_FIELD, PLATFORM_VERSION_FIELD, PLATFORM_DEFINITION_BUNDLE_FIELD, ENVIRONMENT_NAME_FIELD, OPTION_SETTINGS_FIELD, TAGS_FIELD)); private final String platformName; private final String platformVersion; private final S3Location platformDefinitionBundle; private final String environmentName; private final List optionSettings; private final List tags; private CreatePlatformVersionRequest(BuilderImpl builder) { super(builder); this.platformName = builder.platformName; this.platformVersion = builder.platformVersion; this.platformDefinitionBundle = builder.platformDefinitionBundle; this.environmentName = builder.environmentName; this.optionSettings = builder.optionSettings; this.tags = builder.tags; } /** *

* The name of your custom platform. *

* * @return The name of your custom platform. */ public final String platformName() { return platformName; } /** *

* The number, such as 1.0.2, for the new platform version. *

* * @return The number, such as 1.0.2, for the new platform version. */ public final String platformVersion() { return platformVersion; } /** *

* The location of the platform definition archive in Amazon S3. *

* * @return The location of the platform definition archive in Amazon S3. */ public final S3Location platformDefinitionBundle() { return platformDefinitionBundle; } /** *

* The name of the builder environment. *

* * @return The name of the builder environment. */ public final String environmentName() { return environmentName; } /** * For responses, this returns true if the service returned a value for the OptionSettings 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 hasOptionSettings() { return optionSettings != null && !(optionSettings instanceof SdkAutoConstructList); } /** *

* The configuration option settings to apply to the builder environment. *

*

* 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 #hasOptionSettings} method. *

* * @return The configuration option settings to apply to the builder environment. */ public final List optionSettings() { return optionSettings; } /** * For responses, this returns true if the service returned a value for the Tags 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 hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* Specifies the tags applied to the new platform version. *

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using the * platform version don't inherit the tags. *

*

* 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 #hasTags} method. *

* * @return Specifies the tags applied to the new platform version.

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using the * platform version don't inherit the tags. */ public final List tags() { return tags; } @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(platformName()); hashCode = 31 * hashCode + Objects.hashCode(platformVersion()); hashCode = 31 * hashCode + Objects.hashCode(platformDefinitionBundle()); hashCode = 31 * hashCode + Objects.hashCode(environmentName()); hashCode = 31 * hashCode + Objects.hashCode(hasOptionSettings() ? optionSettings() : null); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); 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 CreatePlatformVersionRequest)) { return false; } CreatePlatformVersionRequest other = (CreatePlatformVersionRequest) obj; return Objects.equals(platformName(), other.platformName()) && Objects.equals(platformVersion(), other.platformVersion()) && Objects.equals(platformDefinitionBundle(), other.platformDefinitionBundle()) && Objects.equals(environmentName(), other.environmentName()) && hasOptionSettings() == other.hasOptionSettings() && Objects.equals(optionSettings(), other.optionSettings()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()); } /** * 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("CreatePlatformVersionRequest").add("PlatformName", platformName()) .add("PlatformVersion", platformVersion()).add("PlatformDefinitionBundle", platformDefinitionBundle()) .add("EnvironmentName", environmentName()).add("OptionSettings", hasOptionSettings() ? optionSettings() : null) .add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "PlatformName": return Optional.ofNullable(clazz.cast(platformName())); case "PlatformVersion": return Optional.ofNullable(clazz.cast(platformVersion())); case "PlatformDefinitionBundle": return Optional.ofNullable(clazz.cast(platformDefinitionBundle())); case "EnvironmentName": return Optional.ofNullable(clazz.cast(environmentName())); case "OptionSettings": return Optional.ofNullable(clazz.cast(optionSettings())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreatePlatformVersionRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ElasticBeanstalkRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of your custom platform. *

* * @param platformName * The name of your custom platform. * @return Returns a reference to this object so that method calls can be chained together. */ Builder platformName(String platformName); /** *

* The number, such as 1.0.2, for the new platform version. *

* * @param platformVersion * The number, such as 1.0.2, for the new platform version. * @return Returns a reference to this object so that method calls can be chained together. */ Builder platformVersion(String platformVersion); /** *

* The location of the platform definition archive in Amazon S3. *

* * @param platformDefinitionBundle * The location of the platform definition archive in Amazon S3. * @return Returns a reference to this object so that method calls can be chained together. */ Builder platformDefinitionBundle(S3Location platformDefinitionBundle); /** *

* The location of the platform definition archive in Amazon S3. *

* This is a convenience method that creates an instance of the {@link S3Location.Builder} avoiding the need to * create one manually via {@link S3Location#builder()}. * * When the {@link Consumer} completes, {@link S3Location.Builder#build()} is called immediately and its result * is passed to {@link #platformDefinitionBundle(S3Location)}. * * @param platformDefinitionBundle * a consumer that will call methods on {@link S3Location.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #platformDefinitionBundle(S3Location) */ default Builder platformDefinitionBundle(Consumer platformDefinitionBundle) { return platformDefinitionBundle(S3Location.builder().applyMutation(platformDefinitionBundle).build()); } /** *

* The name of the builder environment. *

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

* The configuration option settings to apply to the builder environment. *

* * @param optionSettings * The configuration option settings to apply to the builder environment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionSettings(Collection optionSettings); /** *

* The configuration option settings to apply to the builder environment. *

* * @param optionSettings * The configuration option settings to apply to the builder environment. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optionSettings(ConfigurationOptionSetting... optionSettings); /** *

* The configuration option settings to apply to the builder environment. *

* This is a convenience method that creates an instance of the {@link List.Builder} * avoiding the need to create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called * immediately and its result is passed to {@link #optionSettings(List)}. * * @param optionSettings * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #optionSettings(List) */ Builder optionSettings(Consumer... optionSettings); /** *

* Specifies the tags applied to the new platform version. *

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using the * platform version don't inherit the tags. *

* * @param tags * Specifies the tags applied to the new platform version.

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using * the platform version don't inherit the tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* Specifies the tags applied to the new platform version. *

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using the * platform version don't inherit the tags. *

* * @param tags * Specifies the tags applied to the new platform version.

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using * the platform version don't inherit the tags. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* Specifies the tags applied to the new platform version. *

*

* Elastic Beanstalk applies these tags only to the platform version. Environments that you create using the * platform version don't inherit the tags. *

* This is a convenience method that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ElasticBeanstalkRequest.BuilderImpl implements Builder { private String platformName; private String platformVersion; private S3Location platformDefinitionBundle; private String environmentName; private List optionSettings = DefaultSdkAutoConstructList.getInstance(); private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(CreatePlatformVersionRequest model) { super(model); platformName(model.platformName); platformVersion(model.platformVersion); platformDefinitionBundle(model.platformDefinitionBundle); environmentName(model.environmentName); optionSettings(model.optionSettings); tags(model.tags); } public final String getPlatformName() { return platformName; } public final void setPlatformName(String platformName) { this.platformName = platformName; } @Override public final Builder platformName(String platformName) { this.platformName = platformName; return this; } public final String getPlatformVersion() { return platformVersion; } public final void setPlatformVersion(String platformVersion) { this.platformVersion = platformVersion; } @Override public final Builder platformVersion(String platformVersion) { this.platformVersion = platformVersion; return this; } public final S3Location.Builder getPlatformDefinitionBundle() { return platformDefinitionBundle != null ? platformDefinitionBundle.toBuilder() : null; } public final void setPlatformDefinitionBundle(S3Location.BuilderImpl platformDefinitionBundle) { this.platformDefinitionBundle = platformDefinitionBundle != null ? platformDefinitionBundle.build() : null; } @Override public final Builder platformDefinitionBundle(S3Location platformDefinitionBundle) { this.platformDefinitionBundle = platformDefinitionBundle; return this; } public final String getEnvironmentName() { return environmentName; } public final void setEnvironmentName(String environmentName) { this.environmentName = environmentName; } @Override public final Builder environmentName(String environmentName) { this.environmentName = environmentName; return this; } public final List getOptionSettings() { List result = ConfigurationOptionSettingsListCopier .copyToBuilder(this.optionSettings); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setOptionSettings(Collection optionSettings) { this.optionSettings = ConfigurationOptionSettingsListCopier.copyFromBuilder(optionSettings); } @Override public final Builder optionSettings(Collection optionSettings) { this.optionSettings = ConfigurationOptionSettingsListCopier.copy(optionSettings); return this; } @Override @SafeVarargs public final Builder optionSettings(ConfigurationOptionSetting... optionSettings) { optionSettings(Arrays.asList(optionSettings)); return this; } @Override @SafeVarargs public final Builder optionSettings(Consumer... optionSettings) { optionSettings(Stream.of(optionSettings).map(c -> ConfigurationOptionSetting.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final List getTags() { List result = TagsCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagsCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagsCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); 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 CreatePlatformVersionRequest build() { return new CreatePlatformVersionRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy