com.solidfire.element.api.EnableLdapAuthenticationRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solidfire-sdk-java Show documentation
Show all versions of solidfire-sdk-java Show documentation
Library for interfacing with the Public and Incubating SolidFire Element API.
/*
* Copyright © 2014-2016 NetApp, Inc. 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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.
*/
/*
* DO NOT EDIT THIS CODE BY HAND! It has been generated with jsvcgen.
*/
package com.solidfire.element.api;
import com.solidfire.gson.annotations.SerializedName;
import com.solidfire.jsvcgen.annotation.Since;
import com.solidfire.jsvcgen.client.ApiException;
import com.solidfire.jsvcgen.javautil.Optional;
import java.net.URL;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;
import java.util.TreeMap;
import static com.solidfire.jsvcgen.javautil.Optional.of;
/**
* The Request object for the "EnableLdapAuthentication" API Service call.
**/
public class EnableLdapAuthenticationRequest implements Serializable {
private static final long serialVersionUID = -2040059293L;
@SerializedName("authType") private final Optional authType;
@SerializedName("groupSearchBaseDN") private final Optional groupSearchBaseDN;
@SerializedName("groupSearchCustomFilter") private final Optional groupSearchCustomFilter;
@SerializedName("groupSearchType") private final Optional groupSearchType;
@SerializedName("searchBindDN") private final Optional searchBindDN;
@SerializedName("searchBindPassword") private final Optional searchBindPassword;
@SerializedName("serverURIs") private final String[] serverURIs;
@SerializedName("userDNTemplate") private final Optional userDNTemplate;
@SerializedName("userSearchBaseDN") private final Optional userSearchBaseDN;
@SerializedName("userSearchFilter") private final Optional userSearchFilter;
/**
* The Request object for the "EnableLdapAuthentication" API Service call.
* @param authType (optional) Identifies which user authentcation method will be used.
* @param groupSearchBaseDN (optional) The base DN of the tree to start the group search (will do a subtree search from here).
* @param groupSearchCustomFilter (optional) REQUIRED for CustomFilter
* @param groupSearchType (optional) Controls the default group search filter used, can be one of the following:
* @param searchBindDN (optional) REQUIRED for SearchAndBind
* @param searchBindPassword (optional) REQUIRED for SearchAndBind
* @param serverURIs [required] A list of LDAP server URIs (examples: "ldap://1.2.3.4" and ldaps://1.2.3.4:123")
* @param userDNTemplate (optional) REQUIRED for DirectBind
* @param userSearchBaseDN (optional) REQUIRED for SearchAndBind
* @param userSearchFilter (optional) REQUIRED for SearchAndBind.
* @since 8.0
**/
@Since("8.0")
public EnableLdapAuthenticationRequest(Optional authType, Optional groupSearchBaseDN, Optional groupSearchCustomFilter, Optional groupSearchType, Optional searchBindDN, Optional searchBindPassword, String[] serverURIs, Optional userDNTemplate, Optional userSearchBaseDN, Optional userSearchFilter) {
this.searchBindDN = (searchBindDN == null) ? Optional.empty() : searchBindDN;
this.userSearchFilter = (userSearchFilter == null) ? Optional.empty() : userSearchFilter;
this.serverURIs = serverURIs;
this.groupSearchBaseDN = (groupSearchBaseDN == null) ? Optional.empty() : groupSearchBaseDN;
this.groupSearchCustomFilter = (groupSearchCustomFilter == null) ? Optional.empty() : groupSearchCustomFilter;
this.searchBindPassword = (searchBindPassword == null) ? Optional.empty() : searchBindPassword;
this.authType = (authType == null) ? Optional.empty() : authType;
this.groupSearchType = (groupSearchType == null) ? Optional.empty() : groupSearchType;
this.userSearchBaseDN = (userSearchBaseDN == null) ? Optional.empty() : userSearchBaseDN;
this.userDNTemplate = (userDNTemplate == null) ? Optional.empty() : userDNTemplate;
}
/**
* Identifies which user authentcation method will be used.
* Must be one of the following:
* DirectBind
* SearchAndBind (default)
**/
public Optional getAuthType() {
return this.authType;
}
/**
* The base DN of the tree to start the group search (will do a subtree search from here).
**/
public Optional getGroupSearchBaseDN() {
return this.groupSearchBaseDN;
}
/**
* REQUIRED for CustomFilter
* For use with the CustomFilter search type, an LDAP filter to use to return the DNs of a user's groups.
* The string can have placeholder text of %USERNAME% and %USERDN% to be replaced with their username and full userDN as needed.
**/
public Optional getGroupSearchCustomFilter() {
return this.groupSearchCustomFilter;
}
/**
* Controls the default group search filter used, can be one of the following:
* NoGroups: No group support.
* ActiveDirectory: (default) Nested membership of all of a user's AD groups.
* MemberDN: MemberDN style groups (single-level).
**/
public Optional getGroupSearchType() {
return this.groupSearchType;
}
/**
* REQUIRED for SearchAndBind
* A fully qualified DN to log in with to perform an LDAP search for the user (needs read access to the LDAP directory).
**/
public Optional getSearchBindDN() {
return this.searchBindDN;
}
/**
* REQUIRED for SearchAndBind
* The password for the searchBindDN account used for searching.
**/
public Optional getSearchBindPassword() {
return this.searchBindPassword;
}
/**
* A list of LDAP server URIs (examples: "ldap://1.2.3.4" and ldaps://1.2.3.4:123")
**/
public String[] getServerURIs() {
return this.serverURIs;
}
/**
* REQUIRED for DirectBind
* A string that is used to form a fully qualified user DN.
* The string should have the placeholder text "%USERNAME%" which will be replaced with the username of the authenticating user.
**/
public Optional getUserDNTemplate() {
return this.userDNTemplate;
}
/**
* REQUIRED for SearchAndBind
* The base DN of the tree used to start the search (will do a subtree search from here).
**/
public Optional getUserSearchBaseDN() {
return this.userSearchBaseDN;
}
/**
* REQUIRED for SearchAndBind.
* The LDAP filter to use.
* The string should have the placeholder text "%USERNAME%" which will be replaced with the username of the authenticating user.
* Example: (&(objectClass=person) (sAMAccountName=%USERNAME%)) will use the sAMAccountName field in Active Directory to match the nusername entered at cluster login.
**/
public Optional getUserSearchFilter() {
return this.userSearchFilter;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EnableLdapAuthenticationRequest that = (EnableLdapAuthenticationRequest) o;
return Objects.equals( authType , that.authType )
&& Objects.equals( groupSearchBaseDN , that.groupSearchBaseDN )
&& Objects.equals( groupSearchCustomFilter , that.groupSearchCustomFilter )
&& Objects.equals( groupSearchType , that.groupSearchType )
&& Objects.equals( searchBindDN , that.searchBindDN )
&& Objects.equals( searchBindPassword , that.searchBindPassword )
&& Objects.deepEquals( serverURIs , that.serverURIs )
&& Objects.equals( userDNTemplate , that.userDNTemplate )
&& Objects.equals( userSearchBaseDN , that.userSearchBaseDN )
&& Objects.equals( userSearchFilter , that.userSearchFilter );
}
@Override
public int hashCode() {
return Objects.hash( authType, groupSearchBaseDN, groupSearchCustomFilter, groupSearchType, searchBindDN, searchBindPassword, serverURIs, userDNTemplate, userSearchBaseDN, userSearchFilter );
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append( "{ " );
if(null != authType && authType.isPresent())
sb.append(" authType : ").append(authType.get()).append(",");
if(null != groupSearchBaseDN && groupSearchBaseDN.isPresent())
sb.append(" groupSearchBaseDN : ").append(groupSearchBaseDN.get()).append(",");
if(null != groupSearchCustomFilter && groupSearchCustomFilter.isPresent())
sb.append(" groupSearchCustomFilter : ").append(groupSearchCustomFilter.get()).append(",");
if(null != groupSearchType && groupSearchType.isPresent())
sb.append(" groupSearchType : ").append(groupSearchType.get()).append(",");
if(null != searchBindDN && searchBindDN.isPresent())
sb.append(" searchBindDN : ").append(searchBindDN.get()).append(",");
if(null != searchBindPassword && searchBindPassword.isPresent())
sb.append(" searchBindPassword : ").append(searchBindPassword.get()).append(",");
sb.append(" serverURIs : ").append(Arrays.toString(serverURIs)).append(",");
if(null != userDNTemplate && userDNTemplate.isPresent())
sb.append(" userDNTemplate : ").append(userDNTemplate.get()).append(",");
if(null != userSearchBaseDN && userSearchBaseDN.isPresent())
sb.append(" userSearchBaseDN : ").append(userSearchBaseDN.get()).append(",");
if(null != userSearchFilter && userSearchFilter.isPresent())
sb.append(" userSearchFilter : ").append(userSearchFilter.get());
sb.append( " }" );
if(sb.lastIndexOf(", }") != -1)
sb.deleteCharAt(sb.lastIndexOf(", }"));
return sb.toString();
}
public static Builder builder() {
return new Builder();
}
public final Builder asBuilder() {
return new Builder().buildFrom(this);
}
public static class Builder {
private Optional authType;
private Optional groupSearchBaseDN;
private Optional groupSearchCustomFilter;
private Optional groupSearchType;
private Optional searchBindDN;
private Optional searchBindPassword;
private String[] serverURIs;
private Optional userDNTemplate;
private Optional userSearchBaseDN;
private Optional userSearchFilter;
private Builder() { }
public EnableLdapAuthenticationRequest build() {
return new EnableLdapAuthenticationRequest (
this.authType,
this.groupSearchBaseDN,
this.groupSearchCustomFilter,
this.groupSearchType,
this.searchBindDN,
this.searchBindPassword,
this.serverURIs,
this.userDNTemplate,
this.userSearchBaseDN,
this.userSearchFilter );
}
private EnableLdapAuthenticationRequest.Builder buildFrom(final EnableLdapAuthenticationRequest req) {
this.authType = req.authType;
this.groupSearchBaseDN = req.groupSearchBaseDN;
this.groupSearchCustomFilter = req.groupSearchCustomFilter;
this.groupSearchType = req.groupSearchType;
this.searchBindDN = req.searchBindDN;
this.searchBindPassword = req.searchBindPassword;
this.serverURIs = req.serverURIs;
this.userDNTemplate = req.userDNTemplate;
this.userSearchBaseDN = req.userSearchBaseDN;
this.userSearchFilter = req.userSearchFilter;
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalAuthType(final String authType) {
this.authType = (authType == null) ? Optional.empty() : Optional.of(authType);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalGroupSearchBaseDN(final String groupSearchBaseDN) {
this.groupSearchBaseDN = (groupSearchBaseDN == null) ? Optional.empty() : Optional.of(groupSearchBaseDN);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalGroupSearchCustomFilter(final String groupSearchCustomFilter) {
this.groupSearchCustomFilter = (groupSearchCustomFilter == null) ? Optional.empty() : Optional.of(groupSearchCustomFilter);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalGroupSearchType(final String groupSearchType) {
this.groupSearchType = (groupSearchType == null) ? Optional.empty() : Optional.of(groupSearchType);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalSearchBindDN(final String searchBindDN) {
this.searchBindDN = (searchBindDN == null) ? Optional.empty() : Optional.of(searchBindDN);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalSearchBindPassword(final String searchBindPassword) {
this.searchBindPassword = (searchBindPassword == null) ? Optional.empty() : Optional.of(searchBindPassword);
return this;
}
public EnableLdapAuthenticationRequest.Builder serverURIs(final String[] serverURIs) {
this.serverURIs = serverURIs;
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalUserDNTemplate(final String userDNTemplate) {
this.userDNTemplate = (userDNTemplate == null) ? Optional.empty() : Optional.of(userDNTemplate);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalUserSearchBaseDN(final String userSearchBaseDN) {
this.userSearchBaseDN = (userSearchBaseDN == null) ? Optional.empty() : Optional.of(userSearchBaseDN);
return this;
}
public EnableLdapAuthenticationRequest.Builder optionalUserSearchFilter(final String userSearchFilter) {
this.userSearchFilter = (userSearchFilter == null) ? Optional.empty() : Optional.of(userSearchFilter);
return this;
}
}
}