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

software.amazon.awssdk.services.glue.model.OAuth2Properties Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.glue.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.Consumer;
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.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;

/**
 * 

* A structure containing properties for OAuth2 authentication. *

*/ @Generated("software.amazon.awssdk:codegen") public final class OAuth2Properties implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField O_AUTH2_GRANT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("OAuth2GrantType").getter(getter(OAuth2Properties::oAuth2GrantTypeAsString)) .setter(setter(Builder::oAuth2GrantType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OAuth2GrantType").build()).build(); private static final SdkField O_AUTH2_CLIENT_APPLICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("OAuth2ClientApplication") .getter(getter(OAuth2Properties::oAuth2ClientApplication)).setter(setter(Builder::oAuth2ClientApplication)) .constructor(OAuth2ClientApplication::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OAuth2ClientApplication").build()) .build(); private static final SdkField TOKEN_URL_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TokenUrl").getter(getter(OAuth2Properties::tokenUrl)).setter(setter(Builder::tokenUrl)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TokenUrl").build()).build(); private static final SdkField> TOKEN_URL_PARAMETERS_MAP_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("TokenUrlParametersMap") .getter(getter(OAuth2Properties::tokenUrlParametersMap)) .setter(setter(Builder::tokenUrlParametersMap)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TokenUrlParametersMap").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(O_AUTH2_GRANT_TYPE_FIELD, O_AUTH2_CLIENT_APPLICATION_FIELD, TOKEN_URL_FIELD, TOKEN_URL_PARAMETERS_MAP_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String oAuth2GrantType; private final OAuth2ClientApplication oAuth2ClientApplication; private final String tokenUrl; private final Map tokenUrlParametersMap; private OAuth2Properties(BuilderImpl builder) { this.oAuth2GrantType = builder.oAuth2GrantType; this.oAuth2ClientApplication = builder.oAuth2ClientApplication; this.tokenUrl = builder.tokenUrl; this.tokenUrlParametersMap = builder.tokenUrlParametersMap; } /** *

* The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. *

*

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

* * @return The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. * @see OAuth2GrantType */ public final OAuth2GrantType oAuth2GrantType() { return OAuth2GrantType.fromValue(oAuth2GrantType); } /** *

* The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. *

*

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

* * @return The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. * @see OAuth2GrantType */ public final String oAuth2GrantTypeAsString() { return oAuth2GrantType; } /** *

* The client application type. For example, AWS_MANAGED or USER_MANAGED. *

* * @return The client application type. For example, AWS_MANAGED or USER_MANAGED. */ public final OAuth2ClientApplication oAuth2ClientApplication() { return oAuth2ClientApplication; } /** *

* The URL of the provider's authentication server, to exchange an authorization code for an access token. *

* * @return The URL of the provider's authentication server, to exchange an authorization code for an access token. */ public final String tokenUrl() { return tokenUrl; } /** * For responses, this returns true if the service returned a value for the TokenUrlParametersMap 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 hasTokenUrlParametersMap() { return tokenUrlParametersMap != null && !(tokenUrlParametersMap instanceof SdkAutoConstructMap); } /** *

* A map of parameters that are added to the token GET request. *

*

* 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 #hasTokenUrlParametersMap} method. *

* * @return A map of parameters that are added to the token GET request. */ public final Map tokenUrlParametersMap() { return tokenUrlParametersMap; } @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(oAuth2GrantTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(oAuth2ClientApplication()); hashCode = 31 * hashCode + Objects.hashCode(tokenUrl()); hashCode = 31 * hashCode + Objects.hashCode(hasTokenUrlParametersMap() ? tokenUrlParametersMap() : null); 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 OAuth2Properties)) { return false; } OAuth2Properties other = (OAuth2Properties) obj; return Objects.equals(oAuth2GrantTypeAsString(), other.oAuth2GrantTypeAsString()) && Objects.equals(oAuth2ClientApplication(), other.oAuth2ClientApplication()) && Objects.equals(tokenUrl(), other.tokenUrl()) && hasTokenUrlParametersMap() == other.hasTokenUrlParametersMap() && Objects.equals(tokenUrlParametersMap(), other.tokenUrlParametersMap()); } /** * 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("OAuth2Properties").add("OAuth2GrantType", oAuth2GrantTypeAsString()) .add("OAuth2ClientApplication", oAuth2ClientApplication()).add("TokenUrl", tokenUrl()) .add("TokenUrlParametersMap", hasTokenUrlParametersMap() ? tokenUrlParametersMap() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "OAuth2GrantType": return Optional.ofNullable(clazz.cast(oAuth2GrantTypeAsString())); case "OAuth2ClientApplication": return Optional.ofNullable(clazz.cast(oAuth2ClientApplication())); case "TokenUrl": return Optional.ofNullable(clazz.cast(tokenUrl())); case "TokenUrlParametersMap": return Optional.ofNullable(clazz.cast(tokenUrlParametersMap())); 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("OAuth2GrantType", O_AUTH2_GRANT_TYPE_FIELD); map.put("OAuth2ClientApplication", O_AUTH2_CLIENT_APPLICATION_FIELD); map.put("TokenUrl", TOKEN_URL_FIELD); map.put("TokenUrlParametersMap", TOKEN_URL_PARAMETERS_MAP_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((OAuth2Properties) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. *

* * @param oAuth2GrantType * The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. * @see OAuth2GrantType * @return Returns a reference to this object so that method calls can be chained together. * @see OAuth2GrantType */ Builder oAuth2GrantType(String oAuth2GrantType); /** *

* The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. *

* * @param oAuth2GrantType * The OAuth2 grant type. For example, AUTHORIZATION_CODE, JWT_BEARER, or * CLIENT_CREDENTIALS. * @see OAuth2GrantType * @return Returns a reference to this object so that method calls can be chained together. * @see OAuth2GrantType */ Builder oAuth2GrantType(OAuth2GrantType oAuth2GrantType); /** *

* The client application type. For example, AWS_MANAGED or USER_MANAGED. *

* * @param oAuth2ClientApplication * The client application type. For example, AWS_MANAGED or USER_MANAGED. * @return Returns a reference to this object so that method calls can be chained together. */ Builder oAuth2ClientApplication(OAuth2ClientApplication oAuth2ClientApplication); /** *

* The client application type. For example, AWS_MANAGED or USER_MANAGED. *

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

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

* The URL of the provider's authentication server, to exchange an authorization code for an access token. *

* * @param tokenUrl * The URL of the provider's authentication server, to exchange an authorization code for an access * token. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tokenUrl(String tokenUrl); /** *

* A map of parameters that are added to the token GET request. *

* * @param tokenUrlParametersMap * A map of parameters that are added to the token GET request. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tokenUrlParametersMap(Map tokenUrlParametersMap); } static final class BuilderImpl implements Builder { private String oAuth2GrantType; private OAuth2ClientApplication oAuth2ClientApplication; private String tokenUrl; private Map tokenUrlParametersMap = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(OAuth2Properties model) { oAuth2GrantType(model.oAuth2GrantType); oAuth2ClientApplication(model.oAuth2ClientApplication); tokenUrl(model.tokenUrl); tokenUrlParametersMap(model.tokenUrlParametersMap); } public final String getOAuth2GrantType() { return oAuth2GrantType; } public final void setOAuth2GrantType(String oAuth2GrantType) { this.oAuth2GrantType = oAuth2GrantType; } @Override public final Builder oAuth2GrantType(String oAuth2GrantType) { this.oAuth2GrantType = oAuth2GrantType; return this; } @Override public final Builder oAuth2GrantType(OAuth2GrantType oAuth2GrantType) { this.oAuth2GrantType(oAuth2GrantType == null ? null : oAuth2GrantType.toString()); return this; } public final OAuth2ClientApplication.Builder getOAuth2ClientApplication() { return oAuth2ClientApplication != null ? oAuth2ClientApplication.toBuilder() : null; } public final void setOAuth2ClientApplication(OAuth2ClientApplication.BuilderImpl oAuth2ClientApplication) { this.oAuth2ClientApplication = oAuth2ClientApplication != null ? oAuth2ClientApplication.build() : null; } @Override public final Builder oAuth2ClientApplication(OAuth2ClientApplication oAuth2ClientApplication) { this.oAuth2ClientApplication = oAuth2ClientApplication; return this; } public final String getTokenUrl() { return tokenUrl; } public final void setTokenUrl(String tokenUrl) { this.tokenUrl = tokenUrl; } @Override public final Builder tokenUrl(String tokenUrl) { this.tokenUrl = tokenUrl; return this; } public final Map getTokenUrlParametersMap() { if (tokenUrlParametersMap instanceof SdkAutoConstructMap) { return null; } return tokenUrlParametersMap; } public final void setTokenUrlParametersMap(Map tokenUrlParametersMap) { this.tokenUrlParametersMap = TokenUrlParametersMapCopier.copy(tokenUrlParametersMap); } @Override public final Builder tokenUrlParametersMap(Map tokenUrlParametersMap) { this.tokenUrlParametersMap = TokenUrlParametersMapCopier.copy(tokenUrlParametersMap); return this; } @Override public OAuth2Properties build() { return new OAuth2Properties(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy