software.amazon.awssdk.services.amplifybackend.model.UpdateBackendAuthResourceConfig Maven / Gradle / Ivy
Show all versions of amplifybackend 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.amplifybackend.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Defines the resource configuration when updating an authentication resource in your Amplify project.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateBackendAuthResourceConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AUTH_RESOURCES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AuthResources").getter(getter(UpdateBackendAuthResourceConfig::authResourcesAsString))
.setter(setter(Builder::authResources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("authResources").build()).build();
private static final SdkField IDENTITY_POOL_CONFIGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("IdentityPoolConfigs")
.getter(getter(UpdateBackendAuthResourceConfig::identityPoolConfigs)).setter(setter(Builder::identityPoolConfigs))
.constructor(UpdateBackendAuthIdentityPoolConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("identityPoolConfigs").build())
.build();
private static final SdkField SERVICE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Service")
.getter(getter(UpdateBackendAuthResourceConfig::serviceAsString)).setter(setter(Builder::service))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("service").build()).build();
private static final SdkField USER_POOL_CONFIGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("UserPoolConfigs")
.getter(getter(UpdateBackendAuthResourceConfig::userPoolConfigs)).setter(setter(Builder::userPoolConfigs))
.constructor(UpdateBackendAuthUserPoolConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userPoolConfigs").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUTH_RESOURCES_FIELD,
IDENTITY_POOL_CONFIGS_FIELD, SERVICE_FIELD, USER_POOL_CONFIGS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("authResources", AUTH_RESOURCES_FIELD);
put("identityPoolConfigs", IDENTITY_POOL_CONFIGS_FIELD);
put("service", SERVICE_FIELD);
put("userPoolConfigs", USER_POOL_CONFIGS_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String authResources;
private final UpdateBackendAuthIdentityPoolConfig identityPoolConfigs;
private final String service;
private final UpdateBackendAuthUserPoolConfig userPoolConfigs;
private UpdateBackendAuthResourceConfig(BuilderImpl builder) {
this.authResources = builder.authResources;
this.identityPoolConfigs = builder.identityPoolConfigs;
this.service = builder.service;
this.userPoolConfigs = builder.userPoolConfigs;
}
/**
*
* Defines the service name to use when configuring an authentication resource in your Amplify project.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authResources}
* will return {@link AuthResources#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authResourcesAsString}.
*
*
* @return Defines the service name to use when configuring an authentication resource in your Amplify project.
* @see AuthResources
*/
public final AuthResources authResources() {
return AuthResources.fromValue(authResources);
}
/**
*
* Defines the service name to use when configuring an authentication resource in your Amplify project.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #authResources}
* will return {@link AuthResources#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #authResourcesAsString}.
*
*
* @return Defines the service name to use when configuring an authentication resource in your Amplify project.
* @see AuthResources
*/
public final String authResourcesAsString() {
return authResources;
}
/**
*
* Describes the authorization configuration for the Amazon Cognito identity pool, provisioned as a part of your
* auth resource in the Amplify project.
*
*
* @return Describes the authorization configuration for the Amazon Cognito identity pool, provisioned as a part of
* your auth resource in the Amplify project.
*/
public final UpdateBackendAuthIdentityPoolConfig identityPoolConfigs() {
return identityPoolConfigs;
}
/**
*
* Defines the service name to use when configuring an authentication resource in your Amplify project.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #service} will
* return {@link Service#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serviceAsString}.
*
*
* @return Defines the service name to use when configuring an authentication resource in your Amplify project.
* @see Service
*/
public final Service service() {
return Service.fromValue(service);
}
/**
*
* Defines the service name to use when configuring an authentication resource in your Amplify project.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #service} will
* return {@link Service#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serviceAsString}.
*
*
* @return Defines the service name to use when configuring an authentication resource in your Amplify project.
* @see Service
*/
public final String serviceAsString() {
return service;
}
/**
*
* Describes the authentication configuration for the Amazon Cognito user pool, provisioned as a part of your auth
* resource in the Amplify project.
*
*
* @return Describes the authentication configuration for the Amazon Cognito user pool, provisioned as a part of
* your auth resource in the Amplify project.
*/
public final UpdateBackendAuthUserPoolConfig userPoolConfigs() {
return userPoolConfigs;
}
@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(authResourcesAsString());
hashCode = 31 * hashCode + Objects.hashCode(identityPoolConfigs());
hashCode = 31 * hashCode + Objects.hashCode(serviceAsString());
hashCode = 31 * hashCode + Objects.hashCode(userPoolConfigs());
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 UpdateBackendAuthResourceConfig)) {
return false;
}
UpdateBackendAuthResourceConfig other = (UpdateBackendAuthResourceConfig) obj;
return Objects.equals(authResourcesAsString(), other.authResourcesAsString())
&& Objects.equals(identityPoolConfigs(), other.identityPoolConfigs())
&& Objects.equals(serviceAsString(), other.serviceAsString())
&& Objects.equals(userPoolConfigs(), other.userPoolConfigs());
}
/**
* 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("UpdateBackendAuthResourceConfig").add("AuthResources", authResourcesAsString())
.add("IdentityPoolConfigs", identityPoolConfigs()).add("Service", serviceAsString())
.add("UserPoolConfigs", userPoolConfigs()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AuthResources":
return Optional.ofNullable(clazz.cast(authResourcesAsString()));
case "IdentityPoolConfigs":
return Optional.ofNullable(clazz.cast(identityPoolConfigs()));
case "Service":
return Optional.ofNullable(clazz.cast(serviceAsString()));
case "UserPoolConfigs":
return Optional.ofNullable(clazz.cast(userPoolConfigs()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function