software.amazon.awssdk.services.elasticbeanstalk.model.CreateConfigurationTemplateRequest Maven / Gradle / Ivy
Show all versions of elasticbeanstalk Show documentation
/*
* Copyright 2014-2019 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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Request to create a configuration template.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateConfigurationTemplateRequest extends ElasticBeanstalkRequest implements
ToCopyableBuilder {
private static final SdkField APPLICATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::applicationName)).setter(setter(Builder::applicationName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationName").build()).build();
private static final SdkField TEMPLATE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::templateName)).setter(setter(Builder::templateName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TemplateName").build()).build();
private static final SdkField SOLUTION_STACK_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::solutionStackName)).setter(setter(Builder::solutionStackName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SolutionStackName").build()).build();
private static final SdkField PLATFORM_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::platformArn)).setter(setter(Builder::platformArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PlatformArn").build()).build();
private static final SdkField SOURCE_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(CreateConfigurationTemplateRequest::sourceConfiguration)).setter(setter(Builder::sourceConfiguration))
.constructor(SourceConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceConfiguration").build())
.build();
private static final SdkField ENVIRONMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::environmentId)).setter(setter(Builder::environmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnvironmentId").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateConfigurationTemplateRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField> OPTION_SETTINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(CreateConfigurationTemplateRequest::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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_NAME_FIELD,
TEMPLATE_NAME_FIELD, SOLUTION_STACK_NAME_FIELD, PLATFORM_ARN_FIELD, SOURCE_CONFIGURATION_FIELD, ENVIRONMENT_ID_FIELD,
DESCRIPTION_FIELD, OPTION_SETTINGS_FIELD));
private final String applicationName;
private final String templateName;
private final String solutionStackName;
private final String platformArn;
private final SourceConfiguration sourceConfiguration;
private final String environmentId;
private final String description;
private final List optionSettings;
private CreateConfigurationTemplateRequest(BuilderImpl builder) {
super(builder);
this.applicationName = builder.applicationName;
this.templateName = builder.templateName;
this.solutionStackName = builder.solutionStackName;
this.platformArn = builder.platformArn;
this.sourceConfiguration = builder.sourceConfiguration;
this.environmentId = builder.environmentId;
this.description = builder.description;
this.optionSettings = builder.optionSettings;
}
/**
*
* The name of the application to associate with this configuration template. If no application is found with this
* name, AWS Elastic Beanstalk returns an InvalidParameterValue
error.
*
*
* @return The name of the application to associate with this configuration template. If no application is found
* with this name, AWS Elastic Beanstalk returns an InvalidParameterValue
error.
*/
public String applicationName() {
return applicationName;
}
/**
*
* The name of the configuration template.
*
*
* Constraint: This name must be unique per application.
*
*
* Default: If a configuration template already exists with this name, AWS Elastic Beanstalk returns an
* InvalidParameterValue
error.
*
*
* @return The name of the configuration template.
*
* Constraint: This name must be unique per application.
*
*
* Default: If a configuration template already exists with this name, AWS Elastic Beanstalk returns an
* InvalidParameterValue
error.
*/
public String templateName() {
return templateName;
}
/**
*
* The name of the solution stack used by this configuration. The solution stack specifies the operating system,
* architecture, and application server for a configuration template. It determines the set of configuration options
* as well as the possible and default values.
*
*
* Use ListAvailableSolutionStacks to obtain a list of available solution stacks.
*
*
* A solution stack name or a source configuration parameter must be specified, otherwise AWS Elastic Beanstalk
* returns an InvalidParameterValue
error.
*
*
* If a solution stack name is not specified and the source configuration parameter is specified, AWS Elastic
* Beanstalk uses the same solution stack as the source configuration template.
*
*
* @return The name of the solution stack used by this configuration. The solution stack specifies the operating
* system, architecture, and application server for a configuration template. It determines the set of
* configuration options as well as the possible and default values.
*
* Use ListAvailableSolutionStacks to obtain a list of available solution stacks.
*
*
* A solution stack name or a source configuration parameter must be specified, otherwise AWS Elastic
* Beanstalk returns an InvalidParameterValue
error.
*
*
* If a solution stack name is not specified and the source configuration parameter is specified, AWS
* Elastic Beanstalk uses the same solution stack as the source configuration template.
*/
public String solutionStackName() {
return solutionStackName;
}
/**
*
* The ARN of the custom platform.
*
*
* @return The ARN of the custom platform.
*/
public String platformArn() {
return platformArn;
}
/**
*
* If specified, AWS Elastic Beanstalk uses the configuration values from the specified configuration template to
* create a new configuration.
*
*
* Values specified in the OptionSettings
parameter of this call overrides any values obtained from the
* SourceConfiguration
.
*
*
* If no configuration template is found, returns an InvalidParameterValue
error.
*
*
* Constraint: If both the solution stack name parameter and the source configuration parameters are specified, the
* solution stack of the source configuration template must match the specified solution stack name or else AWS
* Elastic Beanstalk returns an InvalidParameterCombination
error.
*
*
* @return If specified, AWS Elastic Beanstalk uses the configuration values from the specified configuration
* template to create a new configuration.
*
* Values specified in the OptionSettings
parameter of this call overrides any values obtained
* from the SourceConfiguration
.
*
*
* If no configuration template is found, returns an InvalidParameterValue
error.
*
*
* Constraint: If both the solution stack name parameter and the source configuration parameters are
* specified, the solution stack of the source configuration template must match the specified solution
* stack name or else AWS Elastic Beanstalk returns an InvalidParameterCombination
error.
*/
public SourceConfiguration sourceConfiguration() {
return sourceConfiguration;
}
/**
*
* The ID of the environment used with this configuration template.
*
*
* @return The ID of the environment used with this configuration template.
*/
public String environmentId() {
return environmentId;
}
/**
*
* Describes this configuration.
*
*
* @return Describes this configuration.
*/
public String description() {
return description;
}
/**
*
* If specified, AWS Elastic Beanstalk sets the specified configuration option to the requested value. The new value
* overrides the value obtained from the solution stack or the source configuration template.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return If specified, AWS Elastic Beanstalk sets the specified configuration option to the requested value. The
* new value overrides the value obtained from the solution stack or the source configuration template.
*/
public List optionSettings() {
return optionSettings;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(applicationName());
hashCode = 31 * hashCode + Objects.hashCode(templateName());
hashCode = 31 * hashCode + Objects.hashCode(solutionStackName());
hashCode = 31 * hashCode + Objects.hashCode(platformArn());
hashCode = 31 * hashCode + Objects.hashCode(sourceConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(environmentId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(optionSettings());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateConfigurationTemplateRequest)) {
return false;
}
CreateConfigurationTemplateRequest other = (CreateConfigurationTemplateRequest) obj;
return Objects.equals(applicationName(), other.applicationName()) && Objects.equals(templateName(), other.templateName())
&& Objects.equals(solutionStackName(), other.solutionStackName())
&& Objects.equals(platformArn(), other.platformArn())
&& Objects.equals(sourceConfiguration(), other.sourceConfiguration())
&& Objects.equals(environmentId(), other.environmentId()) && Objects.equals(description(), other.description())
&& Objects.equals(optionSettings(), other.optionSettings());
}
/**
* 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 String toString() {
return ToString.builder("CreateConfigurationTemplateRequest").add("ApplicationName", applicationName())
.add("TemplateName", templateName()).add("SolutionStackName", solutionStackName())
.add("PlatformArn", platformArn()).add("SourceConfiguration", sourceConfiguration())
.add("EnvironmentId", environmentId()).add("Description", description()).add("OptionSettings", optionSettings())
.build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationName":
return Optional.ofNullable(clazz.cast(applicationName()));
case "TemplateName":
return Optional.ofNullable(clazz.cast(templateName()));
case "SolutionStackName":
return Optional.ofNullable(clazz.cast(solutionStackName()));
case "PlatformArn":
return Optional.ofNullable(clazz.cast(platformArn()));
case "SourceConfiguration":
return Optional.ofNullable(clazz.cast(sourceConfiguration()));
case "EnvironmentId":
return Optional.ofNullable(clazz.cast(environmentId()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "OptionSettings":
return Optional.ofNullable(clazz.cast(optionSettings()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function