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

software.amazon.awssdk.services.cognitoidentityprovider.model.AdminSetUserMfaPreferenceRequest Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.30.1
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.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 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 getter(Function g) { return obj -> g.apply((AdminSetUserMfaPreferenceRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends CognitoIdentityProviderRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The SMS text message MFA settings. *

* * @param smsMfaSettings * The SMS text message MFA settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder smsMfaSettings(SMSMfaSettingsType smsMfaSettings); /** *

* The SMS text message MFA settings. *

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

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

* The time-based one-time password software token MFA settings. *

* * @param softwareTokenMfaSettings * The time-based one-time password software token MFA settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder softwareTokenMfaSettings(SoftwareTokenMfaSettingsType softwareTokenMfaSettings); /** *

* The time-based one-time password software token MFA settings. *

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

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

* 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. *

* * @param username * 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 Returns a reference to this object so that method calls can be chained together. */ Builder username(String username); /** *

* The user pool ID. *

* * @param userPoolId * The user pool ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder userPoolId(String userPoolId); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends CognitoIdentityProviderRequest.BuilderImpl implements Builder { private SMSMfaSettingsType smsMfaSettings; private SoftwareTokenMfaSettingsType softwareTokenMfaSettings; private String username; private String userPoolId; private BuilderImpl() { } private BuilderImpl(AdminSetUserMfaPreferenceRequest model) { super(model); smsMfaSettings(model.smsMfaSettings); softwareTokenMfaSettings(model.softwareTokenMfaSettings); username(model.username); userPoolId(model.userPoolId); } public final SMSMfaSettingsType.Builder getSmsMfaSettings() { return smsMfaSettings != null ? smsMfaSettings.toBuilder() : null; } public final void setSmsMfaSettings(SMSMfaSettingsType.BuilderImpl smsMfaSettings) { this.smsMfaSettings = smsMfaSettings != null ? smsMfaSettings.build() : null; } @Override public final Builder smsMfaSettings(SMSMfaSettingsType smsMfaSettings) { this.smsMfaSettings = smsMfaSettings; return this; } public final SoftwareTokenMfaSettingsType.Builder getSoftwareTokenMfaSettings() { return softwareTokenMfaSettings != null ? softwareTokenMfaSettings.toBuilder() : null; } public final void setSoftwareTokenMfaSettings(SoftwareTokenMfaSettingsType.BuilderImpl softwareTokenMfaSettings) { this.softwareTokenMfaSettings = softwareTokenMfaSettings != null ? softwareTokenMfaSettings.build() : null; } @Override public final Builder softwareTokenMfaSettings(SoftwareTokenMfaSettingsType softwareTokenMfaSettings) { this.softwareTokenMfaSettings = softwareTokenMfaSettings; return this; } public final String getUsername() { return username; } public final void setUsername(String username) { this.username = username; } @Override public final Builder username(String username) { this.username = username; return this; } public final String getUserPoolId() { return userPoolId; } public final void setUserPoolId(String userPoolId) { this.userPoolId = userPoolId; } @Override public final Builder userPoolId(String userPoolId) { this.userPoolId = userPoolId; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public AdminSetUserMfaPreferenceRequest build() { return new AdminSetUserMfaPreferenceRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy