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

software.amazon.awssdk.services.apigateway.model.GetDocumentationPartResponse 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.28.3
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((GetDocumentationPartResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends ApiGatewayResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The DocumentationPart identifier, generated by API Gateway when the DocumentationPart is * created. *

* * @param id * The DocumentationPart identifier, generated by API Gateway when the * DocumentationPart is created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String 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. *

* * @param location * 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 Returns a reference to this object so that method calls can be chained together. */ Builder location(DocumentationPartLocation location); /** *

* 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. *

* 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().applyMutation(location).build()); } /** *

* 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. *

* * @param properties * 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 Returns a reference to this object so that method calls can be chained together. */ Builder properties(String properties); } static final class BuilderImpl extends ApiGatewayResponse.BuilderImpl implements Builder { private String id; private DocumentationPartLocation location; private String properties; private BuilderImpl() { } private BuilderImpl(GetDocumentationPartResponse model) { super(model); id(model.id); location(model.location); properties(model.properties); } public final String getId() { return id; } @Override public final Builder id(String id) { this.id = id; return this; } public final void setId(String id) { this.id = id; } 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 GetDocumentationPartResponse build() { return new GetDocumentationPartResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy