
software.amazon.awssdk.services.storagegateway.model.JoinDomainRequest Maven / Gradle / Ivy
/*
* 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.storagegateway.model;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* JoinDomainInput
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JoinDomainRequest extends StorageGatewayRequest implements
ToCopyableBuilder {
private static final SdkField GATEWAY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(JoinDomainRequest::gatewayARN)).setter(setter(Builder::gatewayARN))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GatewayARN").build()).build();
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(JoinDomainRequest::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField ORGANIZATIONAL_UNIT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(JoinDomainRequest::organizationalUnit)).setter(setter(Builder::organizationalUnit))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrganizationalUnit").build())
.build();
private static final SdkField> DOMAIN_CONTROLLERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(JoinDomainRequest::domainControllers))
.setter(setter(Builder::domainControllers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainControllers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField TIMEOUT_IN_SECONDS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(JoinDomainRequest::timeoutInSeconds)).setter(setter(Builder::timeoutInSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeoutInSeconds").build()).build();
private static final SdkField USER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(JoinDomainRequest::userName)).setter(setter(Builder::userName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserName").build()).build();
private static final SdkField PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(JoinDomainRequest::password)).setter(setter(Builder::password))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GATEWAY_ARN_FIELD,
DOMAIN_NAME_FIELD, ORGANIZATIONAL_UNIT_FIELD, DOMAIN_CONTROLLERS_FIELD, TIMEOUT_IN_SECONDS_FIELD, USER_NAME_FIELD,
PASSWORD_FIELD));
private final String gatewayARN;
private final String domainName;
private final String organizationalUnit;
private final List domainControllers;
private final Integer timeoutInSeconds;
private final String userName;
private final String password;
private JoinDomainRequest(BuilderImpl builder) {
super(builder);
this.gatewayARN = builder.gatewayARN;
this.domainName = builder.domainName;
this.organizationalUnit = builder.organizationalUnit;
this.domainControllers = builder.domainControllers;
this.timeoutInSeconds = builder.timeoutInSeconds;
this.userName = builder.userName;
this.password = builder.password;
}
/**
*
* The Amazon Resource Name (ARN) of the gateway. Use the ListGateways
operation to return a list of
* gateways for your account and AWS Region.
*
*
* @return The Amazon Resource Name (ARN) of the gateway. Use the ListGateways
operation to return a
* list of gateways for your account and AWS Region.
*/
public String gatewayARN() {
return gatewayARN;
}
/**
*
* The name of the domain that you want the gateway to join.
*
*
* @return The name of the domain that you want the gateway to join.
*/
public String domainName() {
return domainName;
}
/**
*
* The organizational unit (OU) is a container in an Active Directory that can hold users, groups, computers, and
* other OUs and this parameter specifies the OU that the gateway will join within the AD domain.
*
*
* @return The organizational unit (OU) is a container in an Active Directory that can hold users, groups,
* computers, and other OUs and this parameter specifies the OU that the gateway will join within the AD
* domain.
*/
public String organizationalUnit() {
return organizationalUnit;
}
/**
* Returns true if the DomainControllers property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasDomainControllers() {
return domainControllers != null && !(domainControllers instanceof SdkAutoConstructList);
}
/**
*
* List of IPv4 addresses, NetBIOS names, or host names of your domain server. If you need to specify the port
* number include it after the colon (“:”). For example, mydc.mydomain.com:389
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasDomainControllers()} to see if a value was sent in this field.
*
*
* @return List of IPv4 addresses, NetBIOS names, or host names of your domain server. If you need to specify the
* port number include it after the colon (“:”). For example, mydc.mydomain.com:389
.
*/
public List domainControllers() {
return domainControllers;
}
/**
*
* Specifies the time in seconds, in which the JoinDomain
operation must complete. The default is 20
* seconds.
*
*
* @return Specifies the time in seconds, in which the JoinDomain
operation must complete. The default
* is 20 seconds.
*/
public Integer timeoutInSeconds() {
return timeoutInSeconds;
}
/**
*
* Sets the user name of user who has permission to add the gateway to the Active Directory domain. The domain user
* account should be enabled to join computers to the domain. For example, you can use the domain administrator
* account or an account with delegated permissions to join computers to the domain.
*
*
* @return Sets the user name of user who has permission to add the gateway to the Active Directory domain. The
* domain user account should be enabled to join computers to the domain. For example, you can use the
* domain administrator account or an account with delegated permissions to join computers to the domain.
*/
public String userName() {
return userName;
}
/**
*
* Sets the password of the user who has permission to add the gateway to the Active Directory domain.
*
*
* @return Sets the password of the user who has permission to add the gateway to the Active Directory domain.
*/
public String password() {
return password;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(gatewayARN());
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(organizationalUnit());
hashCode = 31 * hashCode + Objects.hashCode(domainControllers());
hashCode = 31 * hashCode + Objects.hashCode(timeoutInSeconds());
hashCode = 31 * hashCode + Objects.hashCode(userName());
hashCode = 31 * hashCode + Objects.hashCode(password());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof JoinDomainRequest)) {
return false;
}
JoinDomainRequest other = (JoinDomainRequest) obj;
return Objects.equals(gatewayARN(), other.gatewayARN()) && Objects.equals(domainName(), other.domainName())
&& Objects.equals(organizationalUnit(), other.organizationalUnit())
&& Objects.equals(domainControllers(), other.domainControllers())
&& Objects.equals(timeoutInSeconds(), other.timeoutInSeconds()) && Objects.equals(userName(), other.userName())
&& Objects.equals(password(), other.password());
}
/**
* 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 String toString() {
return ToString.builder("JoinDomainRequest").add("GatewayARN", gatewayARN()).add("DomainName", domainName())
.add("OrganizationalUnit", organizationalUnit()).add("DomainControllers", domainControllers())
.add("TimeoutInSeconds", timeoutInSeconds()).add("UserName", userName())
.add("Password", password() == null ? null : "*** Sensitive Data Redacted ***").build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "GatewayARN":
return Optional.ofNullable(clazz.cast(gatewayARN()));
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "OrganizationalUnit":
return Optional.ofNullable(clazz.cast(organizationalUnit()));
case "DomainControllers":
return Optional.ofNullable(clazz.cast(domainControllers()));
case "TimeoutInSeconds":
return Optional.ofNullable(clazz.cast(timeoutInSeconds()));
case "UserName":
return Optional.ofNullable(clazz.cast(userName()));
case "Password":
return Optional.ofNullable(clazz.cast(password()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function