All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.apigateway.model.CreateRestApiRequest Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon API Gateway module holds the client classes that are used for communicating with Amazon API Gateway

There is a newer version: 2.0.0-preview-11
Show newest version
/*
 * 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 java.util.function.Consumer;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AwsRequestOverrideConfig;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The POST Request to add a new RestApi resource to your collection. *

*/ @Generated("software.amazon.awssdk:codegen") public class CreateRestApiRequest extends APIGatewayRequest implements ToCopyableBuilder { private final String name; private final String description; private final String version; private final String cloneFrom; private final List binaryMediaTypes; private final EndpointConfiguration endpointConfiguration; private CreateRestApiRequest(BuilderImpl builder) { super(builder); this.name = builder.name; this.description = builder.description; this.version = builder.version; this.cloneFrom = builder.cloneFrom; this.binaryMediaTypes = builder.binaryMediaTypes; this.endpointConfiguration = builder.endpointConfiguration; } /** *

* The name of the RestApi. *

* * @return The name of the RestApi. */ public String name() { return name; } /** *

* The description of the RestApi. *

* * @return The description of the RestApi. */ public String description() { return description; } /** *

* A version identifier for the API. *

* * @return A version identifier for the API. */ public String version() { return version; } /** *

* The ID of the RestApi that you want to clone from. *

* * @return The ID of the RestApi that you want to clone from. */ public String cloneFrom() { return cloneFrom; } /** *

* The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return The list of binary media types supported by the RestApi. By default, the RestApi supports * only UTF-8-encoded text payloads. */ public List binaryMediaTypes() { return binaryMediaTypes; } /** *

* The endpoint configuration of this RestApi showing the endpoint types of the API. *

* * @return The endpoint configuration of this RestApi showing the endpoint types of the API. */ public EndpointConfiguration endpointConfiguration() { return endpointConfiguration; } @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(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(version()); hashCode = 31 * hashCode + Objects.hashCode(cloneFrom()); hashCode = 31 * hashCode + Objects.hashCode(binaryMediaTypes()); hashCode = 31 * hashCode + Objects.hashCode(endpointConfiguration()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CreateRestApiRequest)) { return false; } CreateRestApiRequest other = (CreateRestApiRequest) obj; return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(version(), other.version()) && Objects.equals(cloneFrom(), other.cloneFrom()) && Objects.equals(binaryMediaTypes(), other.binaryMediaTypes()) && Objects.equals(endpointConfiguration(), other.endpointConfiguration()); } @Override public String toString() { return ToString.builder("CreateRestApiRequest").add("Name", name()).add("Description", description()) .add("Version", version()).add("CloneFrom", cloneFrom()).add("BinaryMediaTypes", binaryMediaTypes()) .add("EndpointConfiguration", endpointConfiguration()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "name": return Optional.of(clazz.cast(name())); case "description": return Optional.of(clazz.cast(description())); case "version": return Optional.of(clazz.cast(version())); case "cloneFrom": return Optional.of(clazz.cast(cloneFrom())); case "binaryMediaTypes": return Optional.of(clazz.cast(binaryMediaTypes())); case "endpointConfiguration": return Optional.of(clazz.cast(endpointConfiguration())); default: return Optional.empty(); } } public interface Builder extends APIGatewayRequest.Builder, CopyableBuilder { /** *

* The name of the RestApi. *

* * @param name * The name of the RestApi. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The description of the RestApi. *

* * @param description * The description of the RestApi. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* A version identifier for the API. *

* * @param version * A version identifier for the API. * @return Returns a reference to this object so that method calls can be chained together. */ Builder version(String version); /** *

* The ID of the RestApi that you want to clone from. *

* * @param cloneFrom * The ID of the RestApi that you want to clone from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder cloneFrom(String cloneFrom); /** *

* The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. *

* * @param binaryMediaTypes * The list of binary media types supported by the RestApi. By default, the RestApi * supports only UTF-8-encoded text payloads. * @return Returns a reference to this object so that method calls can be chained together. */ Builder binaryMediaTypes(Collection binaryMediaTypes); /** *

* The list of binary media types supported by the RestApi. By default, the RestApi supports only * UTF-8-encoded text payloads. *

* * @param binaryMediaTypes * The list of binary media types supported by the RestApi. By default, the RestApi * supports only UTF-8-encoded text payloads. * @return Returns a reference to this object so that method calls can be chained together. */ Builder binaryMediaTypes(String... binaryMediaTypes); /** *

* The endpoint configuration of this RestApi showing the endpoint types of the API. *

* * @param endpointConfiguration * The endpoint configuration of this RestApi showing the endpoint types of the API. * @return Returns a reference to this object so that method calls can be chained together. */ Builder endpointConfiguration(EndpointConfiguration endpointConfiguration); /** *

* The endpoint configuration of this RestApi showing the endpoint types of the API. *

* This is a convenience that creates an instance of the {@link EndpointConfiguration.Builder} avoiding the need * to create one manually via {@link EndpointConfiguration#builder()}. * * When the {@link Consumer} completes, {@link EndpointConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #endpointConfiguration(EndpointConfiguration)}. * * @param endpointConfiguration * a consumer that will call methods on {@link EndpointConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #endpointConfiguration(EndpointConfiguration) */ default Builder endpointConfiguration(Consumer endpointConfiguration) { return endpointConfiguration(EndpointConfiguration.builder().apply(endpointConfiguration).build()); } @Override Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig); } static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder { private String name; private String description; private String version; private String cloneFrom; private List binaryMediaTypes; private EndpointConfiguration endpointConfiguration; private BuilderImpl() { } private BuilderImpl(CreateRestApiRequest model) { name(model.name); description(model.description); version(model.version); cloneFrom(model.cloneFrom); binaryMediaTypes(model.binaryMediaTypes); endpointConfiguration(model.endpointConfiguration); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getVersion() { return version; } @Override public final Builder version(String version) { this.version = version; return this; } public final void setVersion(String version) { this.version = version; } public final String getCloneFrom() { return cloneFrom; } @Override public final Builder cloneFrom(String cloneFrom) { this.cloneFrom = cloneFrom; return this; } public final void setCloneFrom(String cloneFrom) { this.cloneFrom = cloneFrom; } public final Collection getBinaryMediaTypes() { return binaryMediaTypes; } @Override public final Builder binaryMediaTypes(Collection binaryMediaTypes) { this.binaryMediaTypes = ListOfStringCopier.copy(binaryMediaTypes); return this; } @Override @SafeVarargs public final Builder binaryMediaTypes(String... binaryMediaTypes) { binaryMediaTypes(Arrays.asList(binaryMediaTypes)); return this; } public final void setBinaryMediaTypes(Collection binaryMediaTypes) { this.binaryMediaTypes = ListOfStringCopier.copy(binaryMediaTypes); } public final EndpointConfiguration.Builder getEndpointConfiguration() { return endpointConfiguration != null ? endpointConfiguration.toBuilder() : null; } @Override public final Builder endpointConfiguration(EndpointConfiguration endpointConfiguration) { this.endpointConfiguration = endpointConfiguration; return this; } public final void setEndpointConfiguration(EndpointConfiguration.BuilderImpl endpointConfiguration) { this.endpointConfiguration = endpointConfiguration != null ? endpointConfiguration.build() : null; } @Override public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) { super.requestOverrideConfig(awsRequestOverrideConfig); return this; } @Override public Builder requestOverrideConfig(Consumer builderConsumer) { super.requestOverrideConfig(builderConsumer); return this; } @Override public CreateRestApiRequest build() { return new CreateRestApiRequest(this); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy