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

software.amazon.awssdk.services.codebuild.model.SourceCredentialsInfo Maven / Gradle / Ivy

Go to download

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

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.codebuild.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.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;

/**
 * 

* Information about the credentials for a GitHub, GitHub Enterprise, GitLab, GitLab Self Managed, or Bitbucket * repository. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SourceCredentialsInfo implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn") .getter(getter(SourceCredentialsInfo::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build(); private static final SdkField SERVER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("serverType").getter(getter(SourceCredentialsInfo::serverTypeAsString)) .setter(setter(Builder::serverType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverType").build()).build(); private static final SdkField AUTH_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("authType").getter(getter(SourceCredentialsInfo::authTypeAsString)).setter(setter(Builder::authType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("authType").build()).build(); private static final SdkField RESOURCE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("resource").getter(getter(SourceCredentialsInfo::resource)).setter(setter(Builder::resource)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resource").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, SERVER_TYPE_FIELD, AUTH_TYPE_FIELD, RESOURCE_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String arn; private final String serverType; private final String authType; private final String resource; private SourceCredentialsInfo(BuilderImpl builder) { this.arn = builder.arn; this.serverType = builder.serverType; this.authType = builder.authType; this.resource = builder.resource; } /** *

* The Amazon Resource Name (ARN) of the token. *

* * @return The Amazon Resource Name (ARN) of the token. */ public final String arn() { return arn; } /** *

* The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, GITLAB_SELF_MANAGED, or * BITBUCKET. *

*

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

* * @return The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, * GITLAB_SELF_MANAGED, or BITBUCKET. * @see ServerType */ public final ServerType serverType() { return ServerType.fromValue(serverType); } /** *

* The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, GITLAB_SELF_MANAGED, or * BITBUCKET. *

*

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

* * @return The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, * GITLAB_SELF_MANAGED, or BITBUCKET. * @see ServerType */ public final String serverTypeAsString() { return serverType; } /** *

* The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, PERSONAL_ACCESS_TOKEN, * CODECONNECTIONS, or SECRETS_MANAGER. *

*

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

* * @return The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. * @see AuthType */ public final AuthType authType() { return AuthType.fromValue(authType); } /** *

* The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, PERSONAL_ACCESS_TOKEN, * CODECONNECTIONS, or SECRETS_MANAGER. *

*

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

* * @return The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. * @see AuthType */ public final String authTypeAsString() { return authType; } /** *

* The connection ARN if your authType is CODECONNECTIONS or SECRETS_MANAGER. *

* * @return The connection ARN if your authType is CODECONNECTIONS or SECRETS_MANAGER. */ public final String resource() { return resource; } @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(arn()); hashCode = 31 * hashCode + Objects.hashCode(serverTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(authTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(resource()); 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 SourceCredentialsInfo)) { return false; } SourceCredentialsInfo other = (SourceCredentialsInfo) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(serverTypeAsString(), other.serverTypeAsString()) && Objects.equals(authTypeAsString(), other.authTypeAsString()) && Objects.equals(resource(), other.resource()); } /** * 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("SourceCredentialsInfo").add("Arn", arn()).add("ServerType", serverTypeAsString()) .add("AuthType", authTypeAsString()).add("Resource", resource()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "arn": return Optional.ofNullable(clazz.cast(arn())); case "serverType": return Optional.ofNullable(clazz.cast(serverTypeAsString())); case "authType": return Optional.ofNullable(clazz.cast(authTypeAsString())); case "resource": return Optional.ofNullable(clazz.cast(resource())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("arn", ARN_FIELD); map.put("serverType", SERVER_TYPE_FIELD); map.put("authType", AUTH_TYPE_FIELD); map.put("resource", RESOURCE_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((SourceCredentialsInfo) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of the token. *

* * @param arn * The Amazon Resource Name (ARN) of the token. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, GITLAB_SELF_MANAGED, or * BITBUCKET. *

* * @param serverType * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, * GITLAB_SELF_MANAGED, or BITBUCKET. * @see ServerType * @return Returns a reference to this object so that method calls can be chained together. * @see ServerType */ Builder serverType(String serverType); /** *

* The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, GITLAB_SELF_MANAGED, or * BITBUCKET. *

* * @param serverType * The type of source provider. The valid options are GITHUB, GITHUB_ENTERPRISE, GITLAB, * GITLAB_SELF_MANAGED, or BITBUCKET. * @see ServerType * @return Returns a reference to this object so that method calls can be chained together. * @see ServerType */ Builder serverType(ServerType serverType); /** *

* The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. *

* * @param authType * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. * @see AuthType * @return Returns a reference to this object so that method calls can be chained together. * @see AuthType */ Builder authType(String authType); /** *

* The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. *

* * @param authType * The type of authentication used by the credentials. Valid options are OAUTH, BASIC_AUTH, * PERSONAL_ACCESS_TOKEN, CODECONNECTIONS, or SECRETS_MANAGER. * @see AuthType * @return Returns a reference to this object so that method calls can be chained together. * @see AuthType */ Builder authType(AuthType authType); /** *

* The connection ARN if your authType is CODECONNECTIONS or SECRETS_MANAGER. *

* * @param resource * The connection ARN if your authType is CODECONNECTIONS or SECRETS_MANAGER. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resource(String resource); } static final class BuilderImpl implements Builder { private String arn; private String serverType; private String authType; private String resource; private BuilderImpl() { } private BuilderImpl(SourceCredentialsInfo model) { arn(model.arn); serverType(model.serverType); authType(model.authType); resource(model.resource); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getServerType() { return serverType; } public final void setServerType(String serverType) { this.serverType = serverType; } @Override public final Builder serverType(String serverType) { this.serverType = serverType; return this; } @Override public final Builder serverType(ServerType serverType) { this.serverType(serverType == null ? null : serverType.toString()); return this; } public final String getAuthType() { return authType; } public final void setAuthType(String authType) { this.authType = authType; } @Override public final Builder authType(String authType) { this.authType = authType; return this; } @Override public final Builder authType(AuthType authType) { this.authType(authType == null ? null : authType.toString()); return this; } public final String getResource() { return resource; } public final void setResource(String resource) { this.resource = resource; } @Override public final Builder resource(String resource) { this.resource = resource; return this; } @Override public SourceCredentialsInfo build() { return new SourceCredentialsInfo(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy