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 14// Changes information about a Resource resource. 15func (c *Client) UpdateResource(ctx context.Context, params *UpdateResourceInput, optFns ...func(*Options)) (*UpdateResourceOutput, error) { 16 if params == nil { 17 params = &UpdateResourceInput{} 18 } 19 20 result, metadata, err := c.invokeOperation(ctx, "UpdateResource", params, optFns, addOperationUpdateResourceMiddlewares) 21 if err != nil { 22 return nil, err 23 } 24 25 out := result.(*UpdateResourceOutput) 26 out.ResultMetadata = metadata 27 return out, nil 28} 29 30// Request to change information about a Resource resource. 31type UpdateResourceInput struct { 32 33 // [Required] The identifier of the Resource resource. 34 // 35 // This member is required. 36 ResourceId *string 37 38 // [Required] The string identifier of the associated RestApi. 39 // 40 // This member is required. 41 RestApiId *string 42 43 // A list of update operations to be applied to the specified resource and in the 44 // order specified in this list. 45 PatchOperations []types.PatchOperation 46} 47 48// Represents an API resource. Create an API 49// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html) 50type UpdateResourceOutput struct { 51 52 // The resource's identifier. 53 Id *string 54 55 // The parent resource's identifier. 56 ParentId *string 57 58 // The full path for this resource. 59 Path *string 60 61 // The last path segment for this resource. 62 PathPart *string 63 64 // Gets an API resource's method of a given HTTP verb. The resource methods are a 65 // map of methods indexed by methods' HTTP verbs enabled on the resource. This 66 // method map is included in the 200 OK response of the GET 67 // /restapis/{restapi_id}/resources/{resource_id} or GET 68 // /restapis/{restapi_id}/resources/{resource_id}?embed=methods request. 69 // Example: 70 // Get the GET method of an API resource 71 // 72 // Request 73 // 74 // GET 75 // /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET HTTP/1.1 Content-Type: 76 // application/json Host: apigateway.us-east-1.amazonaws.com X-Amz-Date: 77 // 20170223T031827Z Authorization: AWS4-HMAC-SHA256 78 // Credential={access_key_ID}/20170223/us-east-1/apigateway/aws4_request, 79 // SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash} 80 // 81 // Response 82 // 83 // { 84 // "_links": { "curies": [ { "href": 85 // "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-{rel}.html", 86 // "name": "integration", "templated": true }, { "href": 87 // "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html", 88 // "name": "integrationresponse", "templated": true }, { "href": 89 // "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-{rel}.html", 90 // "name": "method", "templated": true }, { "href": 91 // "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-method-response-{rel}.html", 92 // "name": "methodresponse", "templated": true } ], "self": { "href": 93 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET", "name": "GET", "title": 94 // "GET" }, "integration:put": { "href": 95 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, 96 // "method:delete": { "href": 97 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "method:integration": 98 // { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, 99 // "method:responses": { "href": 100 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", "name": 101 // "200", "title": "200" }, "method:update": { "href": 102 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET" }, "methodresponse:put": 103 // { "href": 104 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/{status_code}", 105 // "templated": true } }, "apiKeyRequired": false, "authorizationType": "NONE", 106 // "httpMethod": "GET", "_embedded": { "method:integration": { "_links": { "self": 107 // { "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, 108 // "integration:delete": { "href": 109 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, 110 // "integration:responses": { "href": 111 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", 112 // "name": "200", "title": "200" }, "integration:update": { "href": 113 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration" }, 114 // "integrationresponse:put": { "href": 115 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/{status_code}", 116 // "templated": true } }, "cacheKeyParameters": [], "cacheNamespace": "3kzxbg5sa2", 117 // "credentials": "arn:aws:iam::123456789012:role/apigAwsProxyRole", "httpMethod": 118 // "POST", "passthroughBehavior": "WHEN_NO_MATCH", "requestParameters": { 119 // "integration.request.header.Content-Type": "'application/x-amz-json-1.1'" }, 120 // "requestTemplates": { "application/json": "{\n}" }, "type": "AWS", "uri": 121 // "arn:aws:apigateway:us-east-1:kinesis:action/ListStreams", "_embedded": { 122 // "integration:responses": { "_links": { "self": { "href": 123 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200", 124 // "name": "200", "title": "200" }, "integrationresponse:delete": { "href": 125 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" 126 // }, "integrationresponse:update": { "href": 127 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200" 128 // } }, "responseParameters": { "method.response.header.Content-Type": 129 // "'application/xml'" }, "responseTemplates": { "application/json": 130 // "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in 131 // $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n" 132 // }, "statusCode": "200" } } }, "method:responses": { "_links": { "self": { 133 // "href": "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200", 134 // "name": "200", "title": "200" }, "methodresponse:delete": { "href": 135 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" }, 136 // "methodresponse:update": { "href": 137 // "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/responses/200" } }, 138 // "responseModels": { "application/json": "Empty" }, "responseParameters": { 139 // "method.response.header.Content-Type": false }, "statusCode": "200" } } } If the 140 // OPTIONS is enabled on the resource, you can follow the example here to get that 141 // method. Just replace the GET of the last path segment in the request URL with 142 // OPTIONS. 143 ResourceMethods map[string]types.Method 144 145 // Metadata pertaining to the operation's result. 146 ResultMetadata middleware.Metadata 147} 148 149func addOperationUpdateResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { 150 err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateResource{}, middleware.After) 151 if err != nil { 152 return err 153 } 154 err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateResource{}, middleware.After) 155 if err != nil { 156 return err 157 } 158 if err = addSetLoggerMiddleware(stack, options); err != nil { 159 return err 160 } 161 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 162 return err 163 } 164 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 165 return err 166 } 167 if err = addResolveEndpointMiddleware(stack, options); err != nil { 168 return err 169 } 170 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 171 return err 172 } 173 if err = addRetryMiddlewares(stack, options); err != nil { 174 return err 175 } 176 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 177 return err 178 } 179 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 180 return err 181 } 182 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 183 return err 184 } 185 if err = addClientUserAgent(stack); err != nil { 186 return err 187 } 188 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 189 return err 190 } 191 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 192 return err 193 } 194 if err = addOpUpdateResourceValidationMiddleware(stack); err != nil { 195 return err 196 } 197 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateResource(options.Region), middleware.Before); err != nil { 198 return err 199 } 200 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 201 return err 202 } 203 if err = addResponseErrorMiddleware(stack); err != nil { 204 return err 205 } 206 if err = addAcceptHeader(stack); err != nil { 207 return err 208 } 209 if err = addRequestResponseLogging(stack, options); err != nil { 210 return err 211 } 212 return nil 213} 214 215func newServiceMetadataMiddleware_opUpdateResource(region string) *awsmiddleware.RegisterServiceMetadata { 216 return &awsmiddleware.RegisterServiceMetadata{ 217 Region: region, 218 ServiceID: ServiceID, 219 SigningName: "apigateway", 220 OperationName: "UpdateResource", 221 } 222} 223