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

software.amazon.awssdk.services.opsworks.model.Source Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS OpsWorks module holds the client classes that are used for communicating with AWS OpsWorks Service

There is a newer version: 2.28.4
Show 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.opsworks.model;

import java.io.Serializable;
import java.util.Arrays;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Source implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type") .getter(getter(Source::typeAsString)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build(); private static final SdkField URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Url") .getter(getter(Source::url)).setter(setter(Builder::url)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Url").build()).build(); private static final SdkField USERNAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Username").getter(getter(Source::username)).setter(setter(Builder::username)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Username").build()).build(); private static final SdkField PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Password").getter(getter(Source::password)).setter(setter(Builder::password)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build(); private static final SdkField SSH_KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("SshKey") .getter(getter(Source::sshKey)).setter(setter(Builder::sshKey)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SshKey").build()).build(); private static final SdkField REVISION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Revision").getter(getter(Source::revision)).setter(setter(Builder::revision)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Revision").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TYPE_FIELD, URL_FIELD, USERNAME_FIELD, PASSWORD_FIELD, SSH_KEY_FIELD, REVISION_FIELD)); private static final long serialVersionUID = 1L; private final String type; private final String url; private final String username; private final String password; private final String sshKey; private final String revision; private Source(BuilderImpl builder) { this.type = builder.type; this.url = builder.url; this.username = builder.username; this.password = builder.password; this.sshKey = builder.sshKey; this.revision = builder.revision; } /** *

* The repository type. *

*

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

* * @return The repository type. * @see SourceType */ public final SourceType type() { return SourceType.fromValue(type); } /** *

* The repository type. *

*

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

* * @return The repository type. * @see SourceType */ public final String typeAsString() { return type; } /** *

* The source URL. The following is an example of an Amazon S3 source URL: * https://s3.amazonaws.com/opsworks-demo-bucket/opsworks_cookbook_demo.tar.gz. *

* * @return The source URL. The following is an example of an Amazon S3 source URL: * https://s3.amazonaws.com/opsworks-demo-bucket/opsworks_cookbook_demo.tar.gz. */ public final String url() { return url; } /** *

* This parameter depends on the repository type. *

*
    *
  • *

    * For Amazon S3 bundles, set Username to the appropriate IAM access key ID. *

    *
  • *
  • *

    * For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name. *

    *
  • *
* * @return This parameter depends on the repository type.

*
    *
  • *

    * For Amazon S3 bundles, set Username to the appropriate IAM access key ID. *

    *
  • *
  • *

    * For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user * name. *

    *
  • */ public final String username() { return username; } /** *

    * When included in a request, the parameter depends on the repository type. *

    *
      *
    • *

      * For Amazon S3 bundles, set Password to the appropriate IAM secret access key. *

      *
    • *
    • *

      * For HTTP bundles and Subversion repositories, set Password to the password. *

      *
    • *
    *

    * For more information on how to safely handle IAM credentials, see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html. *

    *

    * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. *

    * * @return When included in a request, the parameter depends on the repository type.

    *
      *
    • *

      * For Amazon S3 bundles, set Password to the appropriate IAM secret access key. *

      *
    • *
    • *

      * For HTTP bundles and Subversion repositories, set Password to the password. *

      *
    • *
    *

    * For more information on how to safely handle IAM credentials, see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html. *

    *

    * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. */ public final String password() { return password; } /** *

    * In requests, the repository's SSH key. *

    *

    * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. *

    * * @return In requests, the repository's SSH key.

    *

    * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. */ public final String sshKey() { return sshKey; } /** *

    * The application's version. OpsWorks Stacks enables you to easily deploy new versions of an application. One of * the simplest approaches is to have branches or revisions in your repository that represent different versions * that can potentially be deployed. *

    * * @return The application's version. OpsWorks Stacks enables you to easily deploy new versions of an application. * One of the simplest approaches is to have branches or revisions in your repository that represent * different versions that can potentially be deployed. */ public final String revision() { return revision; } @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 + Objects.hashCode(typeAsString()); hashCode = 31 * hashCode + Objects.hashCode(url()); hashCode = 31 * hashCode + Objects.hashCode(username()); hashCode = 31 * hashCode + Objects.hashCode(password()); hashCode = 31 * hashCode + Objects.hashCode(sshKey()); hashCode = 31 * hashCode + Objects.hashCode(revision()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Source)) { return false; } Source other = (Source) obj; return Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(url(), other.url()) && Objects.equals(username(), other.username()) && Objects.equals(password(), other.password()) && Objects.equals(sshKey(), other.sshKey()) && Objects.equals(revision(), other.revision()); } /** * 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("Source").add("Type", typeAsString()).add("Url", url()).add("Username", username()) .add("Password", password()).add("SshKey", sshKey()).add("Revision", revision()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Type": return Optional.ofNullable(clazz.cast(typeAsString())); case "Url": return Optional.ofNullable(clazz.cast(url())); case "Username": return Optional.ofNullable(clazz.cast(username())); case "Password": return Optional.ofNullable(clazz.cast(password())); case "SshKey": return Optional.ofNullable(clazz.cast(sshKey())); case "Revision": return Optional.ofNullable(clazz.cast(revision())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Source) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * The repository type. *

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

    * The repository type. *

    * * @param type * The repository type. * @see SourceType * @return Returns a reference to this object so that method calls can be chained together. * @see SourceType */ Builder type(SourceType type); /** *

    * The source URL. The following is an example of an Amazon S3 source URL: * https://s3.amazonaws.com/opsworks-demo-bucket/opsworks_cookbook_demo.tar.gz. *

    * * @param url * The source URL. The following is an example of an Amazon S3 source URL: * https://s3.amazonaws.com/opsworks-demo-bucket/opsworks_cookbook_demo.tar.gz. * @return Returns a reference to this object so that method calls can be chained together. */ Builder url(String url); /** *

    * This parameter depends on the repository type. *

    *
      *
    • *

      * For Amazon S3 bundles, set Username to the appropriate IAM access key ID. *

      *
    • *
    • *

      * For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name. *

      *
    • *
    * * @param username * This parameter depends on the repository type.

    *
      *
    • *

      * For Amazon S3 bundles, set Username to the appropriate IAM access key ID. *

      *
    • *
    • *

      * For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user * name. *

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

      * When included in a request, the parameter depends on the repository type. *

      *
        *
      • *

        * For Amazon S3 bundles, set Password to the appropriate IAM secret access key. *

        *
      • *
      • *

        * For HTTP bundles and Subversion repositories, set Password to the password. *

        *
      • *
      *

      * For more information on how to safely handle IAM credentials, see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html. *

      *

      * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. *

      * * @param password * When included in a request, the parameter depends on the repository type.

      *
        *
      • *

        * For Amazon S3 bundles, set Password to the appropriate IAM secret access key. *

        *
      • *
      • *

        * For HTTP bundles and Subversion repositories, set Password to the password. *

        *
      • *
      *

      * For more information on how to safely handle IAM credentials, see https://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html. *

      *

      * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder password(String password); /** *

      * In requests, the repository's SSH key. *

      *

      * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. *

      * * @param sshKey * In requests, the repository's SSH key.

      *

      * In responses, OpsWorks Stacks returns *****FILTERED***** instead of the actual value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sshKey(String sshKey); /** *

      * The application's version. OpsWorks Stacks enables you to easily deploy new versions of an application. One * of the simplest approaches is to have branches or revisions in your repository that represent different * versions that can potentially be deployed. *

      * * @param revision * The application's version. OpsWorks Stacks enables you to easily deploy new versions of an * application. One of the simplest approaches is to have branches or revisions in your repository that * represent different versions that can potentially be deployed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder revision(String revision); } static final class BuilderImpl implements Builder { private String type; private String url; private String username; private String password; private String sshKey; private String revision; private BuilderImpl() { } private BuilderImpl(Source model) { type(model.type); url(model.url); username(model.username); password(model.password); sshKey(model.sshKey); revision(model.revision); } public final String getType() { return type; } public final void setType(String type) { this.type = type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(SourceType type) { this.type(type == null ? null : type.toString()); return this; } public final String getUrl() { return url; } public final void setUrl(String url) { this.url = url; } @Override public final Builder url(String url) { this.url = url; return this; } public final String getUsername() { return username; } public final void setUsername(String username) { this.username = username; } @Override public final Builder username(String username) { this.username = username; return this; } public final String getPassword() { return password; } public final void setPassword(String password) { this.password = password; } @Override public final Builder password(String password) { this.password = password; return this; } public final String getSshKey() { return sshKey; } public final void setSshKey(String sshKey) { this.sshKey = sshKey; } @Override public final Builder sshKey(String sshKey) { this.sshKey = sshKey; return this; } public final String getRevision() { return revision; } public final void setRevision(String revision) { this.revision = revision; } @Override public final Builder revision(String revision) { this.revision = revision; return this; } @Override public Source build() { return new Source(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy