software.amazon.awssdk.services.fsx.model.SelfManagedActiveDirectoryConfiguration Maven / Gradle / Ivy
Show all versions of fsx 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.fsx.model;
import java.io.Serializable;
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.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.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;
/**
*
* The configuration that Amazon FSx uses to join a FSx for Windows File Server file system or an FSx for ONTAP storage
* virtual machine (SVM) to a self-managed (including on-premises) Microsoft Active Directory (AD) directory. For more
* information, see Using Amazon FSx
* for Windows with your self-managed Microsoft Active Directory or Managing FSx for ONTAP SVMs.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SelfManagedActiveDirectoryConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(SelfManagedActiveDirectoryConfiguration::domainName))
.setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField ORGANIZATIONAL_UNIT_DISTINGUISHED_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("OrganizationalUnitDistinguishedName")
.getter(getter(SelfManagedActiveDirectoryConfiguration::organizationalUnitDistinguishedName))
.setter(setter(Builder::organizationalUnitDistinguishedName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("OrganizationalUnitDistinguishedName").build()).build();
private static final SdkField FILE_SYSTEM_ADMINISTRATORS_GROUP_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("FileSystemAdministratorsGroup")
.getter(getter(SelfManagedActiveDirectoryConfiguration::fileSystemAdministratorsGroup))
.setter(setter(Builder::fileSystemAdministratorsGroup))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileSystemAdministratorsGroup")
.build()).build();
private static final SdkField USER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserName").getter(getter(SelfManagedActiveDirectoryConfiguration::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)
.memberName("Password").getter(getter(SelfManagedActiveDirectoryConfiguration::password))
.setter(setter(Builder::password))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Password").build()).build();
private static final SdkField> DNS_IPS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("DnsIps")
.getter(getter(SelfManagedActiveDirectoryConfiguration::dnsIps))
.setter(setter(Builder::dnsIps))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DnsIps").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOMAIN_NAME_FIELD,
ORGANIZATIONAL_UNIT_DISTINGUISHED_NAME_FIELD, FILE_SYSTEM_ADMINISTRATORS_GROUP_FIELD, USER_NAME_FIELD,
PASSWORD_FIELD, DNS_IPS_FIELD));
private static final long serialVersionUID = 1L;
private final String domainName;
private final String organizationalUnitDistinguishedName;
private final String fileSystemAdministratorsGroup;
private final String userName;
private final String password;
private final List dnsIps;
private SelfManagedActiveDirectoryConfiguration(BuilderImpl builder) {
this.domainName = builder.domainName;
this.organizationalUnitDistinguishedName = builder.organizationalUnitDistinguishedName;
this.fileSystemAdministratorsGroup = builder.fileSystemAdministratorsGroup;
this.userName = builder.userName;
this.password = builder.password;
this.dnsIps = builder.dnsIps;
}
/**
*
* The fully qualified domain name of the self-managed AD directory, such as corp.example.com
.
*
*
* @return The fully qualified domain name of the self-managed AD directory, such as corp.example.com
.
*/
public final String domainName() {
return domainName;
}
/**
*
* (Optional) The fully qualified distinguished name of the organizational unit within your self-managed AD
* directory. Amazon FSx only accepts OU as the direct parent of the file system. An example is
* OU=FSx,DC=yourdomain,DC=corp,DC=com
. To learn more, see RFC 2253. If none is provided, the FSx file system is created in
* the default location of your self-managed AD directory.
*
*
*
* Only Organizational Unit (OU) objects can be the direct parent of the file system that you're creating.
*
*
*
* @return (Optional) The fully qualified distinguished name of the organizational unit within your self-managed AD
* directory. Amazon FSx only accepts OU as the direct parent of the file system. An example is
* OU=FSx,DC=yourdomain,DC=corp,DC=com
. To learn more, see RFC 2253. If none is provided, the FSx file system is
* created in the default location of your self-managed AD directory.
*
* Only Organizational Unit (OU) objects can be the direct parent of the file system that you're creating.
*
*/
public final String organizationalUnitDistinguishedName() {
return organizationalUnitDistinguishedName;
}
/**
*
* (Optional) The name of the domain group whose members are granted administrative privileges for the file system.
* Administrative privileges include taking ownership of files and folders, setting audit controls (audit ACLs) on
* files and folders, and administering the file system remotely by using the FSx Remote PowerShell. The group that
* you specify must already exist in your domain. If you don't provide one, your AD domain's Domain Admins group is
* used.
*
*
* @return (Optional) The name of the domain group whose members are granted administrative privileges for the file
* system. Administrative privileges include taking ownership of files and folders, setting audit controls
* (audit ACLs) on files and folders, and administering the file system remotely by using the FSx Remote
* PowerShell. The group that you specify must already exist in your domain. If you don't provide one, your
* AD domain's Domain Admins group is used.
*/
public final String fileSystemAdministratorsGroup() {
return fileSystemAdministratorsGroup;
}
/**
*
* The user name for the service account on your self-managed AD domain that Amazon FSx will use to join to your AD
* domain. This account must have the permission to join computers to the domain in the organizational unit provided
* in OrganizationalUnitDistinguishedName
, or in the default location of your AD domain.
*
*
* @return The user name for the service account on your self-managed AD domain that Amazon FSx will use to join to
* your AD domain. This account must have the permission to join computers to the domain in the
* organizational unit provided in OrganizationalUnitDistinguishedName
, or in the default
* location of your AD domain.
*/
public final String userName() {
return userName;
}
/**
*
* The password for the service account on your self-managed AD domain that Amazon FSx will use to join to your AD
* domain.
*
*
* @return The password for the service account on your self-managed AD domain that Amazon FSx will use to join to
* your AD domain.
*/
public final String password() {
return password;
}
/**
* For responses, this returns true if the service returned a value for the DnsIps property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasDnsIps() {
return dnsIps != null && !(dnsIps instanceof SdkAutoConstructList);
}
/**
*
* A list of up to three IP addresses of DNS servers or domain controllers in the self-managed AD directory.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasDnsIps} method.
*
*
* @return A list of up to three IP addresses of DNS servers or domain controllers in the self-managed AD directory.
*/
public final List dnsIps() {
return dnsIps;
}
@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 + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(organizationalUnitDistinguishedName());
hashCode = 31 * hashCode + Objects.hashCode(fileSystemAdministratorsGroup());
hashCode = 31 * hashCode + Objects.hashCode(userName());
hashCode = 31 * hashCode + Objects.hashCode(password());
hashCode = 31 * hashCode + Objects.hashCode(hasDnsIps() ? dnsIps() : null);
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 SelfManagedActiveDirectoryConfiguration)) {
return false;
}
SelfManagedActiveDirectoryConfiguration other = (SelfManagedActiveDirectoryConfiguration) obj;
return Objects.equals(domainName(), other.domainName())
&& Objects.equals(organizationalUnitDistinguishedName(), other.organizationalUnitDistinguishedName())
&& Objects.equals(fileSystemAdministratorsGroup(), other.fileSystemAdministratorsGroup())
&& Objects.equals(userName(), other.userName()) && Objects.equals(password(), other.password())
&& hasDnsIps() == other.hasDnsIps() && Objects.equals(dnsIps(), other.dnsIps());
}
/**
* 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("SelfManagedActiveDirectoryConfiguration").add("DomainName", domainName())
.add("OrganizationalUnitDistinguishedName", organizationalUnitDistinguishedName())
.add("FileSystemAdministratorsGroup", fileSystemAdministratorsGroup()).add("UserName", userName())
.add("Password", password() == null ? null : "*** Sensitive Data Redacted ***")
.add("DnsIps", hasDnsIps() ? dnsIps() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "OrganizationalUnitDistinguishedName":
return Optional.ofNullable(clazz.cast(organizationalUnitDistinguishedName()));
case "FileSystemAdministratorsGroup":
return Optional.ofNullable(clazz.cast(fileSystemAdministratorsGroup()));
case "UserName":
return Optional.ofNullable(clazz.cast(userName()));
case "Password":
return Optional.ofNullable(clazz.cast(password()));
case "DnsIps":
return Optional.ofNullable(clazz.cast(dnsIps()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function