software.amazon.awssdk.services.mq.model.LdapServerMetadataInput Maven / Gradle / Ivy
Show all versions of mq 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.mq.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;
/**
*
* Optional. The metadata of the LDAP server used to authenticate and authorize connections to the broker.
*
*
*
* Does not apply to RabbitMQ brokers.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class LdapServerMetadataInput implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> HOSTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Hosts")
.getter(getter(LdapServerMetadataInput::hosts))
.setter(setter(Builder::hosts))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hosts").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 ROLE_BASE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleBase").getter(getter(LdapServerMetadataInput::roleBase)).setter(setter(Builder::roleBase))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleBase").build()).build();
private static final SdkField ROLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleName").getter(getter(LdapServerMetadataInput::roleName)).setter(setter(Builder::roleName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleName").build()).build();
private static final SdkField ROLE_SEARCH_MATCHING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleSearchMatching").getter(getter(LdapServerMetadataInput::roleSearchMatching))
.setter(setter(Builder::roleSearchMatching))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleSearchMatching").build())
.build();
private static final SdkField ROLE_SEARCH_SUBTREE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RoleSearchSubtree").getter(getter(LdapServerMetadataInput::roleSearchSubtree))
.setter(setter(Builder::roleSearchSubtree))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleSearchSubtree").build()).build();
private static final SdkField SERVICE_ACCOUNT_PASSWORD_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceAccountPassword").getter(getter(LdapServerMetadataInput::serviceAccountPassword))
.setter(setter(Builder::serviceAccountPassword))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceAccountPassword").build())
.build();
private static final SdkField SERVICE_ACCOUNT_USERNAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ServiceAccountUsername").getter(getter(LdapServerMetadataInput::serviceAccountUsername))
.setter(setter(Builder::serviceAccountUsername))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceAccountUsername").build())
.build();
private static final SdkField USER_BASE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserBase").getter(getter(LdapServerMetadataInput::userBase)).setter(setter(Builder::userBase))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userBase").build()).build();
private static final SdkField USER_ROLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserRoleName").getter(getter(LdapServerMetadataInput::userRoleName))
.setter(setter(Builder::userRoleName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userRoleName").build()).build();
private static final SdkField USER_SEARCH_MATCHING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("UserSearchMatching").getter(getter(LdapServerMetadataInput::userSearchMatching))
.setter(setter(Builder::userSearchMatching))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userSearchMatching").build())
.build();
private static final SdkField USER_SEARCH_SUBTREE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("UserSearchSubtree").getter(getter(LdapServerMetadataInput::userSearchSubtree))
.setter(setter(Builder::userSearchSubtree))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("userSearchSubtree").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HOSTS_FIELD, ROLE_BASE_FIELD,
ROLE_NAME_FIELD, ROLE_SEARCH_MATCHING_FIELD, ROLE_SEARCH_SUBTREE_FIELD, SERVICE_ACCOUNT_PASSWORD_FIELD,
SERVICE_ACCOUNT_USERNAME_FIELD, USER_BASE_FIELD, USER_ROLE_NAME_FIELD, USER_SEARCH_MATCHING_FIELD,
USER_SEARCH_SUBTREE_FIELD));
private static final long serialVersionUID = 1L;
private final List hosts;
private final String roleBase;
private final String roleName;
private final String roleSearchMatching;
private final Boolean roleSearchSubtree;
private final String serviceAccountPassword;
private final String serviceAccountUsername;
private final String userBase;
private final String userRoleName;
private final String userSearchMatching;
private final Boolean userSearchSubtree;
private LdapServerMetadataInput(BuilderImpl builder) {
this.hosts = builder.hosts;
this.roleBase = builder.roleBase;
this.roleName = builder.roleName;
this.roleSearchMatching = builder.roleSearchMatching;
this.roleSearchSubtree = builder.roleSearchSubtree;
this.serviceAccountPassword = builder.serviceAccountPassword;
this.serviceAccountUsername = builder.serviceAccountUsername;
this.userBase = builder.userBase;
this.userRoleName = builder.userRoleName;
this.userSearchMatching = builder.userSearchMatching;
this.userSearchSubtree = builder.userSearchSubtree;
}
/**
* For responses, this returns true if the service returned a value for the Hosts 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 hasHosts() {
return hosts != null && !(hosts instanceof SdkAutoConstructList);
}
/**
*
* Specifies the location of the LDAP server such as Directory Service for Microsoft Active Directory. Optional
* failover server.
*
*
* 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 #hasHosts} method.
*
*
* @return Specifies the location of the LDAP server such as Directory Service for Microsoft Active Directory.
* Optional failover server.
*/
public final List hosts() {
return hosts;
}
/**
*
* The distinguished name of the node in the directory information tree (DIT) to search for roles or groups. For
* example, ou=group, ou=corp, dc=corp, dc=example, dc=com.
*
*
* @return The distinguished name of the node in the directory information tree (DIT) to search for roles or groups.
* For example, ou=group, ou=corp, dc=corp, dc=example, dc=com.
*/
public final String roleBase() {
return roleBase;
}
/**
*
* Specifies the LDAP attribute that identifies the group name attribute in the object returned from the group
* membership query.
*
*
* @return Specifies the LDAP attribute that identifies the group name attribute in the object returned from the
* group membership query.
*/
public final String roleName() {
return roleName;
}
/**
*
* The LDAP search filter used to find roles within the roleBase. The distinguished name of the user matched by
* userSearchMatching is substituted into the {0} placeholder in the search filter. The client's username is
* substituted into the {1} placeholder. For example, if you set this option to (member=uid={1})for the user
* janedoe, the search filter becomes (member=uid=janedoe) after string substitution. It matches all role entries
* that have a member attribute equal to uid=janedoe under the subtree selected by the roleBase.
*
*
* @return The LDAP search filter used to find roles within the roleBase. The distinguished name of the user matched
* by userSearchMatching is substituted into the {0} placeholder in the search filter. The client's username
* is substituted into the {1} placeholder. For example, if you set this option to (member=uid={1})for the
* user janedoe, the search filter becomes (member=uid=janedoe) after string substitution. It matches all
* role entries that have a member attribute equal to uid=janedoe under the subtree selected by the
* roleBase.
*/
public final String roleSearchMatching() {
return roleSearchMatching;
}
/**
*
* The directory search scope for the role. If set to true, scope is to search the entire subtree.
*
*
* @return The directory search scope for the role. If set to true, scope is to search the entire subtree.
*/
public final Boolean roleSearchSubtree() {
return roleSearchSubtree;
}
/**
*
* Service account password. A service account is an account in your LDAP server that has access to initiate a
* connection. For example, cn=admin,dc=corp, dc=example, dc=com.
*
*
* @return Service account password. A service account is an account in your LDAP server that has access to initiate
* a connection. For example, cn=admin,dc=corp, dc=example, dc=com.
*/
public final String serviceAccountPassword() {
return serviceAccountPassword;
}
/**
*
* Service account username. A service account is an account in your LDAP server that has access to initiate a
* connection. For example, cn=admin,dc=corp, dc=example, dc=com.
*
*
* @return Service account username. A service account is an account in your LDAP server that has access to initiate
* a connection. For example, cn=admin,dc=corp, dc=example, dc=com.
*/
public final String serviceAccountUsername() {
return serviceAccountUsername;
}
/**
*
* Select a particular subtree of the directory information tree (DIT) to search for user entries. The subtree is
* specified by a DN, which specifies the base node of the subtree. For example, by setting this option to
* ou=Users,ou=corp, dc=corp, dc=example, dc=com, the search for user entries is restricted to the subtree beneath
* ou=Users, ou=corp, dc=corp, dc=example, dc=com.
*
*
* @return Select a particular subtree of the directory information tree (DIT) to search for user entries. The
* subtree is specified by a DN, which specifies the base node of the subtree. For example, by setting this
* option to ou=Users,ou=corp, dc=corp, dc=example, dc=com, the search for user entries is restricted to the
* subtree beneath ou=Users, ou=corp, dc=corp, dc=example, dc=com.
*/
public final String userBase() {
return userBase;
}
/**
*
* Specifies the name of the LDAP attribute for the user group membership.
*
*
* @return Specifies the name of the LDAP attribute for the user group membership.
*/
public final String userRoleName() {
return userRoleName;
}
/**
*
* The LDAP search filter used to find users within the userBase. The client's username is substituted into the {0}
* placeholder in the search filter. For example, if this option is set to (uid={0}) and the received username is
* janedoe, the search filter becomes (uid=janedoe) after string substitution. It will result in matching an entry
* like uid=janedoe, ou=Users,ou=corp, dc=corp, dc=example, dc=com.
*
*
* @return The LDAP search filter used to find users within the userBase. The client's username is substituted into
* the {0} placeholder in the search filter. For example, if this option is set to (uid={0}) and the
* received username is janedoe, the search filter becomes (uid=janedoe) after string substitution. It will
* result in matching an entry like uid=janedoe, ou=Users,ou=corp, dc=corp, dc=example, dc=com.
*/
public final String userSearchMatching() {
return userSearchMatching;
}
/**
*
* The directory search scope for the user. If set to true, scope is to search the entire subtree.
*
*
* @return The directory search scope for the user. If set to true, scope is to search the entire subtree.
*/
public final Boolean userSearchSubtree() {
return userSearchSubtree;
}
@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 + Objects.hashCode(hasHosts() ? hosts() : null);
hashCode = 31 * hashCode + Objects.hashCode(roleBase());
hashCode = 31 * hashCode + Objects.hashCode(roleName());
hashCode = 31 * hashCode + Objects.hashCode(roleSearchMatching());
hashCode = 31 * hashCode + Objects.hashCode(roleSearchSubtree());
hashCode = 31 * hashCode + Objects.hashCode(serviceAccountPassword());
hashCode = 31 * hashCode + Objects.hashCode(serviceAccountUsername());
hashCode = 31 * hashCode + Objects.hashCode(userBase());
hashCode = 31 * hashCode + Objects.hashCode(userRoleName());
hashCode = 31 * hashCode + Objects.hashCode(userSearchMatching());
hashCode = 31 * hashCode + Objects.hashCode(userSearchSubtree());
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 LdapServerMetadataInput)) {
return false;
}
LdapServerMetadataInput other = (LdapServerMetadataInput) obj;
return hasHosts() == other.hasHosts() && Objects.equals(hosts(), other.hosts())
&& Objects.equals(roleBase(), other.roleBase()) && Objects.equals(roleName(), other.roleName())
&& Objects.equals(roleSearchMatching(), other.roleSearchMatching())
&& Objects.equals(roleSearchSubtree(), other.roleSearchSubtree())
&& Objects.equals(serviceAccountPassword(), other.serviceAccountPassword())
&& Objects.equals(serviceAccountUsername(), other.serviceAccountUsername())
&& Objects.equals(userBase(), other.userBase()) && Objects.equals(userRoleName(), other.userRoleName())
&& Objects.equals(userSearchMatching(), other.userSearchMatching())
&& Objects.equals(userSearchSubtree(), other.userSearchSubtree());
}
/**
* 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("LdapServerMetadataInput").add("Hosts", hasHosts() ? hosts() : null).add("RoleBase", roleBase())
.add("RoleName", roleName()).add("RoleSearchMatching", roleSearchMatching())
.add("RoleSearchSubtree", roleSearchSubtree()).add("ServiceAccountPassword", serviceAccountPassword())
.add("ServiceAccountUsername", serviceAccountUsername()).add("UserBase", userBase())
.add("UserRoleName", userRoleName()).add("UserSearchMatching", userSearchMatching())
.add("UserSearchSubtree", userSearchSubtree()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Hosts":
return Optional.ofNullable(clazz.cast(hosts()));
case "RoleBase":
return Optional.ofNullable(clazz.cast(roleBase()));
case "RoleName":
return Optional.ofNullable(clazz.cast(roleName()));
case "RoleSearchMatching":
return Optional.ofNullable(clazz.cast(roleSearchMatching()));
case "RoleSearchSubtree":
return Optional.ofNullable(clazz.cast(roleSearchSubtree()));
case "ServiceAccountPassword":
return Optional.ofNullable(clazz.cast(serviceAccountPassword()));
case "ServiceAccountUsername":
return Optional.ofNullable(clazz.cast(serviceAccountUsername()));
case "UserBase":
return Optional.ofNullable(clazz.cast(userBase()));
case "UserRoleName":
return Optional.ofNullable(clazz.cast(userRoleName()));
case "UserSearchMatching":
return Optional.ofNullable(clazz.cast(userSearchMatching()));
case "UserSearchSubtree":
return Optional.ofNullable(clazz.cast(userSearchSubtree()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function