software.amazon.awssdk.services.transfer.model.IdentityProviderDetails Maven / Gradle / Ivy
Show all versions of transfer 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.transfer.model;
import java.io.Serializable;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Returns information related to the type of user authentication that is in use for a file transfer protocol-enabled
* server's users. A server can have only one method of authentication.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class IdentityProviderDetails implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField URL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Url")
.getter(getter(IdentityProviderDetails::url)).setter(setter(Builder::url))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Url").build()).build();
private static final SdkField INVOCATION_ROLE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InvocationRole").getter(getter(IdentityProviderDetails::invocationRole))
.setter(setter(Builder::invocationRole))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvocationRole").build()).build();
private static final SdkField DIRECTORY_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DirectoryId").getter(getter(IdentityProviderDetails::directoryId)).setter(setter(Builder::directoryId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DirectoryId").build()).build();
private static final SdkField FUNCTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Function").getter(getter(IdentityProviderDetails::function)).setter(setter(Builder::function))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Function").build()).build();
private static final SdkField SFTP_AUTHENTICATION_METHODS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SftpAuthenticationMethods").getter(getter(IdentityProviderDetails::sftpAuthenticationMethodsAsString))
.setter(setter(Builder::sftpAuthenticationMethods))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SftpAuthenticationMethods").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(URL_FIELD,
INVOCATION_ROLE_FIELD, DIRECTORY_ID_FIELD, FUNCTION_FIELD, SFTP_AUTHENTICATION_METHODS_FIELD));
private static final long serialVersionUID = 1L;
private final String url;
private final String invocationRole;
private final String directoryId;
private final String function;
private final String sftpAuthenticationMethods;
private IdentityProviderDetails(BuilderImpl builder) {
this.url = builder.url;
this.invocationRole = builder.invocationRole;
this.directoryId = builder.directoryId;
this.function = builder.function;
this.sftpAuthenticationMethods = builder.sftpAuthenticationMethods;
}
/**
*
* Provides the location of the service endpoint used to authenticate users.
*
*
* @return Provides the location of the service endpoint used to authenticate users.
*/
public final String url() {
return url;
}
/**
*
* This parameter is only applicable if your IdentityProviderType
is API_GATEWAY
. Provides
* the type of InvocationRole
used to authenticate the user account.
*
*
* @return This parameter is only applicable if your IdentityProviderType
is API_GATEWAY
.
* Provides the type of InvocationRole
used to authenticate the user account.
*/
public final String invocationRole() {
return invocationRole;
}
/**
*
* The identifier of the Directory Service directory that you want to use as your identity provider.
*
*
* @return The identifier of the Directory Service directory that you want to use as your identity provider.
*/
public final String directoryId() {
return directoryId;
}
/**
*
* The ARN for a Lambda function to use for the Identity provider.
*
*
* @return The ARN for a Lambda function to use for the Identity provider.
*/
public final String function() {
return function;
}
/**
*
* For SFTP-enabled servers, and for custom identity providers only, you can specify whether to authenticate
* using a password, SSH key pair, or both.
*
*
* -
*
* PASSWORD
- users must provide their password to connect.
*
*
* -
*
* PUBLIC_KEY
- users must provide their private key to connect.
*
*
* -
*
* PUBLIC_KEY_OR_PASSWORD
- users can authenticate with either their password or their key. This is the
* default value.
*
*
* -
*
* PUBLIC_KEY_AND_PASSWORD
- users must provide both their private key and their password to connect.
* The server checks the key first, and then if the key is valid, the system prompts for a password. If the private
* key provided does not match the public key that is stored, authentication fails.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #sftpAuthenticationMethods} will return {@link SftpAuthenticationMethods#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #sftpAuthenticationMethodsAsString}.
*
*
* @return For SFTP-enabled servers, and for custom identity providers only, you can specify whether to
* authenticate using a password, SSH key pair, or both.
*
* -
*
* PASSWORD
- users must provide their password to connect.
*
*
* -
*
* PUBLIC_KEY
- users must provide their private key to connect.
*
*
* -
*
* PUBLIC_KEY_OR_PASSWORD
- users can authenticate with either their password or their key.
* This is the default value.
*
*
* -
*
* PUBLIC_KEY_AND_PASSWORD
- users must provide both their private key and their password to
* connect. The server checks the key first, and then if the key is valid, the system prompts for a
* password. If the private key provided does not match the public key that is stored, authentication fails.
*
*
* @see SftpAuthenticationMethods
*/
public final SftpAuthenticationMethods sftpAuthenticationMethods() {
return SftpAuthenticationMethods.fromValue(sftpAuthenticationMethods);
}
/**
*
* For SFTP-enabled servers, and for custom identity providers only, you can specify whether to authenticate
* using a password, SSH key pair, or both.
*
*
* -
*
* PASSWORD
- users must provide their password to connect.
*
*
* -
*
* PUBLIC_KEY
- users must provide their private key to connect.
*
*
* -
*
* PUBLIC_KEY_OR_PASSWORD
- users can authenticate with either their password or their key. This is the
* default value.
*
*
* -
*
* PUBLIC_KEY_AND_PASSWORD
- users must provide both their private key and their password to connect.
* The server checks the key first, and then if the key is valid, the system prompts for a password. If the private
* key provided does not match the public key that is stored, authentication fails.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #sftpAuthenticationMethods} will return {@link SftpAuthenticationMethods#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #sftpAuthenticationMethodsAsString}.
*
*
* @return For SFTP-enabled servers, and for custom identity providers only, you can specify whether to
* authenticate using a password, SSH key pair, or both.
*
* -
*
* PASSWORD
- users must provide their password to connect.
*
*
* -
*
* PUBLIC_KEY
- users must provide their private key to connect.
*
*
* -
*
* PUBLIC_KEY_OR_PASSWORD
- users can authenticate with either their password or their key.
* This is the default value.
*
*
* -
*
* PUBLIC_KEY_AND_PASSWORD
- users must provide both their private key and their password to
* connect. The server checks the key first, and then if the key is valid, the system prompts for a
* password. If the private key provided does not match the public key that is stored, authentication fails.
*
*
* @see SftpAuthenticationMethods
*/
public final String sftpAuthenticationMethodsAsString() {
return sftpAuthenticationMethods;
}
@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(url());
hashCode = 31 * hashCode + Objects.hashCode(invocationRole());
hashCode = 31 * hashCode + Objects.hashCode(directoryId());
hashCode = 31 * hashCode + Objects.hashCode(function());
hashCode = 31 * hashCode + Objects.hashCode(sftpAuthenticationMethodsAsString());
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 IdentityProviderDetails)) {
return false;
}
IdentityProviderDetails other = (IdentityProviderDetails) obj;
return Objects.equals(url(), other.url()) && Objects.equals(invocationRole(), other.invocationRole())
&& Objects.equals(directoryId(), other.directoryId()) && Objects.equals(function(), other.function())
&& Objects.equals(sftpAuthenticationMethodsAsString(), other.sftpAuthenticationMethodsAsString());
}
/**
* 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("IdentityProviderDetails").add("Url", url()).add("InvocationRole", invocationRole())
.add("DirectoryId", directoryId()).add("Function", function())
.add("SftpAuthenticationMethods", sftpAuthenticationMethodsAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Url":
return Optional.ofNullable(clazz.cast(url()));
case "InvocationRole":
return Optional.ofNullable(clazz.cast(invocationRole()));
case "DirectoryId":
return Optional.ofNullable(clazz.cast(directoryId()));
case "Function":
return Optional.ofNullable(clazz.cast(function()));
case "SftpAuthenticationMethods":
return Optional.ofNullable(clazz.cast(sftpAuthenticationMethodsAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function