
software.amazon.awssdk.services.cognitoidentityprovider.model.ProviderDescription 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.cognitoidentityprovider.model;
import java.io.Serializable;
import java.time.Instant;
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;
/**
*
* A container for IdP details.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ProviderDescription implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PROVIDER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProviderName").getter(getter(ProviderDescription::providerName)).setter(setter(Builder::providerName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProviderName").build()).build();
private static final SdkField PROVIDER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProviderType").getter(getter(ProviderDescription::providerTypeAsString))
.setter(setter(Builder::providerType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProviderType").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedDate").getter(getter(ProviderDescription::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationDate").getter(getter(ProviderDescription::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PROVIDER_NAME_FIELD,
PROVIDER_TYPE_FIELD, LAST_MODIFIED_DATE_FIELD, CREATION_DATE_FIELD));
private static final long serialVersionUID = 1L;
private final String providerName;
private final String providerType;
private final Instant lastModifiedDate;
private final Instant creationDate;
private ProviderDescription(BuilderImpl builder) {
this.providerName = builder.providerName;
this.providerType = builder.providerType;
this.lastModifiedDate = builder.lastModifiedDate;
this.creationDate = builder.creationDate;
}
/**
*
* The IdP name.
*
*
* @return The IdP name.
*/
public final String providerName() {
return providerName;
}
/**
*
* The IdP type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link IdentityProviderTypeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #providerTypeAsString}.
*
*
* @return The IdP type.
* @see IdentityProviderTypeType
*/
public final IdentityProviderTypeType providerType() {
return IdentityProviderTypeType.fromValue(providerType);
}
/**
*
* The IdP type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link IdentityProviderTypeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #providerTypeAsString}.
*
*
* @return The IdP type.
* @see IdentityProviderTypeType
*/
public final String providerTypeAsString() {
return providerType;
}
/**
*
* The date the provider was last modified.
*
*
* @return The date the provider was last modified.
*/
public final Instant lastModifiedDate() {
return lastModifiedDate;
}
/**
*
* The date and time, in ISO 8601 format, when
* the item was created.
*
*
* @return The date and time, in ISO 8601
* format, when the item was created.
*/
public final Instant creationDate() {
return creationDate;
}
@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(providerName());
hashCode = 31 * hashCode + Objects.hashCode(providerTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
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 ProviderDescription)) {
return false;
}
ProviderDescription other = (ProviderDescription) obj;
return Objects.equals(providerName(), other.providerName())
&& Objects.equals(providerTypeAsString(), other.providerTypeAsString())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate())
&& Objects.equals(creationDate(), other.creationDate());
}
/**
* 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("ProviderDescription").add("ProviderName", providerName())
.add("ProviderType", providerTypeAsString()).add("LastModifiedDate", lastModifiedDate())
.add("CreationDate", creationDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ProviderName":
return Optional.ofNullable(clazz.cast(providerName()));
case "ProviderType":
return Optional.ofNullable(clazz.cast(providerTypeAsString()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function