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

software.amazon.awssdk.services.migrationhubrefactorspaces.model.CreateServiceRequest 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.migrationhubrefactorspaces.model;

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.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.DefaultValueTrait;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class CreateServiceRequest extends MigrationHubRefactorSpacesRequest implements
        ToCopyableBuilder {
    private static final SdkField APPLICATION_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ApplicationIdentifier").getter(getter(CreateServiceRequest::applicationIdentifier))
            .setter(setter(Builder::applicationIdentifier))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("ApplicationIdentifier").build())
            .build();

    private static final SdkField CLIENT_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("ClientToken")
            .getter(getter(CreateServiceRequest::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(CreateServiceRequest::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();

    private static final SdkField ENDPOINT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("EndpointType").getter(getter(CreateServiceRequest::endpointTypeAsString))
            .setter(setter(Builder::endpointType))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointType").build()).build();

    private static final SdkField ENVIRONMENT_IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("EnvironmentIdentifier").getter(getter(CreateServiceRequest::environmentIdentifier))
            .setter(setter(Builder::environmentIdentifier))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("EnvironmentIdentifier").build())
            .build();

    private static final SdkField LAMBDA_ENDPOINT_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("LambdaEndpoint")
            .getter(getter(CreateServiceRequest::lambdaEndpoint)).setter(setter(Builder::lambdaEndpoint))
            .constructor(LambdaEndpointInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LambdaEndpoint").build()).build();

    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
            .getter(getter(CreateServiceRequest::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(CreateServiceRequest::tags))
            .setter(setter(Builder::tags))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").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 URL_ENDPOINT_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("UrlEndpoint")
            .getter(getter(CreateServiceRequest::urlEndpoint)).setter(setter(Builder::urlEndpoint))
            .constructor(UrlEndpointInput::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UrlEndpoint").build()).build();

    private static final SdkField VPC_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("VpcId")
            .getter(getter(CreateServiceRequest::vpcId)).setter(setter(Builder::vpcId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcId").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_IDENTIFIER_FIELD,
            CLIENT_TOKEN_FIELD, DESCRIPTION_FIELD, ENDPOINT_TYPE_FIELD, ENVIRONMENT_IDENTIFIER_FIELD, LAMBDA_ENDPOINT_FIELD,
            NAME_FIELD, TAGS_FIELD, URL_ENDPOINT_FIELD, VPC_ID_FIELD));

    private final String applicationIdentifier;

    private final String clientToken;

    private final String description;

    private final String endpointType;

    private final String environmentIdentifier;

    private final LambdaEndpointInput lambdaEndpoint;

    private final String name;

    private final Map tags;

    private final UrlEndpointInput urlEndpoint;

    private final String vpcId;

    private CreateServiceRequest(BuilderImpl builder) {
        super(builder);
        this.applicationIdentifier = builder.applicationIdentifier;
        this.clientToken = builder.clientToken;
        this.description = builder.description;
        this.endpointType = builder.endpointType;
        this.environmentIdentifier = builder.environmentIdentifier;
        this.lambdaEndpoint = builder.lambdaEndpoint;
        this.name = builder.name;
        this.tags = builder.tags;
        this.urlEndpoint = builder.urlEndpoint;
        this.vpcId = builder.vpcId;
    }

    /**
     * 

* The ID of the application which the service is created. *

* * @return The ID of the application which the service is created. */ public final String applicationIdentifier() { return applicationIdentifier; } /** *

* A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. *

* * @return A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. */ public final String clientToken() { return clientToken; } /** *

* The description of the service. *

* * @return The description of the service. */ public final String description() { return description; } /** *

* The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #endpointType} will * return {@link ServiceEndpointType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #endpointTypeAsString}. *

* * @return The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. * @see ServiceEndpointType */ public final ServiceEndpointType endpointType() { return ServiceEndpointType.fromValue(endpointType); } /** *

* The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #endpointType} will * return {@link ServiceEndpointType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #endpointTypeAsString}. *

* * @return The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. * @see ServiceEndpointType */ public final String endpointTypeAsString() { return endpointType; } /** *

* The ID of the environment in which the service is created. *

* * @return The ID of the environment in which the service is created. */ public final String environmentIdentifier() { return environmentIdentifier; } /** *

* The configuration for the Lambda endpoint type. *

* * @return The configuration for the Lambda endpoint type. */ public final LambdaEndpointInput lambdaEndpoint() { return lambdaEndpoint; } /** *

* The name of the service. *

* * @return The name of the service. */ public final String name() { return name; } /** * 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 SdkAutoConstructMap); } /** *

* The tags to assign to the service. A tag is a label that you assign to an Amazon Web Services resource. Each tag * consists of a key-value pair.. *

*

* 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 The tags to assign to the service. A tag is a label that you assign to an Amazon Web Services resource. * Each tag consists of a key-value pair.. */ public final Map tags() { return tags; } /** *

* The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces automatically * resolves the address in the UrlEndpointInput object URL when the Domain Name System (DNS) * time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. *

* * @return The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces * automatically resolves the address in the UrlEndpointInput object URL when the Domain Name * System (DNS) time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. */ public final UrlEndpointInput urlEndpoint() { return urlEndpoint; } /** *

* The ID of the VPC. *

* * @return The ID of the VPC. */ public final String vpcId() { return vpcId; } @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(applicationIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(clientToken()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(endpointTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(environmentIdentifier()); hashCode = 31 * hashCode + Objects.hashCode(lambdaEndpoint()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(urlEndpoint()); hashCode = 31 * hashCode + Objects.hashCode(vpcId()); 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 CreateServiceRequest)) { return false; } CreateServiceRequest other = (CreateServiceRequest) obj; return Objects.equals(applicationIdentifier(), other.applicationIdentifier()) && Objects.equals(clientToken(), other.clientToken()) && Objects.equals(description(), other.description()) && Objects.equals(endpointTypeAsString(), other.endpointTypeAsString()) && Objects.equals(environmentIdentifier(), other.environmentIdentifier()) && Objects.equals(lambdaEndpoint(), other.lambdaEndpoint()) && Objects.equals(name(), other.name()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(urlEndpoint(), other.urlEndpoint()) && Objects.equals(vpcId(), other.vpcId()); } /** * 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("CreateServiceRequest").add("ApplicationIdentifier", applicationIdentifier()) .add("ClientToken", clientToken()).add("Description", description()).add("EndpointType", endpointTypeAsString()) .add("EnvironmentIdentifier", environmentIdentifier()).add("LambdaEndpoint", lambdaEndpoint()) .add("Name", name()).add("Tags", tags() == null ? null : "*** Sensitive Data Redacted ***") .add("UrlEndpoint", urlEndpoint()).add("VpcId", vpcId()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ApplicationIdentifier": return Optional.ofNullable(clazz.cast(applicationIdentifier())); case "ClientToken": return Optional.ofNullable(clazz.cast(clientToken())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "EndpointType": return Optional.ofNullable(clazz.cast(endpointTypeAsString())); case "EnvironmentIdentifier": return Optional.ofNullable(clazz.cast(environmentIdentifier())); case "LambdaEndpoint": return Optional.ofNullable(clazz.cast(lambdaEndpoint())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); case "UrlEndpoint": return Optional.ofNullable(clazz.cast(urlEndpoint())); case "VpcId": return Optional.ofNullable(clazz.cast(vpcId())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CreateServiceRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends MigrationHubRefactorSpacesRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the application which the service is created. *

* * @param applicationIdentifier * The ID of the application which the service is created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder applicationIdentifier(String applicationIdentifier); /** *

* A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. *

* * @param clientToken * A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clientToken(String clientToken); /** *

* The description of the service. *

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

* The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. *

* * @param endpointType * The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. * @see ServiceEndpointType * @return Returns a reference to this object so that method calls can be chained together. * @see ServiceEndpointType */ Builder endpointType(String endpointType); /** *

* The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. *

* * @param endpointType * The type of endpoint to use for the service. The type can be a URL in a VPC or an Lambda function. * @see ServiceEndpointType * @return Returns a reference to this object so that method calls can be chained together. * @see ServiceEndpointType */ Builder endpointType(ServiceEndpointType endpointType); /** *

* The ID of the environment in which the service is created. *

* * @param environmentIdentifier * The ID of the environment in which the service is created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environmentIdentifier(String environmentIdentifier); /** *

* The configuration for the Lambda endpoint type. *

* * @param lambdaEndpoint * The configuration for the Lambda endpoint type. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lambdaEndpoint(LambdaEndpointInput lambdaEndpoint); /** *

* The configuration for the Lambda endpoint type. *

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

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

* The name of the service. *

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

* The tags to assign to the service. A tag is a label that you assign to an Amazon Web Services resource. Each * tag consists of a key-value pair.. *

* * @param tags * The tags to assign to the service. A tag is a label that you assign to an Amazon Web Services * resource. Each tag consists of a key-value pair.. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); /** *

* The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces * automatically resolves the address in the UrlEndpointInput object URL when the Domain Name * System (DNS) time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. *

* * @param urlEndpoint * The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces * automatically resolves the address in the UrlEndpointInput object URL when the Domain * Name System (DNS) time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder urlEndpoint(UrlEndpointInput urlEndpoint); /** *

* The configuration for the URL endpoint type. When creating a route to a service, Refactor Spaces * automatically resolves the address in the UrlEndpointInput object URL when the Domain Name * System (DNS) time-to-live (TTL) expires, or every 60 seconds for TTLs less than 60 seconds. *

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

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

* The ID of the VPC. *

* * @param vpcId * The ID of the VPC. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcId(String vpcId); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends MigrationHubRefactorSpacesRequest.BuilderImpl implements Builder { private String applicationIdentifier; private String clientToken; private String description; private String endpointType; private String environmentIdentifier; private LambdaEndpointInput lambdaEndpoint; private String name; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private UrlEndpointInput urlEndpoint; private String vpcId; private BuilderImpl() { } private BuilderImpl(CreateServiceRequest model) { super(model); applicationIdentifier(model.applicationIdentifier); clientToken(model.clientToken); description(model.description); endpointType(model.endpointType); environmentIdentifier(model.environmentIdentifier); lambdaEndpoint(model.lambdaEndpoint); name(model.name); tags(model.tags); urlEndpoint(model.urlEndpoint); vpcId(model.vpcId); } public final String getApplicationIdentifier() { return applicationIdentifier; } public final void setApplicationIdentifier(String applicationIdentifier) { this.applicationIdentifier = applicationIdentifier; } @Override public final Builder applicationIdentifier(String applicationIdentifier) { this.applicationIdentifier = applicationIdentifier; return this; } public final String getClientToken() { return clientToken; } public final void setClientToken(String clientToken) { this.clientToken = clientToken; } @Override public final Builder clientToken(String clientToken) { this.clientToken = clientToken; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getEndpointType() { return endpointType; } public final void setEndpointType(String endpointType) { this.endpointType = endpointType; } @Override public final Builder endpointType(String endpointType) { this.endpointType = endpointType; return this; } @Override public final Builder endpointType(ServiceEndpointType endpointType) { this.endpointType(endpointType == null ? null : endpointType.toString()); return this; } public final String getEnvironmentIdentifier() { return environmentIdentifier; } public final void setEnvironmentIdentifier(String environmentIdentifier) { this.environmentIdentifier = environmentIdentifier; } @Override public final Builder environmentIdentifier(String environmentIdentifier) { this.environmentIdentifier = environmentIdentifier; return this; } public final LambdaEndpointInput.Builder getLambdaEndpoint() { return lambdaEndpoint != null ? lambdaEndpoint.toBuilder() : null; } public final void setLambdaEndpoint(LambdaEndpointInput.BuilderImpl lambdaEndpoint) { this.lambdaEndpoint = lambdaEndpoint != null ? lambdaEndpoint.build() : null; } @Override public final Builder lambdaEndpoint(LambdaEndpointInput lambdaEndpoint) { this.lambdaEndpoint = lambdaEndpoint; return this; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final UrlEndpointInput.Builder getUrlEndpoint() { return urlEndpoint != null ? urlEndpoint.toBuilder() : null; } public final void setUrlEndpoint(UrlEndpointInput.BuilderImpl urlEndpoint) { this.urlEndpoint = urlEndpoint != null ? urlEndpoint.build() : null; } @Override public final Builder urlEndpoint(UrlEndpointInput urlEndpoint) { this.urlEndpoint = urlEndpoint; return this; } public final String getVpcId() { return vpcId; } public final void setVpcId(String vpcId) { this.vpcId = vpcId; } @Override public final Builder vpcId(String vpcId) { this.vpcId = vpcId; 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 CreateServiceRequest build() { return new CreateServiceRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy