software.amazon.awssdk.services.proton.model.CreateComponentRequest Maven / Gradle / Ivy
Show all versions of proton Show documentation
/*
* 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.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.DefaultValueTrait;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateComponentRequest extends ProtonRequest implements
ToCopyableBuilder {
private static final SdkField CLIENT_TOKEN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("clientToken")
.getter(getter(CreateComponentRequest::clientToken))
.setter(setter(Builder::clientToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientToken").build(),
DefaultValueTrait.idempotencyToken()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(CreateComponentRequest::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField ENVIRONMENT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("environmentName").getter(getter(CreateComponentRequest::environmentName))
.setter(setter(Builder::environmentName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("environmentName").build()).build();
private static final SdkField MANIFEST_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("manifest").getter(getter(CreateComponentRequest::manifest)).setter(setter(Builder::manifest))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("manifest").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(CreateComponentRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField SERVICE_INSTANCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceInstanceName").getter(getter(CreateComponentRequest::serviceInstanceName))
.setter(setter(Builder::serviceInstanceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceInstanceName").build())
.build();
private static final SdkField SERVICE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceName").getter(getter(CreateComponentRequest::serviceName)).setter(setter(Builder::serviceName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceName").build()).build();
private static final SdkField SERVICE_SPEC_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceSpec").getter(getter(CreateComponentRequest::serviceSpec)).setter(setter(Builder::serviceSpec))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceSpec").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tags")
.getter(getter(CreateComponentRequest::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 SdkField TEMPLATE_FILE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("templateFile").getter(getter(CreateComponentRequest::templateFile))
.setter(setter(Builder::templateFile))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateFile").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLIENT_TOKEN_FIELD,
DESCRIPTION_FIELD, ENVIRONMENT_NAME_FIELD, MANIFEST_FIELD, NAME_FIELD, SERVICE_INSTANCE_NAME_FIELD,
SERVICE_NAME_FIELD, SERVICE_SPEC_FIELD, TAGS_FIELD, TEMPLATE_FILE_FIELD));
private final String clientToken;
private final String description;
private final String environmentName;
private final String manifest;
private final String name;
private final String serviceInstanceName;
private final String serviceName;
private final String serviceSpec;
private final List tags;
private final String templateFile;
private CreateComponentRequest(BuilderImpl builder) {
super(builder);
this.clientToken = builder.clientToken;
this.description = builder.description;
this.environmentName = builder.environmentName;
this.manifest = builder.manifest;
this.name = builder.name;
this.serviceInstanceName = builder.serviceInstanceName;
this.serviceName = builder.serviceName;
this.serviceSpec = builder.serviceSpec;
this.tags = builder.tags;
this.templateFile = builder.templateFile;
}
/**
*
* The client token for the created component.
*
*
* @return The client token for the created component.
*/
public final String clientToken() {
return clientToken;
}
/**
*
* An optional customer-provided description of the component.
*
*
* @return An optional customer-provided description of the component.
*/
public final String description() {
return description;
}
/**
*
* The name of the Proton environment that you want to associate this component with. You must specify this when you
* don't specify serviceInstanceName
and serviceName
.
*
*
* @return The name of the Proton environment that you want to associate this component with. You must specify this
* when you don't specify serviceInstanceName
and serviceName
.
*/
public final String environmentName() {
return environmentName;
}
/**
*
* A path to a manifest file that lists the Infrastructure as Code (IaC) file, template language, and rendering
* engine for infrastructure that a custom component provisions.
*
*
* @return A path to a manifest file that lists the Infrastructure as Code (IaC) file, template language, and
* rendering engine for infrastructure that a custom component provisions.
*/
public final String manifest() {
return manifest;
}
/**
*
* The customer-provided name of the component.
*
*
* @return The customer-provided name of the component.
*/
public final String name() {
return name;
}
/**
*
* The name of the service instance that you want to attach this component to. If you don't specify this, the
* component isn't attached to any service instance. Specify both serviceInstanceName
and
* serviceName
or neither of them.
*
*
* @return The name of the service instance that you want to attach this component to. If you don't specify this,
* the component isn't attached to any service instance. Specify both serviceInstanceName
and
* serviceName
or neither of them.
*/
public final String serviceInstanceName() {
return serviceInstanceName;
}
/**
*
* The name of the service that serviceInstanceName
is associated with. If you don't specify this, the
* component isn't attached to any service instance. Specify both serviceInstanceName
and
* serviceName
or neither of them.
*
*
* @return The name of the service that serviceInstanceName
is associated with. If you don't specify
* this, the component isn't attached to any service instance. Specify both serviceInstanceName
* and serviceName
or neither of them.
*/
public final String serviceName() {
return serviceName;
}
/**
*
* The service spec that you want the component to use to access service inputs. Set this only when you attach the
* component to a service instance.
*
*
* @return The service spec that you want the component to use to access service inputs. Set this only when you
* attach the component to a service instance.
*/
public final String serviceSpec() {
return serviceSpec;
}
/**
* 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);
}
/**
*
* An optional list of metadata items that you can associate with the Proton component. A tag is a key-value pair.
*
*
* For more information, see Proton
* resources and tagging in the Proton User Guide.
*
*
* 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 An optional list of metadata items that you can associate with the Proton component. A tag is a key-value
* pair.
*
* For more information, see Proton resources and
* tagging in the Proton User Guide.
*/
public final List tags() {
return tags;
}
/**
*
* A path to the Infrastructure as Code (IaC) file describing infrastructure that a custom component provisions.
*
*
*
* Components support a single IaC file, even if you use Terraform as your template language.
*
*
*
* @return A path to the Infrastructure as Code (IaC) file describing infrastructure that a custom component
* provisions.
*
* Components support a single IaC file, even if you use Terraform as your template language.
*
*/
public final String templateFile() {
return templateFile;
}
@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(description());
hashCode = 31 * hashCode + Objects.hashCode(environmentName());
hashCode = 31 * hashCode + Objects.hashCode(manifest());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(serviceInstanceName());
hashCode = 31 * hashCode + Objects.hashCode(serviceName());
hashCode = 31 * hashCode + Objects.hashCode(serviceSpec());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(templateFile());
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 CreateComponentRequest)) {
return false;
}
CreateComponentRequest other = (CreateComponentRequest) obj;
return Objects.equals(clientToken(), other.clientToken()) && Objects.equals(description(), other.description())
&& Objects.equals(environmentName(), other.environmentName()) && Objects.equals(manifest(), other.manifest())
&& Objects.equals(name(), other.name()) && Objects.equals(serviceInstanceName(), other.serviceInstanceName())
&& Objects.equals(serviceName(), other.serviceName()) && Objects.equals(serviceSpec(), other.serviceSpec())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags())
&& Objects.equals(templateFile(), other.templateFile());
}
/**
* 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("CreateComponentRequest").add("ClientToken", clientToken())
.add("Description", description() == null ? null : "*** Sensitive Data Redacted ***")
.add("EnvironmentName", environmentName())
.add("Manifest", manifest() == null ? null : "*** Sensitive Data Redacted ***").add("Name", name())
.add("ServiceInstanceName", serviceInstanceName()).add("ServiceName", serviceName())
.add("ServiceSpec", serviceSpec() == null ? null : "*** Sensitive Data Redacted ***")
.add("Tags", hasTags() ? tags() : null)
.add("TemplateFile", templateFile() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "clientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "environmentName":
return Optional.ofNullable(clazz.cast(environmentName()));
case "manifest":
return Optional.ofNullable(clazz.cast(manifest()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "serviceInstanceName":
return Optional.ofNullable(clazz.cast(serviceInstanceName()));
case "serviceName":
return Optional.ofNullable(clazz.cast(serviceName()));
case "serviceSpec":
return Optional.ofNullable(clazz.cast(serviceSpec()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "templateFile":
return Optional.ofNullable(clazz.cast(templateFile()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function