software.amazon.awssdk.services.apigateway.model.GetExportRequest 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.Map;
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;
/**
*
* Request a new export of a RestApi for a particular Stage.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class GetExportRequest extends APIGatewayRequest implements ToCopyableBuilder {
private final String restApiId;
private final String stageName;
private final String exportType;
private final Map parameters;
private final String accepts;
private GetExportRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.stageName = builder.stageName;
this.exportType = builder.exportType;
this.parameters = builder.parameters;
this.accepts = builder.accepts;
}
/**
*
* The string identifier of the associated RestApi.
*
*
* @return The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* The name of the Stage that will be exported.
*
*
* @return The name of the Stage that will be exported.
*/
public String stageName() {
return stageName;
}
/**
*
* The type of export. Currently only 'swagger' is supported.
*
*
* @return The type of export. Currently only 'swagger' is supported.
*/
public String exportType() {
return exportType;
}
/**
*
* A key-value map of query string parameters that specify properties of the export, depending on the requested
* exportType
. For exportType
swagger
, any combination of the following
* parameters are supported: integrations
will export the API with x-amazon-apigateway-integration
* extensions. authorizers
will export the API with x-amazon-apigateway-authorizer extensions.
* postman
will export the API with Postman extensions, allowing for import to the Postman tool
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A key-value map of query string parameters that specify properties of the export, depending on the
* requested exportType
. For exportType
swagger
, any combination of
* the following parameters are supported: integrations
will export the API with
* x-amazon-apigateway-integration extensions. authorizers
will export the API with
* x-amazon-apigateway-authorizer extensions. postman
will export the API with Postman
* extensions, allowing for import to the Postman tool
*/
public Map parameters() {
return parameters;
}
/**
*
* The content-type of the export, for example application/json
. Currently
* application/json
and application/yaml
are supported for exportType
of
* swagger
. This should be specified in the Accept
header for direct API requests.
*
*
* @return The content-type of the export, for example application/json
. Currently
* application/json
and application/yaml
are supported for exportType
* of swagger
. This should be specified in the Accept
header for direct API
* requests.
*/
public String accepts() {
return accepts;
}
@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(restApiId());
hashCode = 31 * hashCode + Objects.hashCode(stageName());
hashCode = 31 * hashCode + Objects.hashCode(exportType());
hashCode = 31 * hashCode + Objects.hashCode(parameters());
hashCode = 31 * hashCode + Objects.hashCode(accepts());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetExportRequest)) {
return false;
}
GetExportRequest other = (GetExportRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(stageName(), other.stageName())
&& Objects.equals(exportType(), other.exportType()) && Objects.equals(parameters(), other.parameters())
&& Objects.equals(accepts(), other.accepts());
}
@Override
public String toString() {
return ToString.builder("GetExportRequest").add("RestApiId", restApiId()).add("StageName", stageName())
.add("ExportType", exportType()).add("Parameters", parameters()).add("Accepts", accepts()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.of(clazz.cast(restApiId()));
case "stageName":
return Optional.of(clazz.cast(stageName()));
case "exportType":
return Optional.of(clazz.cast(exportType()));
case "parameters":
return Optional.of(clazz.cast(parameters()));
case "accepts":
return Optional.of(clazz.cast(accepts()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayRequest.Builder, CopyableBuilder {
/**
*
* The string identifier of the associated RestApi.
*
*
* @param restApiId
* The string identifier of the associated RestApi.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder restApiId(String restApiId);
/**
*
* The name of the Stage that will be exported.
*
*
* @param stageName
* The name of the Stage that will be exported.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageName(String stageName);
/**
*
* The type of export. Currently only 'swagger' is supported.
*
*
* @param exportType
* The type of export. Currently only 'swagger' is supported.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder exportType(String exportType);
/**
*
* A key-value map of query string parameters that specify properties of the export, depending on the requested
* exportType
. For exportType
swagger
, any combination of the following
* parameters are supported: integrations
will export the API with x-amazon-apigateway-integration
* extensions. authorizers
will export the API with x-amazon-apigateway-authorizer extensions.
* postman
will export the API with Postman extensions, allowing for import to the Postman tool
*
*
* @param parameters
* A key-value map of query string parameters that specify properties of the export, depending on the
* requested exportType
. For exportType
swagger
, any combination
* of the following parameters are supported: integrations
will export the API with
* x-amazon-apigateway-integration extensions. authorizers
will export the API with
* x-amazon-apigateway-authorizer extensions. postman
will export the API with Postman
* extensions, allowing for import to the Postman tool
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder parameters(Map parameters);
/**
*
* The content-type of the export, for example application/json
. Currently
* application/json
and application/yaml
are supported for exportType
of
* swagger
. This should be specified in the Accept
header for direct API requests.
*
*
* @param accepts
* The content-type of the export, for example application/json
. Currently
* application/json
and application/yaml
are supported for
* exportType
of swagger
. This should be specified in the Accept
* header for direct API requests.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder accepts(String accepts);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String stageName;
private String exportType;
private Map parameters;
private String accepts;
private BuilderImpl() {
}
private BuilderImpl(GetExportRequest model) {
restApiId(model.restApiId);
stageName(model.stageName);
exportType(model.exportType);
parameters(model.parameters);
accepts(model.accepts);
}
public final String getRestApiId() {
return restApiId;
}
@Override
public final Builder restApiId(String restApiId) {
this.restApiId = restApiId;
return this;
}
public final void setRestApiId(String restApiId) {
this.restApiId = restApiId;
}
public final String getStageName() {
return stageName;
}
@Override
public final Builder stageName(String stageName) {
this.stageName = stageName;
return this;
}
public final void setStageName(String stageName) {
this.stageName = stageName;
}
public final String getExportType() {
return exportType;
}
@Override
public final Builder exportType(String exportType) {
this.exportType = exportType;
return this;
}
public final void setExportType(String exportType) {
this.exportType = exportType;
}
public final Map getParameters() {
return parameters;
}
@Override
public final Builder parameters(Map parameters) {
this.parameters = MapOfStringToStringCopier.copy(parameters);
return this;
}
public final void setParameters(Map parameters) {
this.parameters = MapOfStringToStringCopier.copy(parameters);
}
public final String getAccepts() {
return accepts;
}
@Override
public final Builder accepts(String accepts) {
this.accepts = accepts;
return this;
}
public final void setAccepts(String accepts) {
this.accepts = accepts;
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public GetExportRequest build() {
return new GetExportRequest(this);
}
}
}