1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package apigateway
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/apigateway/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14func (c *Client) GetDocumentationPart(ctx context.Context, params *GetDocumentationPartInput, optFns ...func(*Options)) (*GetDocumentationPartOutput, error) {
15	if params == nil {
16		params = &GetDocumentationPartInput{}
17	}
18
19	result, metadata, err := c.invokeOperation(ctx, "GetDocumentationPart", params, optFns, addOperationGetDocumentationPartMiddlewares)
20	if err != nil {
21		return nil, err
22	}
23
24	out := result.(*GetDocumentationPartOutput)
25	out.ResultMetadata = metadata
26	return out, nil
27}
28
29// Gets a specified documentation part of a given API.
30type GetDocumentationPartInput struct {
31
32	// [Required] The string identifier of the associated RestApi.
33	//
34	// This member is required.
35	DocumentationPartId *string
36
37	// [Required] The string identifier of the associated RestApi.
38	//
39	// This member is required.
40	RestApiId *string
41}
42
43// A documentation part for a targeted API entity. A documentation part consists of
44// a content map (properties) and a target (location). The target specifies an API
45// entity to which the documentation content applies. The supported API entity
46// types are API, AUTHORIZER, MODEL, RESOURCE, METHOD, PATH_PARAMETER,
47// QUERY_PARAMETER, REQUEST_HEADER, REQUEST_BODY, RESPONSE, RESPONSE_HEADER, and
48// RESPONSE_BODY. Valid location fields depend on the API entity type. All valid
49// fields are not required. The content map is a JSON string of API-specific
50// key-value pairs. Although an API can use any shape for the content map, only the
51// OpenAPI-compliant documentation fields will be injected into the associated API
52// entity definition in the exported OpenAPI definition file. Documenting an API
53// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-documenting-api.html),
54// DocumentationParts
55type GetDocumentationPartOutput struct {
56
57	// The DocumentationPart identifier, generated by API Gateway when the
58	// DocumentationPart is created.
59	Id *string
60
61	// The location of the API entity to which the documentation applies. Valid fields
62	// depend on the targeted API entity type. All the valid location fields are not
63	// required. If not explicitly specified, a valid location field is treated as a
64	// wildcard and associated documentation content may be inherited by matching
65	// entities, unless overridden.
66	Location *types.DocumentationPartLocation
67
68	// A content map of API-specific key-value pairs describing the targeted API
69	// entity. The map must be encoded as a JSON string, e.g., "{ \"description\":
70	// \"The API does ...\" }". Only OpenAPI-compliant documentation-related fields
71	// from the properties map are exported and, hence, published as part of the API
72	// entity definitions, while the original documentation parts are exported in a
73	// OpenAPI extension of x-amazon-apigateway-documentation.
74	Properties *string
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78}
79
80func addOperationGetDocumentationPartMiddlewares(stack *middleware.Stack, options Options) (err error) {
81	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDocumentationPart{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDocumentationPart{}, middleware.After)
86	if err != nil {
87		return err
88	}
89	if err = addSetLoggerMiddleware(stack, options); err != nil {
90		return err
91	}
92	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
93		return err
94	}
95	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
96		return err
97	}
98	if err = addResolveEndpointMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
102		return err
103	}
104	if err = addRetryMiddlewares(stack, options); err != nil {
105		return err
106	}
107	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
111		return err
112	}
113	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
114		return err
115	}
116	if err = addClientUserAgent(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addOpGetDocumentationPartValidationMiddleware(stack); err != nil {
126		return err
127	}
128	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentationPart(options.Region), middleware.Before); err != nil {
129		return err
130	}
131	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addResponseErrorMiddleware(stack); err != nil {
135		return err
136	}
137	if err = addAcceptHeader(stack); err != nil {
138		return err
139	}
140	if err = addRequestResponseLogging(stack, options); err != nil {
141		return err
142	}
143	return nil
144}
145
146func newServiceMetadataMiddleware_opGetDocumentationPart(region string) *awsmiddleware.RegisterServiceMetadata {
147	return &awsmiddleware.RegisterServiceMetadata{
148		Region:        region,
149		ServiceID:     ServiceID,
150		SigningName:   "apigateway",
151		OperationName: "GetDocumentationPart",
152	}
153}
154