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

software.amazon.awssdk.services.workdocs.model.CreateUserRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon WorkDocs module holds the client classes that are used for communicating with Amazon WorkDocs 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.workdocs.model;

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.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 CreateUserRequest extends WorkDocsRequest implements
        ToCopyableBuilder {
    private static final SdkField ORGANIZATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("OrganizationId").getter(getter(CreateUserRequest::organizationId))
            .setter(setter(Builder::organizationId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationId").build()).build();

    private static final SdkField USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Username").getter(getter(CreateUserRequest::username)).setter(setter(Builder::username))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Username").build()).build();

    private static final SdkField EMAIL_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("EmailAddress").getter(getter(CreateUserRequest::emailAddress)).setter(setter(Builder::emailAddress))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EmailAddress").build()).build();

    private static final SdkField GIVEN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("GivenName").getter(getter(CreateUserRequest::givenName)).setter(setter(Builder::givenName))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GivenName").build()).build();

    private static final SdkField SURNAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Surname")
            .getter(getter(CreateUserRequest::surname)).setter(setter(Builder::surname))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Surname").build()).build();

    private static final SdkField PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Password").getter(getter(CreateUserRequest::password)).setter(setter(Builder::password))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build();

    private static final SdkField TIME_ZONE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("TimeZoneId").getter(getter(CreateUserRequest::timeZoneId)).setter(setter(Builder::timeZoneId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeZoneId").build()).build();

    private static final SdkField STORAGE_RULE_FIELD = SdkField
            . builder(MarshallingType.SDK_POJO).memberName("StorageRule")
            .getter(getter(CreateUserRequest::storageRule)).setter(setter(Builder::storageRule))
            .constructor(StorageRuleType::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StorageRule").build()).build();

    private static final SdkField AUTHENTICATION_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("AuthenticationToken").getter(getter(CreateUserRequest::authenticationToken))
            .setter(setter(Builder::authenticationToken))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Authentication").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ORGANIZATION_ID_FIELD,
            USERNAME_FIELD, EMAIL_ADDRESS_FIELD, GIVEN_NAME_FIELD, SURNAME_FIELD, PASSWORD_FIELD, TIME_ZONE_ID_FIELD,
            STORAGE_RULE_FIELD, AUTHENTICATION_TOKEN_FIELD));

    private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();

    private final String organizationId;

    private final String username;

    private final String emailAddress;

    private final String givenName;

    private final String surname;

    private final String password;

    private final String timeZoneId;

    private final StorageRuleType storageRule;

    private final String authenticationToken;

    private CreateUserRequest(BuilderImpl builder) {
        super(builder);
        this.organizationId = builder.organizationId;
        this.username = builder.username;
        this.emailAddress = builder.emailAddress;
        this.givenName = builder.givenName;
        this.surname = builder.surname;
        this.password = builder.password;
        this.timeZoneId = builder.timeZoneId;
        this.storageRule = builder.storageRule;
        this.authenticationToken = builder.authenticationToken;
    }

    /**
     * 

* The ID of the organization. *

* * @return The ID of the organization. */ public final String organizationId() { return organizationId; } /** *

* The login name of the user. *

* * @return The login name of the user. */ public final String username() { return username; } /** *

* The email address of the user. *

* * @return The email address of the user. */ public final String emailAddress() { return emailAddress; } /** *

* The given name of the user. *

* * @return The given name of the user. */ public final String givenName() { return givenName; } /** *

* The surname of the user. *

* * @return The surname of the user. */ public final String surname() { return surname; } /** *

* The password of the user. *

* * @return The password of the user. */ public final String password() { return password; } /** *

* The time zone ID of the user. *

* * @return The time zone ID of the user. */ public final String timeZoneId() { return timeZoneId; } /** *

* The amount of storage for the user. *

* * @return The amount of storage for the user. */ public final StorageRuleType storageRule() { return storageRule; } /** *

* Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to * access the API. *

* * @return Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator * credentials to access the API. */ public final String authenticationToken() { return authenticationToken; } @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(organizationId()); hashCode = 31 * hashCode + Objects.hashCode(username()); hashCode = 31 * hashCode + Objects.hashCode(emailAddress()); hashCode = 31 * hashCode + Objects.hashCode(givenName()); hashCode = 31 * hashCode + Objects.hashCode(surname()); hashCode = 31 * hashCode + Objects.hashCode(password()); hashCode = 31 * hashCode + Objects.hashCode(timeZoneId()); hashCode = 31 * hashCode + Objects.hashCode(storageRule()); hashCode = 31 * hashCode + Objects.hashCode(authenticationToken()); 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 CreateUserRequest)) { return false; } CreateUserRequest other = (CreateUserRequest) obj; return Objects.equals(organizationId(), other.organizationId()) && Objects.equals(username(), other.username()) && Objects.equals(emailAddress(), other.emailAddress()) && Objects.equals(givenName(), other.givenName()) && Objects.equals(surname(), other.surname()) && Objects.equals(password(), other.password()) && Objects.equals(timeZoneId(), other.timeZoneId()) && Objects.equals(storageRule(), other.storageRule()) && Objects.equals(authenticationToken(), other.authenticationToken()); } /** * 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("CreateUserRequest").add("OrganizationId", organizationId()) .add("Username", username() == null ? null : "*** Sensitive Data Redacted ***") .add("EmailAddress", emailAddress() == null ? null : "*** Sensitive Data Redacted ***") .add("GivenName", givenName() == null ? null : "*** Sensitive Data Redacted ***") .add("Surname", surname() == null ? null : "*** Sensitive Data Redacted ***") .add("Password", password() == null ? null : "*** Sensitive Data Redacted ***").add("TimeZoneId", timeZoneId()) .add("StorageRule", storageRule()) .add("AuthenticationToken", authenticationToken() == null ? null : "*** Sensitive Data Redacted ***").build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "OrganizationId": return Optional.ofNullable(clazz.cast(organizationId())); case "Username": return Optional.ofNullable(clazz.cast(username())); case "EmailAddress": return Optional.ofNullable(clazz.cast(emailAddress())); case "GivenName": return Optional.ofNullable(clazz.cast(givenName())); case "Surname": return Optional.ofNullable(clazz.cast(surname())); case "Password": return Optional.ofNullable(clazz.cast(password())); case "TimeZoneId": return Optional.ofNullable(clazz.cast(timeZoneId())); case "StorageRule": return Optional.ofNullable(clazz.cast(storageRule())); case "AuthenticationToken": return Optional.ofNullable(clazz.cast(authenticationToken())); 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("OrganizationId", ORGANIZATION_ID_FIELD); map.put("Username", USERNAME_FIELD); map.put("EmailAddress", EMAIL_ADDRESS_FIELD); map.put("GivenName", GIVEN_NAME_FIELD); map.put("Surname", SURNAME_FIELD); map.put("Password", PASSWORD_FIELD); map.put("TimeZoneId", TIME_ZONE_ID_FIELD); map.put("StorageRule", STORAGE_RULE_FIELD); map.put("Authentication", AUTHENTICATION_TOKEN_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((CreateUserRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends WorkDocsRequest.Builder, SdkPojo, CopyableBuilder { /** *

* The ID of the organization. *

* * @param organizationId * The ID of the organization. * @return Returns a reference to this object so that method calls can be chained together. */ Builder organizationId(String organizationId); /** *

* The login name of the user. *

* * @param username * The login name of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder username(String username); /** *

* The email address of the user. *

* * @param emailAddress * The email address of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder emailAddress(String emailAddress); /** *

* The given name of the user. *

* * @param givenName * The given name of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder givenName(String givenName); /** *

* The surname of the user. *

* * @param surname * The surname of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder surname(String surname); /** *

* The password of the user. *

* * @param password * The password of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder password(String password); /** *

* The time zone ID of the user. *

* * @param timeZoneId * The time zone ID of the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timeZoneId(String timeZoneId); /** *

* The amount of storage for the user. *

* * @param storageRule * The amount of storage for the user. * @return Returns a reference to this object so that method calls can be chained together. */ Builder storageRule(StorageRuleType storageRule); /** *

* The amount of storage for the user. *

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

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

* Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials * to access the API. *

* * @param authenticationToken * Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator * credentials to access the API. * @return Returns a reference to this object so that method calls can be chained together. */ Builder authenticationToken(String authenticationToken); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends WorkDocsRequest.BuilderImpl implements Builder { private String organizationId; private String username; private String emailAddress; private String givenName; private String surname; private String password; private String timeZoneId; private StorageRuleType storageRule; private String authenticationToken; private BuilderImpl() { } private BuilderImpl(CreateUserRequest model) { super(model); organizationId(model.organizationId); username(model.username); emailAddress(model.emailAddress); givenName(model.givenName); surname(model.surname); password(model.password); timeZoneId(model.timeZoneId); storageRule(model.storageRule); authenticationToken(model.authenticationToken); } public final String getOrganizationId() { return organizationId; } public final void setOrganizationId(String organizationId) { this.organizationId = organizationId; } @Override public final Builder organizationId(String organizationId) { this.organizationId = organizationId; 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 getEmailAddress() { return emailAddress; } public final void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } @Override public final Builder emailAddress(String emailAddress) { this.emailAddress = emailAddress; return this; } public final String getGivenName() { return givenName; } public final void setGivenName(String givenName) { this.givenName = givenName; } @Override public final Builder givenName(String givenName) { this.givenName = givenName; return this; } public final String getSurname() { return surname; } public final void setSurname(String surname) { this.surname = surname; } @Override public final Builder surname(String surname) { this.surname = surname; return this; } public final String getPassword() { return password; } public final void setPassword(String password) { this.password = password; } @Override public final Builder password(String password) { this.password = password; return this; } public final String getTimeZoneId() { return timeZoneId; } public final void setTimeZoneId(String timeZoneId) { this.timeZoneId = timeZoneId; } @Override public final Builder timeZoneId(String timeZoneId) { this.timeZoneId = timeZoneId; return this; } public final StorageRuleType.Builder getStorageRule() { return storageRule != null ? storageRule.toBuilder() : null; } public final void setStorageRule(StorageRuleType.BuilderImpl storageRule) { this.storageRule = storageRule != null ? storageRule.build() : null; } @Override public final Builder storageRule(StorageRuleType storageRule) { this.storageRule = storageRule; return this; } public final String getAuthenticationToken() { return authenticationToken; } public final void setAuthenticationToken(String authenticationToken) { this.authenticationToken = authenticationToken; } @Override public final Builder authenticationToken(String authenticationToken) { this.authenticationToken = authenticationToken; 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 CreateUserRequest build() { return new CreateUserRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy