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

software.amazon.awssdk.services.proton.model.CreateServiceRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Proton module holds the client classes that are used for communicating with Proton.

The 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.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.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 CreateServiceRequest extends ProtonRequest implements
        ToCopyableBuilder {
    private static final SdkField BRANCH_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("branchName").getter(getter(CreateServiceRequest::branchName)).setter(setter(Builder::branchName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("branchName").build()).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 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 REPOSITORY_CONNECTION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("repositoryConnectionArn").getter(getter(CreateServiceRequest::repositoryConnectionArn))
            .setter(setter(Builder::repositoryConnectionArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("repositoryConnectionArn").build())
            .build();

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

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

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("tags")
            .getter(getter(CreateServiceRequest::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_MAJOR_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("templateMajorVersion").getter(getter(CreateServiceRequest::templateMajorVersion))
            .setter(setter(Builder::templateMajorVersion))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("templateMajorVersion").build())
            .build();

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

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

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BRANCH_NAME_FIELD,
            DESCRIPTION_FIELD, NAME_FIELD, REPOSITORY_CONNECTION_ARN_FIELD, REPOSITORY_ID_FIELD, SPEC_FIELD, TAGS_FIELD,
            TEMPLATE_MAJOR_VERSION_FIELD, TEMPLATE_MINOR_VERSION_FIELD, TEMPLATE_NAME_FIELD));

    private final String branchName;

    private final String description;

    private final String name;

    private final String repositoryConnectionArn;

    private final String repositoryId;

    private final String spec;

    private final List tags;

    private final String templateMajorVersion;

    private final String templateMinorVersion;

    private final String templateName;

    private CreateServiceRequest(BuilderImpl builder) {
        super(builder);
        this.branchName = builder.branchName;
        this.description = builder.description;
        this.name = builder.name;
        this.repositoryConnectionArn = builder.repositoryConnectionArn;
        this.repositoryId = builder.repositoryId;
        this.spec = builder.spec;
        this.tags = builder.tags;
        this.templateMajorVersion = builder.templateMajorVersion;
        this.templateMinorVersion = builder.templateMinorVersion;
        this.templateName = builder.templateName;
    }

    /**
     * 

* The name of the code repository branch that holds the code that's deployed in Proton. Don't include this * parameter if your service template doesn't include a service pipeline. *

* * @return The name of the code repository branch that holds the code that's deployed in Proton. Don't * include this parameter if your service template doesn't include a service pipeline. */ public final String branchName() { return branchName; } /** *

* A description of the Proton service. *

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

* The service name. *

* * @return The service name. */ public final String name() { return name; } /** *

* The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. Don't include this parameter * if your service template doesn't include a service pipeline. *

* * @return The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. Don't include this * parameter if your service template doesn't include a service pipeline. */ public final String repositoryConnectionArn() { return repositoryConnectionArn; } /** *

* The ID of the code repository. Don't include this parameter if your service template doesn't * include a service pipeline. *

* * @return The ID of the code repository. Don't include this parameter if your service template * doesn't include a service pipeline. */ public final String repositoryId() { return repositoryId; } /** *

* A link to a spec file that provides inputs as defined in the service template bundle schema file. The spec file * is in YAML format. Don’t include pipeline inputs in the spec if your service template doesn’t * include a service pipeline. For more information, see Create a service in the * Proton User Guide. *

* * @return A link to a spec file that provides inputs as defined in the service template bundle schema file. The * spec file is in YAML format. Don’t include pipeline inputs in the spec if your service template * doesn’t include a service pipeline. For more information, see Create a service in the * Proton User Guide. */ public final String spec() { return spec; } /** * 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 service. 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 service. 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; } /** *

* The major version of the service template that was used to create the service. *

* * @return The major version of the service template that was used to create the service. */ public final String templateMajorVersion() { return templateMajorVersion; } /** *

* The minor version of the service template that was used to create the service. *

* * @return The minor version of the service template that was used to create the service. */ public final String templateMinorVersion() { return templateMinorVersion; } /** *

* The name of the service template that's used to create the service. *

* * @return The name of the service template that's used to create the service. */ public final String templateName() { return templateName; } @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(branchName()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(repositoryConnectionArn()); hashCode = 31 * hashCode + Objects.hashCode(repositoryId()); hashCode = 31 * hashCode + Objects.hashCode(spec()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); hashCode = 31 * hashCode + Objects.hashCode(templateMajorVersion()); hashCode = 31 * hashCode + Objects.hashCode(templateMinorVersion()); hashCode = 31 * hashCode + Objects.hashCode(templateName()); 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(branchName(), other.branchName()) && Objects.equals(description(), other.description()) && Objects.equals(name(), other.name()) && Objects.equals(repositoryConnectionArn(), other.repositoryConnectionArn()) && Objects.equals(repositoryId(), other.repositoryId()) && Objects.equals(spec(), other.spec()) && hasTags() == other.hasTags() && Objects.equals(tags(), other.tags()) && Objects.equals(templateMajorVersion(), other.templateMajorVersion()) && Objects.equals(templateMinorVersion(), other.templateMinorVersion()) && Objects.equals(templateName(), other.templateName()); } /** * 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("BranchName", branchName()) .add("Description", description() == null ? null : "*** Sensitive Data Redacted ***").add("Name", name()) .add("RepositoryConnectionArn", repositoryConnectionArn()).add("RepositoryId", repositoryId()) .add("Spec", spec() == null ? null : "*** Sensitive Data Redacted ***").add("Tags", hasTags() ? tags() : null) .add("TemplateMajorVersion", templateMajorVersion()).add("TemplateMinorVersion", templateMinorVersion()) .add("TemplateName", templateName()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "branchName": return Optional.ofNullable(clazz.cast(branchName())); case "description": return Optional.ofNullable(clazz.cast(description())); case "name": return Optional.ofNullable(clazz.cast(name())); case "repositoryConnectionArn": return Optional.ofNullable(clazz.cast(repositoryConnectionArn())); case "repositoryId": return Optional.ofNullable(clazz.cast(repositoryId())); case "spec": return Optional.ofNullable(clazz.cast(spec())); case "tags": return Optional.ofNullable(clazz.cast(tags())); case "templateMajorVersion": return Optional.ofNullable(clazz.cast(templateMajorVersion())); case "templateMinorVersion": return Optional.ofNullable(clazz.cast(templateMinorVersion())); case "templateName": return Optional.ofNullable(clazz.cast(templateName())); 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 ProtonRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the code repository branch that holds the code that's deployed in Proton. Don't include * this parameter if your service template doesn't include a service pipeline. *

* * @param branchName * The name of the code repository branch that holds the code that's deployed in Proton. Don't * include this parameter if your service template doesn't include a service pipeline. * @return Returns a reference to this object so that method calls can be chained together. */ Builder branchName(String branchName); /** *

* A description of the Proton service. *

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

* The service name. *

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

* The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. Don't include this * parameter if your service template doesn't include a service pipeline. *

* * @param repositoryConnectionArn * The Amazon Resource Name (ARN) of the repository connection. For more information, see Setting up an AWS CodeStar connection in the Proton User Guide. Don't include this * parameter if your service template doesn't include a service pipeline. * @return Returns a reference to this object so that method calls can be chained together. */ Builder repositoryConnectionArn(String repositoryConnectionArn); /** *

* The ID of the code repository. Don't include this parameter if your service template doesn't * include a service pipeline. *

* * @param repositoryId * The ID of the code repository. Don't include this parameter if your service template * doesn't include a service pipeline. * @return Returns a reference to this object so that method calls can be chained together. */ Builder repositoryId(String repositoryId); /** *

* A link to a spec file that provides inputs as defined in the service template bundle schema file. The spec * file is in YAML format. Don’t include pipeline inputs in the spec if your service template * doesn’t include a service pipeline. For more information, see Create a service in the * Proton User Guide. *

* * @param spec * A link to a spec file that provides inputs as defined in the service template bundle schema file. The * spec file is in YAML format. Don’t include pipeline inputs in the spec if your service template * doesn’t include a service pipeline. For more information, see Create a service in * the Proton User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder spec(String spec); /** *

* An optional list of metadata items that you can associate with the Proton service. A tag is a key-value pair. *

*

* For more information, see Proton * resources and tagging in the Proton User Guide. *

* * @param tags * An optional list of metadata items that you can associate with the Proton service. A tag is a * key-value pair.

*

* For more information, see Proton resources and * tagging in the Proton User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* An optional list of metadata items that you can associate with the Proton service. A tag is a key-value pair. *

*

* For more information, see Proton * resources and tagging in the Proton User Guide. *

* * @param tags * An optional list of metadata items that you can associate with the Proton service. A tag is a * key-value pair.

*

* For more information, see Proton resources and * tagging in the Proton User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* An optional list of metadata items that you can associate with the Proton service. A tag is a key-value pair. *

*

* For more information, see Proton * resources and tagging in the Proton User Guide. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.proton.model.Tag.Builder} avoiding the need to create one manually via * {@link software.amazon.awssdk.services.proton.model.Tag#builder()}. * *

* When the {@link Consumer} completes, {@link software.amazon.awssdk.services.proton.model.Tag.Builder#build()} * is called immediately and its result is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link software.amazon.awssdk.services.proton.model.Tag.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(java.util.Collection) */ Builder tags(Consumer... tags); /** *

* The major version of the service template that was used to create the service. *

* * @param templateMajorVersion * The major version of the service template that was used to create the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateMajorVersion(String templateMajorVersion); /** *

* The minor version of the service template that was used to create the service. *

* * @param templateMinorVersion * The minor version of the service template that was used to create the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateMinorVersion(String templateMinorVersion); /** *

* The name of the service template that's used to create the service. *

* * @param templateName * The name of the service template that's used to create the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder templateName(String templateName); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends ProtonRequest.BuilderImpl implements Builder { private String branchName; private String description; private String name; private String repositoryConnectionArn; private String repositoryId; private String spec; private List tags = DefaultSdkAutoConstructList.getInstance(); private String templateMajorVersion; private String templateMinorVersion; private String templateName; private BuilderImpl() { } private BuilderImpl(CreateServiceRequest model) { super(model); branchName(model.branchName); description(model.description); name(model.name); repositoryConnectionArn(model.repositoryConnectionArn); repositoryId(model.repositoryId); spec(model.spec); tags(model.tags); templateMajorVersion(model.templateMajorVersion); templateMinorVersion(model.templateMinorVersion); templateName(model.templateName); } public final String getBranchName() { return branchName; } public final void setBranchName(String branchName) { this.branchName = branchName; } @Override public final Builder branchName(String branchName) { this.branchName = branchName; 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 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 String getRepositoryConnectionArn() { return repositoryConnectionArn; } public final void setRepositoryConnectionArn(String repositoryConnectionArn) { this.repositoryConnectionArn = repositoryConnectionArn; } @Override public final Builder repositoryConnectionArn(String repositoryConnectionArn) { this.repositoryConnectionArn = repositoryConnectionArn; return this; } public final String getRepositoryId() { return repositoryId; } public final void setRepositoryId(String repositoryId) { this.repositoryId = repositoryId; } @Override public final Builder repositoryId(String repositoryId) { this.repositoryId = repositoryId; return this; } public final String getSpec() { return spec; } public final void setSpec(String spec) { this.spec = spec; } @Override public final Builder spec(String spec) { this.spec = spec; return this; } public final List getTags() { List result = TagListCopier.copyToBuilder(this.tags); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.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; } public final String getTemplateMajorVersion() { return templateMajorVersion; } public final void setTemplateMajorVersion(String templateMajorVersion) { this.templateMajorVersion = templateMajorVersion; } @Override public final Builder templateMajorVersion(String templateMajorVersion) { this.templateMajorVersion = templateMajorVersion; return this; } public final String getTemplateMinorVersion() { return templateMinorVersion; } public final void setTemplateMinorVersion(String templateMinorVersion) { this.templateMinorVersion = templateMinorVersion; } @Override public final Builder templateMinorVersion(String templateMinorVersion) { this.templateMinorVersion = templateMinorVersion; return this; } public final String getTemplateName() { return templateName; } public final void setTemplateName(String templateName) { this.templateName = templateName; } @Override public final Builder templateName(String templateName) { this.templateName = templateName; 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 - 2024 Weber Informatics LLC | Privacy Policy