software.amazon.awssdk.services.iot.model.CreateDomainConfigurationRequest Maven / Gradle / Ivy
Show all versions of iot 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.iot.model;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateDomainConfigurationRequest extends IotRequest implements
ToCopyableBuilder {
private static final SdkField DOMAIN_CONFIGURATION_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("domainConfigurationName").getter(getter(CreateDomainConfigurationRequest::domainConfigurationName))
.setter(setter(Builder::domainConfigurationName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("domainConfigurationName").build())
.build();
private static final SdkField DOMAIN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("domainName").getter(getter(CreateDomainConfigurationRequest::domainName))
.setter(setter(Builder::domainName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("domainName").build()).build();
private static final SdkField> SERVER_CERTIFICATE_ARNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("serverCertificateArns")
.getter(getter(CreateDomainConfigurationRequest::serverCertificateArns))
.setter(setter(Builder::serverCertificateArns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverCertificateArns").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 VALIDATION_CERTIFICATE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("validationCertificateArn").getter(getter(CreateDomainConfigurationRequest::validationCertificateArn))
.setter(setter(Builder::validationCertificateArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("validationCertificateArn").build())
.build();
private static final SdkField AUTHORIZER_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("authorizerConfig")
.getter(getter(CreateDomainConfigurationRequest::authorizerConfig)).setter(setter(Builder::authorizerConfig))
.constructor(AuthorizerConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("authorizerConfig").build()).build();
private static final SdkField SERVICE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceType").getter(getter(CreateDomainConfigurationRequest::serviceTypeAsString))
.setter(setter(Builder::serviceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceType").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("tags")
.getter(getter(CreateDomainConfigurationRequest::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField TLS_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("tlsConfig").getter(getter(CreateDomainConfigurationRequest::tlsConfig))
.setter(setter(Builder::tlsConfig)).constructor(TlsConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tlsConfig").build()).build();
private static final SdkField SERVER_CERTIFICATE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("serverCertificateConfig")
.getter(getter(CreateDomainConfigurationRequest::serverCertificateConfig))
.setter(setter(Builder::serverCertificateConfig)).constructor(ServerCertificateConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serverCertificateConfig").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
DOMAIN_CONFIGURATION_NAME_FIELD, DOMAIN_NAME_FIELD, SERVER_CERTIFICATE_ARNS_FIELD, VALIDATION_CERTIFICATE_ARN_FIELD,
AUTHORIZER_CONFIG_FIELD, SERVICE_TYPE_FIELD, TAGS_FIELD, TLS_CONFIG_FIELD, SERVER_CERTIFICATE_CONFIG_FIELD));
private final String domainConfigurationName;
private final String domainName;
private final List serverCertificateArns;
private final String validationCertificateArn;
private final AuthorizerConfig authorizerConfig;
private final String serviceType;
private final List tags;
private final TlsConfig tlsConfig;
private final ServerCertificateConfig serverCertificateConfig;
private CreateDomainConfigurationRequest(BuilderImpl builder) {
super(builder);
this.domainConfigurationName = builder.domainConfigurationName;
this.domainName = builder.domainName;
this.serverCertificateArns = builder.serverCertificateArns;
this.validationCertificateArn = builder.validationCertificateArn;
this.authorizerConfig = builder.authorizerConfig;
this.serviceType = builder.serviceType;
this.tags = builder.tags;
this.tlsConfig = builder.tlsConfig;
this.serverCertificateConfig = builder.serverCertificateConfig;
}
/**
*
* The name of the domain configuration. This value must be unique to a region.
*
*
* @return The name of the domain configuration. This value must be unique to a region.
*/
public final String domainConfigurationName() {
return domainConfigurationName;
}
/**
*
* The name of the domain.
*
*
* @return The name of the domain.
*/
public final String domainName() {
return domainName;
}
/**
* For responses, this returns true if the service returned a value for the ServerCertificateArns 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 hasServerCertificateArns() {
return serverCertificateArns != null && !(serverCertificateArns instanceof SdkAutoConstructList);
}
/**
*
* The ARNs of the certificates that IoT passes to the device during the TLS handshake. Currently you can specify
* only one certificate ARN. This value is not required for Amazon Web Services-managed domains.
*
*
* 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 #hasServerCertificateArns} method.
*
*
* @return The ARNs of the certificates that IoT passes to the device during the TLS handshake. Currently you can
* specify only one certificate ARN. This value is not required for Amazon Web Services-managed domains.
*/
public final List serverCertificateArns() {
return serverCertificateArns;
}
/**
*
* The certificate used to validate the server certificate and prove domain name ownership. This certificate must be
* signed by a public certificate authority. This value is not required for Amazon Web Services-managed domains.
*
*
* @return The certificate used to validate the server certificate and prove domain name ownership. This certificate
* must be signed by a public certificate authority. This value is not required for Amazon Web
* Services-managed domains.
*/
public final String validationCertificateArn() {
return validationCertificateArn;
}
/**
*
* An object that specifies the authorization service for a domain.
*
*
* @return An object that specifies the authorization service for a domain.
*/
public final AuthorizerConfig authorizerConfig() {
return authorizerConfig;
}
/**
*
* The type of service delivered by the endpoint.
*
*
*
* Amazon Web Services IoT Core currently supports only the DATA
service type.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #serviceType} will
* return {@link ServiceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serviceTypeAsString}.
*
*
* @return The type of service delivered by the endpoint.
*
* Amazon Web Services IoT Core currently supports only the DATA
service type.
*
* @see ServiceType
*/
public final ServiceType serviceType() {
return ServiceType.fromValue(serviceType);
}
/**
*
* The type of service delivered by the endpoint.
*
*
*
* Amazon Web Services IoT Core currently supports only the DATA
service type.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #serviceType} will
* return {@link ServiceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #serviceTypeAsString}.
*
*
* @return The type of service delivered by the endpoint.
*
* Amazon Web Services IoT Core currently supports only the DATA
service type.
*
* @see ServiceType
*/
public final String serviceTypeAsString() {
return serviceType;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* Metadata which can be used to manage the domain configuration.
*
*
*
* For URI Request parameters use format: ...key1=value1&key2=value2...
*
*
* For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."
*
*
* For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."
*
*
*
* 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 #hasTags} method.
*
*
* @return Metadata which can be used to manage the domain configuration.
*
* For URI Request parameters use format: ...key1=value1&key2=value2...
*
*
* For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."
*
*
* For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."
*
*/
public final List tags() {
return tags;
}
/**
*
* An object that specifies the TLS configuration for a domain.
*
*
* @return An object that specifies the TLS configuration for a domain.
*/
public final TlsConfig tlsConfig() {
return tlsConfig;
}
/**
*
* The server certificate configuration.
*
*
* @return The server certificate configuration.
*/
public final ServerCertificateConfig serverCertificateConfig() {
return serverCertificateConfig;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(domainConfigurationName());
hashCode = 31 * hashCode + Objects.hashCode(domainName());
hashCode = 31 * hashCode + Objects.hashCode(hasServerCertificateArns() ? serverCertificateArns() : null);
hashCode = 31 * hashCode + Objects.hashCode(validationCertificateArn());
hashCode = 31 * hashCode + Objects.hashCode(authorizerConfig());
hashCode = 31 * hashCode + Objects.hashCode(serviceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(tlsConfig());
hashCode = 31 * hashCode + Objects.hashCode(serverCertificateConfig());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDomainConfigurationRequest)) {
return false;
}
CreateDomainConfigurationRequest other = (CreateDomainConfigurationRequest) obj;
return Objects.equals(domainConfigurationName(), other.domainConfigurationName())
&& Objects.equals(domainName(), other.domainName())
&& hasServerCertificateArns() == other.hasServerCertificateArns()
&& Objects.equals(serverCertificateArns(), other.serverCertificateArns())
&& Objects.equals(validationCertificateArn(), other.validationCertificateArn())
&& Objects.equals(authorizerConfig(), other.authorizerConfig())
&& Objects.equals(serviceTypeAsString(), other.serviceTypeAsString()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(tlsConfig(), other.tlsConfig())
&& Objects.equals(serverCertificateConfig(), other.serverCertificateConfig());
}
/**
* 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("CreateDomainConfigurationRequest").add("DomainConfigurationName", domainConfigurationName())
.add("DomainName", domainName())
.add("ServerCertificateArns", hasServerCertificateArns() ? serverCertificateArns() : null)
.add("ValidationCertificateArn", validationCertificateArn()).add("AuthorizerConfig", authorizerConfig())
.add("ServiceType", serviceTypeAsString()).add("Tags", hasTags() ? tags() : null).add("TlsConfig", tlsConfig())
.add("ServerCertificateConfig", serverCertificateConfig()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "domainConfigurationName":
return Optional.ofNullable(clazz.cast(domainConfigurationName()));
case "domainName":
return Optional.ofNullable(clazz.cast(domainName()));
case "serverCertificateArns":
return Optional.ofNullable(clazz.cast(serverCertificateArns()));
case "validationCertificateArn":
return Optional.ofNullable(clazz.cast(validationCertificateArn()));
case "authorizerConfig":
return Optional.ofNullable(clazz.cast(authorizerConfig()));
case "serviceType":
return Optional.ofNullable(clazz.cast(serviceTypeAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "tlsConfig":
return Optional.ofNullable(clazz.cast(tlsConfig()));
case "serverCertificateConfig":
return Optional.ofNullable(clazz.cast(serverCertificateConfig()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function