software.amazon.awssdk.services.apigateway.model.ImportDocumentationPartsRequest 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.nio.ByteBuffer;
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.core.runtime.StandardMemberCopier;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Import documentation parts from an external (e.g., Swagger) definition file.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class ImportDocumentationPartsRequest extends APIGatewayRequest implements
ToCopyableBuilder {
private final String restApiId;
private final String mode;
private final Boolean failOnWarnings;
private final ByteBuffer body;
private ImportDocumentationPartsRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.mode = builder.mode;
this.failOnWarnings = builder.failOnWarnings;
this.body = builder.body;
}
/**
*
* [Required] The string identifier of the associated RestApi.
*
*
* @return [Required] The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the existing one.
* The default value is MERGE
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link PutMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeString}.
*
*
* @return A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the
* existing one. The default value is MERGE
.
* @see PutMode
*/
public PutMode mode() {
return PutMode.fromValue(mode);
}
/**
*
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the existing one.
* The default value is MERGE
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link PutMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeString}.
*
*
* @return A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the
* existing one. The default value is MERGE
.
* @see PutMode
*/
public String modeString() {
return mode;
}
/**
*
* A query parameter to specify whether to rollback the documentation importation (true
) or not (
* false
) when a warning is encountered. The default value is false
.
*
*
* @return A query parameter to specify whether to rollback the documentation importation (true
) or not
* (false
) when a warning is encountered. The default value is false
.
*/
public Boolean failOnWarnings() {
return failOnWarnings;
}
/**
*
* [Required] Raw byte array representing the to-be-imported documentation parts. To import from a Swagger file,
* this is a JSON object.
*
*
* This method will return a new read-only {@code ByteBuffer} each time it is invoked.
*
*
* @return [Required] Raw byte array representing the to-be-imported documentation parts. To import from a Swagger
* file, this is a JSON object.
*/
public ByteBuffer body() {
return body == null ? null : body.asReadOnlyBuffer();
}
@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(modeString());
hashCode = 31 * hashCode + Objects.hashCode(failOnWarnings());
hashCode = 31 * hashCode + Objects.hashCode(body());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ImportDocumentationPartsRequest)) {
return false;
}
ImportDocumentationPartsRequest other = (ImportDocumentationPartsRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(modeString(), other.modeString())
&& Objects.equals(failOnWarnings(), other.failOnWarnings()) && Objects.equals(body(), other.body());
}
@Override
public String toString() {
return ToString.builder("ImportDocumentationPartsRequest").add("RestApiId", restApiId()).add("Mode", modeString())
.add("FailOnWarnings", failOnWarnings()).add("Body", body()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.of(clazz.cast(restApiId()));
case "mode":
return Optional.of(clazz.cast(modeString()));
case "failOnWarnings":
return Optional.of(clazz.cast(failOnWarnings()));
case "body":
return Optional.of(clazz.cast(body()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayRequest.Builder, CopyableBuilder {
/**
*
* [Required] The string identifier of the associated RestApi.
*
*
* @param restApiId
* [Required] 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);
/**
*
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the existing
* one. The default value is MERGE
.
*
*
* @param mode
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the
* existing one. The default value is MERGE
.
* @see PutMode
* @return Returns a reference to this object so that method calls can be chained together.
* @see PutMode
*/
Builder mode(String mode);
/**
*
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the existing
* one. The default value is MERGE
.
*
*
* @param mode
* A query parameter to indicate whether to overwrite (OVERWRITE
) any existing
* DocumentationParts definition or to merge (MERGE
) the new definition into the
* existing one. The default value is MERGE
.
* @see PutMode
* @return Returns a reference to this object so that method calls can be chained together.
* @see PutMode
*/
Builder mode(PutMode mode);
/**
*
* A query parameter to specify whether to rollback the documentation importation (true
) or not (
* false
) when a warning is encountered. The default value is false
.
*
*
* @param failOnWarnings
* A query parameter to specify whether to rollback the documentation importation (true
) or
* not (false
) when a warning is encountered. The default value is false
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder failOnWarnings(Boolean failOnWarnings);
/**
*
* [Required] Raw byte array representing the to-be-imported documentation parts. To import from a Swagger file,
* this is a JSON object.
*
*
* To preserve immutability, the remaining bytes in the provided buffer will be copied into a new buffer when
* set.
*
*
* @param body
* [Required] Raw byte array representing the to-be-imported documentation parts. To import from a
* Swagger file, this is a JSON object.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder body(ByteBuffer body);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private String mode;
private Boolean failOnWarnings;
private ByteBuffer body;
private BuilderImpl() {
}
private BuilderImpl(ImportDocumentationPartsRequest model) {
restApiId(model.restApiId);
mode(model.mode);
failOnWarnings(model.failOnWarnings);
body(model.body);
}
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 getMode() {
return mode;
}
@Override
public final Builder mode(String mode) {
this.mode = mode;
return this;
}
@Override
public final Builder mode(PutMode mode) {
this.mode(mode.toString());
return this;
}
public final void setMode(String mode) {
this.mode = mode;
}
public final Boolean getFailOnWarnings() {
return failOnWarnings;
}
@Override
public final Builder failOnWarnings(Boolean failOnWarnings) {
this.failOnWarnings = failOnWarnings;
return this;
}
public final void setFailOnWarnings(Boolean failOnWarnings) {
this.failOnWarnings = failOnWarnings;
}
public final ByteBuffer getBody() {
return body;
}
@Override
public final Builder body(ByteBuffer body) {
this.body = StandardMemberCopier.copy(body);
return this;
}
public final void setBody(ByteBuffer body) {
this.body = StandardMemberCopier.copy(body);
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public ImportDocumentationPartsRequest build() {
return new ImportDocumentationPartsRequest(this);
}
}
}