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, c.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 noSmithyDocumentSerde 43} 44 45// A documentation part for a targeted API entity. A documentation part consists of 46// a content map (properties) and a target (location). The target specifies an API 47// entity to which the documentation content applies. The supported API entity 48// types are API, AUTHORIZER, MODEL, RESOURCE, METHOD, PATH_PARAMETER, 49// QUERY_PARAMETER, REQUEST_HEADER, REQUEST_BODY, RESPONSE, RESPONSE_HEADER, and 50// RESPONSE_BODY. Valid location fields depend on the API entity type. All valid 51// fields are not required. The content map is a JSON string of API-specific 52// key-value pairs. Although an API can use any shape for the content map, only the 53// OpenAPI-compliant documentation fields will be injected into the associated API 54// entity definition in the exported OpenAPI definition file. Documenting an API 55// (https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-documenting-api.html), 56// DocumentationParts 57type GetDocumentationPartOutput struct { 58 59 // The DocumentationPart identifier, generated by API Gateway when the 60 // DocumentationPart is created. 61 Id *string 62 63 // The location of the API entity to which the documentation applies. Valid fields 64 // depend on the targeted API entity type. All the valid location fields are not 65 // required. If not explicitly specified, a valid location field is treated as a 66 // wildcard and associated documentation content may be inherited by matching 67 // entities, unless overridden. 68 Location *types.DocumentationPartLocation 69 70 // A content map of API-specific key-value pairs describing the targeted API 71 // entity. The map must be encoded as a JSON string, e.g., "{ \"description\": 72 // \"The API does ...\" }". Only OpenAPI-compliant documentation-related fields 73 // from the properties map are exported and, hence, published as part of the API 74 // entity definitions, while the original documentation parts are exported in a 75 // OpenAPI extension of x-amazon-apigateway-documentation. 76 Properties *string 77 78 // Metadata pertaining to the operation's result. 79 ResultMetadata middleware.Metadata 80 81 noSmithyDocumentSerde 82} 83 84func (c *Client) addOperationGetDocumentationPartMiddlewares(stack *middleware.Stack, options Options) (err error) { 85 err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDocumentationPart{}, middleware.After) 86 if err != nil { 87 return err 88 } 89 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDocumentationPart{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 if err = addSetLoggerMiddleware(stack, options); err != nil { 94 return err 95 } 96 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 97 return err 98 } 99 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 100 return err 101 } 102 if err = addResolveEndpointMiddleware(stack, options); err != nil { 103 return err 104 } 105 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 106 return err 107 } 108 if err = addRetryMiddlewares(stack, options); err != nil { 109 return err 110 } 111 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 112 return err 113 } 114 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 118 return err 119 } 120 if err = addClientUserAgent(stack); err != nil { 121 return err 122 } 123 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = addOpGetDocumentationPartValidationMiddleware(stack); err != nil { 130 return err 131 } 132 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentationPart(options.Region), middleware.Before); err != nil { 133 return err 134 } 135 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 136 return err 137 } 138 if err = addResponseErrorMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addAcceptHeader(stack); err != nil { 142 return err 143 } 144 if err = addRequestResponseLogging(stack, options); err != nil { 145 return err 146 } 147 return nil 148} 149 150func newServiceMetadataMiddleware_opGetDocumentationPart(region string) *awsmiddleware.RegisterServiceMetadata { 151 return &awsmiddleware.RegisterServiceMetadata{ 152 Region: region, 153 ServiceID: ServiceID, 154 SigningName: "apigateway", 155 OperationName: "GetDocumentationPart", 156 } 157} 158