software.amazon.awssdk.services.opsworks.model.Source Maven / Gradle / Ivy
Show all versions of opsworks 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.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, AWS 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, AWS OpsWorks Stacks returns *****FILTERED*****
instead of the actual value.
*/
public final String password() {
return password;
}
/**
*
* In requests, the repository's SSH key.
*
*
* In responses, AWS OpsWorks Stacks returns *****FILTERED*****
instead of the actual value.
*
*
* @return In requests, the repository's SSH key.
*
* In responses, AWS OpsWorks Stacks returns *****FILTERED*****
instead of the actual value.
*/
public final String sshKey() {
return sshKey;
}
/**
*
* The application's version. AWS 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. AWS 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 extends Builder> 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