software.amazon.awssdk.services.apigateway.model.CreateDocumentationPartRequest 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.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;
/**
*
* Creates a new documentation part of a given API.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateDocumentationPartRequest extends APIGatewayRequest implements
ToCopyableBuilder {
private final String restApiId;
private final DocumentationPartLocation location;
private final String properties;
private CreateDocumentationPartRequest(BuilderImpl builder) {
super(builder);
this.restApiId = builder.restApiId;
this.location = builder.location;
this.properties = builder.properties;
}
/**
*
* [Required] The string identifier of the associated RestApi.
*
*
* @return [Required] The string identifier of the associated RestApi.
*/
public String restApiId() {
return restApiId;
}
/**
*
* [Required] The location of the targeted API entity of the to-be-created documentation part.
*
*
* @return [Required] The location of the targeted API entity of the to-be-created documentation part.
*/
public DocumentationPartLocation location() {
return location;
}
/**
*
* [Required] The new documentation content map of the targeted API entity. Enclosed key-value pairs are
* API-specific, but only Swagger-compliant key-value pairs can be exported and, hence, published.
*
*
* @return [Required] The new documentation content map of the targeted API entity. Enclosed key-value pairs are
* API-specific, but only Swagger-compliant key-value pairs can be exported and, hence, published.
*/
public String properties() {
return properties;
}
@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(location());
hashCode = 31 * hashCode + Objects.hashCode(properties());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateDocumentationPartRequest)) {
return false;
}
CreateDocumentationPartRequest other = (CreateDocumentationPartRequest) obj;
return Objects.equals(restApiId(), other.restApiId()) && Objects.equals(location(), other.location())
&& Objects.equals(properties(), other.properties());
}
@Override
public String toString() {
return ToString.builder("CreateDocumentationPartRequest").add("RestApiId", restApiId()).add("Location", location())
.add("Properties", properties()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "restApiId":
return Optional.of(clazz.cast(restApiId()));
case "location":
return Optional.of(clazz.cast(location()));
case "properties":
return Optional.of(clazz.cast(properties()));
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);
/**
*
* [Required] The location of the targeted API entity of the to-be-created documentation part.
*
*
* @param location
* [Required] The location of the targeted API entity of the to-be-created documentation part.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder location(DocumentationPartLocation location);
/**
*
* [Required] The location of the targeted API entity of the to-be-created documentation part.
*
* This is a convenience that creates an instance of the {@link DocumentationPartLocation.Builder} avoiding the
* need to create one manually via {@link DocumentationPartLocation#builder()}.
*
* When the {@link Consumer} completes, {@link DocumentationPartLocation.Builder#build()} is called immediately
* and its result is passed to {@link #location(DocumentationPartLocation)}.
*
* @param location
* a consumer that will call methods on {@link DocumentationPartLocation.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #location(DocumentationPartLocation)
*/
default Builder location(Consumer location) {
return location(DocumentationPartLocation.builder().apply(location).build());
}
/**
*
* [Required] The new documentation content map of the targeted API entity. Enclosed key-value pairs are
* API-specific, but only Swagger-compliant key-value pairs can be exported and, hence, published.
*
*
* @param properties
* [Required] The new documentation content map of the targeted API entity. Enclosed key-value pairs are
* API-specific, but only Swagger-compliant key-value pairs can be exported and, hence, published.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder properties(String properties);
@Override
Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig);
}
static final class BuilderImpl extends APIGatewayRequest.BuilderImpl implements Builder {
private String restApiId;
private DocumentationPartLocation location;
private String properties;
private BuilderImpl() {
}
private BuilderImpl(CreateDocumentationPartRequest model) {
restApiId(model.restApiId);
location(model.location);
properties(model.properties);
}
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 DocumentationPartLocation.Builder getLocation() {
return location != null ? location.toBuilder() : null;
}
@Override
public final Builder location(DocumentationPartLocation location) {
this.location = location;
return this;
}
public final void setLocation(DocumentationPartLocation.BuilderImpl location) {
this.location = location != null ? location.build() : null;
}
public final String getProperties() {
return properties;
}
@Override
public final Builder properties(String properties) {
this.properties = properties;
return this;
}
public final void setProperties(String properties) {
this.properties = properties;
}
@Override
public Builder requestOverrideConfig(AwsRequestOverrideConfig awsRequestOverrideConfig) {
super.requestOverrideConfig(awsRequestOverrideConfig);
return this;
}
@Override
public Builder requestOverrideConfig(Consumer builderConsumer) {
super.requestOverrideConfig(builderConsumer);
return this;
}
@Override
public CreateDocumentationPartRequest build() {
return new CreateDocumentationPartRequest(this);
}
}
}