software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserMfaPreferenceRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cognitoidentityprovider Show documentation
Show all versions of cognitoidentityprovider Show documentation
The AWS Java SDK for Amazon Cognito Identity Provider Service module holds the client classes that are
used for communicating with Amazon Cognito Identity Provider Service.
/*
* 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.cognitoidentityprovider.model;
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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class AdminSetUserMfaPreferenceRequest extends CognitoIdentityProviderRequest implements
ToCopyableBuilder {
private static final SdkField SMS_MFA_SETTINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SMSMfaSettings")
.getter(getter(AdminSetUserMfaPreferenceRequest::smsMfaSettings)).setter(setter(Builder::smsMfaSettings))
.constructor(SMSMfaSettingsType::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SMSMfaSettings").build()).build();
private static final SdkField SOFTWARE_TOKEN_MFA_SETTINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("SoftwareTokenMfaSettings")
.getter(getter(AdminSetUserMfaPreferenceRequest::softwareTokenMfaSettings))
.setter(setter(Builder::softwareTokenMfaSettings)).constructor(SoftwareTokenMfaSettingsType::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SoftwareTokenMfaSettings").build())
.build();
private static final SdkField USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Username").getter(getter(AdminSetUserMfaPreferenceRequest::username)).setter(setter(Builder::username))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Username").build()).build();
private static final SdkField USER_POOL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserPoolId").getter(getter(AdminSetUserMfaPreferenceRequest::userPoolId))
.setter(setter(Builder::userPoolId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserPoolId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SMS_MFA_SETTINGS_FIELD,
SOFTWARE_TOKEN_MFA_SETTINGS_FIELD, USERNAME_FIELD, USER_POOL_ID_FIELD));
private final SMSMfaSettingsType smsMfaSettings;
private final SoftwareTokenMfaSettingsType softwareTokenMfaSettings;
private final String username;
private final String userPoolId;
private AdminSetUserMfaPreferenceRequest(BuilderImpl builder) {
super(builder);
this.smsMfaSettings = builder.smsMfaSettings;
this.softwareTokenMfaSettings = builder.softwareTokenMfaSettings;
this.username = builder.username;
this.userPoolId = builder.userPoolId;
}
/**
*
* The SMS text message MFA settings.
*
*
* @return The SMS text message MFA settings.
*/
public final SMSMfaSettingsType smsMfaSettings() {
return smsMfaSettings;
}
/**
*
* The time-based one-time password software token MFA settings.
*
*
* @return The time-based one-time password software token MFA settings.
*/
public final SoftwareTokenMfaSettingsType softwareTokenMfaSettings() {
return softwareTokenMfaSettings;
}
/**
*
* The username of the user that you want to query or modify. The value of this parameter is typically your user's
* username, but it can be any of their alias attributes. If username
isn't an alias attribute in your
* user pool, this value must be the sub
of a local user or the username of a user from a third-party
* IdP.
*
*
* @return The username of the user that you want to query or modify. The value of this parameter is typically your
* user's username, but it can be any of their alias attributes. If username
isn't an alias
* attribute in your user pool, this value must be the sub
of a local user or the username of a
* user from a third-party IdP.
*/
public final String username() {
return username;
}
/**
*
* The user pool ID.
*
*
* @return The user pool ID.
*/
public final String userPoolId() {
return userPoolId;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(smsMfaSettings());
hashCode = 31 * hashCode + Objects.hashCode(softwareTokenMfaSettings());
hashCode = 31 * hashCode + Objects.hashCode(username());
hashCode = 31 * hashCode + Objects.hashCode(userPoolId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AdminSetUserMfaPreferenceRequest)) {
return false;
}
AdminSetUserMfaPreferenceRequest other = (AdminSetUserMfaPreferenceRequest) obj;
return Objects.equals(smsMfaSettings(), other.smsMfaSettings())
&& Objects.equals(softwareTokenMfaSettings(), other.softwareTokenMfaSettings())
&& Objects.equals(username(), other.username()) && Objects.equals(userPoolId(), other.userPoolId());
}
/**
* 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("AdminSetUserMfaPreferenceRequest").add("SMSMfaSettings", smsMfaSettings())
.add("SoftwareTokenMfaSettings", softwareTokenMfaSettings())
.add("Username", username() == null ? null : "*** Sensitive Data Redacted ***").add("UserPoolId", userPoolId())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SMSMfaSettings":
return Optional.ofNullable(clazz.cast(smsMfaSettings()));
case "SoftwareTokenMfaSettings":
return Optional.ofNullable(clazz.cast(softwareTokenMfaSettings()));
case "Username":
return Optional.ofNullable(clazz.cast(username()));
case "UserPoolId":
return Optional.ofNullable(clazz.cast(userPoolId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy