software.amazon.awssdk.services.apigateway.model.GetDocumentationPartResponse Maven / Gradle / Ivy
Show all versions of apigateway Show documentation
/*
* Copyright 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.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A documentation part for a targeted API entity.
*
*
*
* A documentation part consists of a content map (properties
) and a target (location
). The
* target specifies an API entity to which the documentation content applies. The supported API entity types are
* API
, AUTHORIZER
, MODEL
, RESOURCE
, METHOD
,
* PATH_PARAMETER
, QUERY_PARAMETER
, REQUEST_HEADER
, REQUEST_BODY
,
* RESPONSE
, RESPONSE_HEADER
, and RESPONSE_BODY
. Valid location
* fields depend on the API entity type. All valid fields are not required.
*
*
* The content map is a JSON string of API-specific key-value pairs. Although an API can use any shape for the content
* map, only the OpenAPI-compliant documentation fields will be injected into the associated API entity definition in
* the exported OpenAPI definition file.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetDocumentationPartResponse extends ApiGatewayResponse implements
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(GetDocumentationPartResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField LOCATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("location")
.getter(getter(GetDocumentationPartResponse::location)).setter(setter(Builder::location))
.constructor(DocumentationPartLocation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("location").build()).build();
private static final SdkField PROPERTIES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("properties").getter(getter(GetDocumentationPartResponse::properties))
.setter(setter(Builder::properties))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("properties").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, LOCATION_FIELD,
PROPERTIES_FIELD));
private final String id;
private final DocumentationPartLocation location;
private final String properties;
private GetDocumentationPartResponse(BuilderImpl builder) {
super(builder);
this.id = builder.id;
this.location = builder.location;
this.properties = builder.properties;
}
/**
*
* The DocumentationPart identifier, generated by API Gateway when the DocumentationPart
is
* created.
*
*
* @return The DocumentationPart identifier, generated by API Gateway when the DocumentationPart
* is created.
*/
public final String id() {
return id;
}
/**
*
* The location of the API entity to which the documentation applies. Valid fields depend on the targeted API entity
* type. All the valid location fields are not required. If not explicitly specified, a valid location field is
* treated as a wildcard and associated documentation content may be inherited by matching entities, unless
* overridden.
*
*
* @return The location of the API entity to which the documentation applies. Valid fields depend on the targeted
* API entity type. All the valid location fields are not required. If not explicitly specified, a valid
* location field is treated as a wildcard and associated documentation content may be inherited by matching
* entities, unless overridden.
*/
public final DocumentationPartLocation location() {
return location;
}
/**
*
* A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded as a
* JSON string, e.g., "{ \"description\": \"The API does ...\" }"
. Only OpenAPI-compliant
* documentation-related fields from the properties map are exported and, hence, published as
* part of the API entity definitions, while the original documentation parts are exported in a OpenAPI extension of
* x-amazon-apigateway-documentation
.
*
*
* @return A content map of API-specific key-value pairs describing the targeted API entity. The map must be encoded
* as a JSON string, e.g., "{ \"description\": \"The API does ...\" }"
. Only OpenAPI-compliant
* documentation-related fields from the properties map are exported and, hence,
* published as part of the API entity definitions, while the original documentation parts are exported in a
* OpenAPI extension of x-amazon-apigateway-documentation
.
*/
public final String properties() {
return properties;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(location());
hashCode = 31 * hashCode + Objects.hashCode(properties());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetDocumentationPartResponse)) {
return false;
}
GetDocumentationPartResponse other = (GetDocumentationPartResponse) obj;
return Objects.equals(id(), other.id()) && Objects.equals(location(), other.location())
&& Objects.equals(properties(), other.properties());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("GetDocumentationPartResponse").add("Id", id()).add("Location", location())
.add("Properties", properties()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "location":
return Optional.ofNullable(clazz.cast(location()));
case "properties":
return Optional.ofNullable(clazz.cast(properties()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function