software.amazon.awssdk.services.workmail.model.AvailabilityConfiguration Maven / Gradle / Ivy
Show all versions of workmail 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.workmail.model;
import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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;
/**
*
* List all the AvailabilityConfiguration
's for the given WorkMail organization.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AvailabilityConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DomainName").getter(getter(AvailabilityConfiguration::domainName)).setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DomainName").build()).build();
private static final SdkField PROVIDER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProviderType").getter(getter(AvailabilityConfiguration::providerTypeAsString))
.setter(setter(Builder::providerType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProviderType").build()).build();
private static final SdkField EWS_PROVIDER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("EwsProvider")
.getter(getter(AvailabilityConfiguration::ewsProvider)).setter(setter(Builder::ewsProvider))
.constructor(RedactedEwsAvailabilityProvider::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EwsProvider").build()).build();
private static final SdkField LAMBDA_PROVIDER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LambdaProvider")
.getter(getter(AvailabilityConfiguration::lambdaProvider)).setter(setter(Builder::lambdaProvider))
.constructor(LambdaAvailabilityProvider::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LambdaProvider").build()).build();
private static final SdkField DATE_CREATED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("DateCreated").getter(getter(AvailabilityConfiguration::dateCreated))
.setter(setter(Builder::dateCreated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DateCreated").build()).build();
private static final SdkField DATE_MODIFIED_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("DateModified").getter(getter(AvailabilityConfiguration::dateModified))
.setter(setter(Builder::dateModified))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DateModified").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DOMAIN_NAME_FIELD,
PROVIDER_TYPE_FIELD, EWS_PROVIDER_FIELD, LAMBDA_PROVIDER_FIELD, DATE_CREATED_FIELD, DATE_MODIFIED_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String domainName;
private final String providerType;
private final RedactedEwsAvailabilityProvider ewsProvider;
private final LambdaAvailabilityProvider lambdaProvider;
private final Instant dateCreated;
private final Instant dateModified;
private AvailabilityConfiguration(BuilderImpl builder) {
this.domainName = builder.domainName;
this.providerType = builder.providerType;
this.ewsProvider = builder.ewsProvider;
this.lambdaProvider = builder.lambdaProvider;
this.dateCreated = builder.dateCreated;
this.dateModified = builder.dateModified;
}
/**
*
* Displays the domain to which the provider applies.
*
*
* @return Displays the domain to which the provider applies.
*/
public final String domainName() {
return domainName;
}
/**
*
* Displays the provider type that applies to this domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link AvailabilityProviderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #providerTypeAsString}.
*
*
* @return Displays the provider type that applies to this domain.
* @see AvailabilityProviderType
*/
public final AvailabilityProviderType providerType() {
return AvailabilityProviderType.fromValue(providerType);
}
/**
*
* Displays the provider type that applies to this domain.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #providerType} will
* return {@link AvailabilityProviderType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #providerTypeAsString}.
*
*
* @return Displays the provider type that applies to this domain.
* @see AvailabilityProviderType
*/
public final String providerTypeAsString() {
return providerType;
}
/**
*
* If ProviderType
is EWS
, then this field contains
* RedactedEwsAvailabilityProvider
. Otherwise, it is not required.
*
*
* @return If ProviderType
is EWS
, then this field contains
* RedactedEwsAvailabilityProvider
. Otherwise, it is not required.
*/
public final RedactedEwsAvailabilityProvider ewsProvider() {
return ewsProvider;
}
/**
*
* If ProviderType is LAMBDA
then this field contains LambdaAvailabilityProvider
.
* Otherwise, it is not required.
*
*
* @return If ProviderType is LAMBDA
then this field contains LambdaAvailabilityProvider
.
* Otherwise, it is not required.
*/
public final LambdaAvailabilityProvider lambdaProvider() {
return lambdaProvider;
}
/**
*
* The date and time at which the availability configuration was created.
*
*
* @return The date and time at which the availability configuration was created.
*/
public final Instant dateCreated() {
return dateCreated;
}
/**
*
* The date and time at which the availability configuration was last modified.
*
*
* @return The date and time at which the availability configuration was last modified.
*/
public final Instant dateModified() {
return dateModified;
}
@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(domainName());
hashCode = 31 * hashCode + Objects.hashCode(providerTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(ewsProvider());
hashCode = 31 * hashCode + Objects.hashCode(lambdaProvider());
hashCode = 31 * hashCode + Objects.hashCode(dateCreated());
hashCode = 31 * hashCode + Objects.hashCode(dateModified());
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 AvailabilityConfiguration)) {
return false;
}
AvailabilityConfiguration other = (AvailabilityConfiguration) obj;
return Objects.equals(domainName(), other.domainName())
&& Objects.equals(providerTypeAsString(), other.providerTypeAsString())
&& Objects.equals(ewsProvider(), other.ewsProvider()) && Objects.equals(lambdaProvider(), other.lambdaProvider())
&& Objects.equals(dateCreated(), other.dateCreated()) && Objects.equals(dateModified(), other.dateModified());
}
/**
* 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("AvailabilityConfiguration").add("DomainName", domainName())
.add("ProviderType", providerTypeAsString()).add("EwsProvider", ewsProvider())
.add("LambdaProvider", lambdaProvider()).add("DateCreated", dateCreated()).add("DateModified", dateModified())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DomainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "ProviderType":
return Optional.ofNullable(clazz.cast(providerTypeAsString()));
case "EwsProvider":
return Optional.ofNullable(clazz.cast(ewsProvider()));
case "LambdaProvider":
return Optional.ofNullable(clazz.cast(lambdaProvider()));
case "DateCreated":
return Optional.ofNullable(clazz.cast(dateCreated()));
case "DateModified":
return Optional.ofNullable(clazz.cast(dateModified()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("DomainName", DOMAIN_NAME_FIELD);
map.put("ProviderType", PROVIDER_TYPE_FIELD);
map.put("EwsProvider", EWS_PROVIDER_FIELD);
map.put("LambdaProvider", LAMBDA_PROVIDER_FIELD);
map.put("DateCreated", DATE_CREATED_FIELD);
map.put("DateModified", DATE_MODIFIED_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function