software.amazon.awssdk.services.apigateway.model.EndpointConfiguration Maven / Gradle / Ivy
Show all versions of api-gateway Show documentation
/*
* Copyright 2013-2018 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.apigateway.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.core.runtime.TypeConverter;
import software.amazon.awssdk.services.apigateway.transform.EndpointConfigurationMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The endpoint configuration to indicate the types of endpoints an API (RestApi) or its custom domain name
* (DomainName) has.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class EndpointConfiguration implements StructuredPojo,
ToCopyableBuilder {
private final List types;
private EndpointConfiguration(BuilderImpl builder) {
this.types = builder.types;
}
/**
*
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional API and
* its custom domain name, the endpoint type is REGIONAL
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional
* API and its custom domain name, the endpoint type is REGIONAL
.
*/
public List types() {
return TypeConverter.convert(types, EndpointType::fromValue);
}
/**
*
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional API and
* its custom domain name, the endpoint type is REGIONAL
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional
* API and its custom domain name, the endpoint type is REGIONAL
.
*/
public List typesStrings() {
return types;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(typesStrings());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EndpointConfiguration)) {
return false;
}
EndpointConfiguration other = (EndpointConfiguration) obj;
return Objects.equals(typesStrings(), other.typesStrings());
}
@Override
public String toString() {
return ToString.builder("EndpointConfiguration").add("Types", typesStrings()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "types":
return Optional.of(clazz.cast(typesStrings()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
EndpointConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional API
* and its custom domain name, the endpoint type is REGIONAL
.
*
*
* @param types
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For
* an edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a
* regional API and its custom domain name, the endpoint type is REGIONAL
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder types(Collection types);
/**
*
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For an
* edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a regional API
* and its custom domain name, the endpoint type is REGIONAL
.
*
*
* @param types
* A list of endpoint types of an API (RestApi) or its custom domain name (DomainName). For
* an edge-optimized API and its custom domain name, the endpoint type is "EDGE"
. For a
* regional API and its custom domain name, the endpoint type is REGIONAL
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder types(String... types);
}
static final class BuilderImpl implements Builder {
private List types;
private BuilderImpl() {
}
private BuilderImpl(EndpointConfiguration model) {
types(model.types);
}
public final Collection getTypes() {
return types;
}
@Override
public final Builder types(Collection types) {
this.types = ListOfEndpointTypeCopier.copy(types);
return this;
}
@Override
@SafeVarargs
public final Builder types(String... types) {
types(Arrays.asList(types));
return this;
}
public final void setTypes(Collection types) {
this.types = ListOfEndpointTypeCopier.copy(types);
}
@Override
public EndpointConfiguration build() {
return new EndpointConfiguration(this);
}
}
}