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// Represents an update integration.
15func (c *Client) UpdateIntegration(ctx context.Context, params *UpdateIntegrationInput, optFns ...func(*Options)) (*UpdateIntegrationOutput, error) {
16	if params == nil {
17		params = &UpdateIntegrationInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "UpdateIntegration", params, optFns, addOperationUpdateIntegrationMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*UpdateIntegrationOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30// Represents an update integration request.
31type UpdateIntegrationInput struct {
32
33	// [Required] Represents an update integration request's HTTP method.
34	//
35	// This member is required.
36	HttpMethod *string
37
38	// [Required] Represents an update integration request's resource identifier.
39	//
40	// This member is required.
41	ResourceId *string
42
43	// [Required] The string identifier of the associated RestApi.
44	//
45	// This member is required.
46	RestApiId *string
47
48	// A list of update operations to be applied to the specified resource and in the
49	// order specified in this list.
50	PatchOperations []types.PatchOperation
51}
52
53// Represents an HTTP, HTTP_PROXY, AWS, AWS_PROXY, or Mock integration. In the API
54// Gateway console, the built-in Lambda integration is an AWS integration. Creating
55// an API
56// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html)
57type UpdateIntegrationOutput struct {
58
59	// A list of request parameters whose values API Gateway caches. To be valid values
60	// for cacheKeyParameters, these parameters must also be specified for
61	// MethodrequestParameters.
62	CacheKeyParameters []string
63
64	// Specifies a group of related cached parameters. By default, API Gateway uses the
65	// resource ID as the cacheNamespace. You can specify the same cacheNamespace
66	// across resources to return the same cached data for requests to different
67	// resources.
68	CacheNamespace *string
69
70	// The (id
71	// (https://docs.aws.amazon.com/apigateway/api-reference/resource/vpc-link/#id)) of
72	// the VpcLink used for the integration when connectionType=VPC_LINK and undefined,
73	// otherwise.
74	ConnectionId *string
75
76	// The type of the network connection to the integration endpoint. The valid value
77	// is INTERNET for connections through the public routable internet or VPC_LINK for
78	// private connections between API Gateway and a network load balancer in a VPC.
79	// The default value is INTERNET.
80	ConnectionType types.ConnectionType
81
82	// Specifies how to handle request payload content type conversions. Supported
83	// values are CONVERT_TO_BINARY and CONVERT_TO_TEXT, with the following
84	// behaviors:
85	//
86	// * CONVERT_TO_BINARY: Converts a request payload from a
87	// Base64-encoded string to the corresponding binary blob.
88	//
89	// * CONVERT_TO_TEXT:
90	// Converts a request payload from a binary blob to a Base64-encoded string.
91	//
92	// If
93	// this property is not defined, the request payload will be passed through from
94	// the method request to integration request without modification, provided that
95	// the passthroughBehavior is configured to support payload pass-through.
96	ContentHandling types.ContentHandlingStrategy
97
98	// Specifies the credentials required for the integration, if any. For AWS
99	// integrations, three options are available. To specify an IAM Role for API
100	// Gateway to assume, use the role's Amazon Resource Name (ARN). To require that
101	// the caller's identity be passed through from the request, specify the string
102	// arn:aws:iam::\*:user/\*. To use resource-based permissions on supported AWS
103	// services, specify null.
104	Credentials *string
105
106	// Specifies the integration's HTTP method type.
107	HttpMethod *string
108
109	// Specifies the integration's responses.
110	// Example: Get integration responses of a
111	// method
112	//
113	// Request
114	//
115	//     GET
116	// /restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200
117	// HTTP/1.1 Content-Type: application/json Host: apigateway.us-east-1.amazonaws.com
118	// X-Amz-Date: 20160607T191449Z Authorization: AWS4-HMAC-SHA256
119	// Credential={access_key_ID}/20160607/us-east-1/apigateway/aws4_request,
120	// SignedHeaders=content-type;host;x-amz-date, Signature={sig4_hash}
121	//
122	// Response
123	//
124	// The
125	// successful response returns 200 OK status and a payload as follows: { "_links":
126	// { "curies": { "href":
127	// "https://docs.aws.amazon.com/apigateway/latest/developerguide/restapi-integration-response-{rel}.html",
128	// "name": "integrationresponse", "templated": true }, "self": { "href":
129	// "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200",
130	// "title": "200" }, "integrationresponse:delete": { "href":
131	// "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200"
132	// }, "integrationresponse:update": { "href":
133	// "/restapis/fugvjdxtri/resources/3kzxbg5sa2/methods/GET/integration/responses/200"
134	// } }, "responseParameters": { "method.response.header.Content-Type":
135	// "'application/xml'" }, "responseTemplates": { "application/json":
136	// "$util.urlDecode(\"%3CkinesisStreams%3E#foreach($stream in
137	// $input.path('$.StreamNames'))%3Cstream%3E%3Cname%3E$stream%3C/name%3E%3C/stream%3E#end%3C/kinesisStreams%3E\")\n"
138	// }, "statusCode": "200" }Creating an API
139	// (https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-create-api.html)
140	IntegrationResponses map[string]types.IntegrationResponse
141
142	// Specifies how the method request body of an unmapped content type will be passed
143	// through the integration request to the back end without transformation. A
144	// content type is unmapped if no mapping template is defined in the integration or
145	// the content type does not match any of the mapped content types, as specified in
146	// requestTemplates. The valid value is one of the following:
147	//
148	// * WHEN_NO_MATCH:
149	// passes the method request body through the integration request to the back end
150	// without transformation when the method request content type does not match any
151	// content type associated with the mapping templates defined in the integration
152	// request.
153	//
154	// * WHEN_NO_TEMPLATES: passes the method request body through the
155	// integration request to the back end without transformation when no mapping
156	// template is defined in the integration request. If a template is defined when
157	// this option is selected, the method request of an unmapped content-type will be
158	// rejected with an HTTP 415 Unsupported Media Type response.
159	//
160	// * NEVER: rejects the
161	// method request with an HTTP 415 Unsupported Media Type response when either the
162	// method request content type does not match any content type associated with the
163	// mapping templates defined in the integration request or no mapping template is
164	// defined in the integration request.
165	PassthroughBehavior *string
166
167	// A key-value map specifying request parameters that are passed from the method
168	// request to the back end. The key is an integration request parameter name and
169	// the associated value is a method request parameter value or static value that
170	// must be enclosed within single quotes and pre-encoded as required by the back
171	// end. The method request parameter value must match the pattern of
172	// method.request.{location}.{name}, where location is querystring, path, or header
173	// and name must be a valid and unique method request parameter name.
174	RequestParameters map[string]string
175
176	// Represents a map of Velocity templates that are applied on the request payload
177	// based on the value of the Content-Type header sent by the client. The content
178	// type value is the key in this map, and the template (as a String) is the value.
179	RequestTemplates map[string]string
180
181	// Custom timeout between 50 and 29,000 milliseconds. The default value is 29,000
182	// milliseconds or 29 seconds.
183	TimeoutInMillis int32
184
185	// Specifies the TLS configuration for an integration.
186	TlsConfig *types.TlsConfig
187
188	// Specifies an API method integration type. The valid value is one of the
189	// following:
190	//
191	// * AWS: for integrating the API method request with an AWS service
192	// action, including the Lambda function-invoking action. With the Lambda
193	// function-invoking action, this is referred to as the Lambda custom integration.
194	// With any other AWS service action, this is known as AWS integration.
195	//
196	// *
197	// AWS_PROXY: for integrating the API method request with the Lambda
198	// function-invoking action with the client request passed through as-is. This
199	// integration is also referred to as the Lambda proxy integration.
200	//
201	// * HTTP: for
202	// integrating the API method request with an HTTP endpoint, including a private
203	// HTTP endpoint within a VPC. This integration is also referred to as the HTTP
204	// custom integration.
205	//
206	// * HTTP_PROXY: for integrating the API method request with
207	// an HTTP endpoint, including a private HTTP endpoint within a VPC, with the
208	// client request passed through as-is. This is also referred to as the HTTP proxy
209	// integration.
210	//
211	// * MOCK: for integrating the API method request with API Gateway as
212	// a "loop-back" endpoint without invoking any backend.
213	//
214	// For the HTTP and HTTP
215	// proxy integrations, each integration can specify a protocol (http/https), port
216	// and path. Standard 80 and 443 ports are supported as well as custom ports above
217	// 1024. An HTTP or HTTP proxy integration with a connectionType of VPC_LINK is
218	// referred to as a private integration and uses a VpcLink to connect API Gateway
219	// to a network load balancer of a VPC.
220	Type types.IntegrationType
221
222	// Specifies Uniform Resource Identifier (URI) of the integration endpoint.
223	//
224	// * For
225	// HTTP or HTTP_PROXY integrations, the URI must be a fully formed, encoded HTTP(S)
226	// URL according to the RFC-3986 specification
227	// (https://en.wikipedia.org/wiki/Uniform_Resource_Identifier), for either standard
228	// integration, where connectionType is not VPC_LINK, or private integration, where
229	// connectionType is VPC_LINK. For a private HTTP integration, the URI is not used
230	// for routing.
231	//
232	// * For AWS or AWS_PROXY integrations, the URI is of the form
233	// arn:aws:apigateway:{region}:{subdomain.service|service}:path|action/{service_api}.
234	// Here, {Region} is the API Gateway region (e.g., us-east-1); {service} is the
235	// name of the integrated AWS service (e.g., s3); and {subdomain} is a designated
236	// subdomain supported by certain AWS service for fast host-name lookup. action can
237	// be used for an AWS service action-based API, using an
238	// Action={name}&{p1}={v1}&p2={v2}... query string. The ensuing {service_api}
239	// refers to a supported action {name} plus any required input parameters.
240	// Alternatively, path can be used for an AWS service path-based API. The ensuing
241	// service_api refers to the path to an AWS service resource, including the region
242	// of the integrated AWS service, if applicable. For example, for integration with
243	// the S3 API of GetObject
244	// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html), the uri
245	// can be either
246	// arn:aws:apigateway:us-west-2:s3:action/GetObject&Bucket={bucket}&Key={key} or
247	// arn:aws:apigateway:us-west-2:s3:path/{bucket}/{key}
248	Uri *string
249
250	// Metadata pertaining to the operation's result.
251	ResultMetadata middleware.Metadata
252}
253
254func addOperationUpdateIntegrationMiddlewares(stack *middleware.Stack, options Options) (err error) {
255	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateIntegration{}, middleware.After)
256	if err != nil {
257		return err
258	}
259	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateIntegration{}, middleware.After)
260	if err != nil {
261		return err
262	}
263	if err = addSetLoggerMiddleware(stack, options); err != nil {
264		return err
265	}
266	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
267		return err
268	}
269	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
270		return err
271	}
272	if err = addResolveEndpointMiddleware(stack, options); err != nil {
273		return err
274	}
275	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
276		return err
277	}
278	if err = addRetryMiddlewares(stack, options); err != nil {
279		return err
280	}
281	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
282		return err
283	}
284	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
285		return err
286	}
287	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
288		return err
289	}
290	if err = addClientUserAgent(stack); err != nil {
291		return err
292	}
293	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
294		return err
295	}
296	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
297		return err
298	}
299	if err = addOpUpdateIntegrationValidationMiddleware(stack); err != nil {
300		return err
301	}
302	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIntegration(options.Region), middleware.Before); err != nil {
303		return err
304	}
305	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
306		return err
307	}
308	if err = addResponseErrorMiddleware(stack); err != nil {
309		return err
310	}
311	if err = addAcceptHeader(stack); err != nil {
312		return err
313	}
314	if err = addRequestResponseLogging(stack, options); err != nil {
315		return err
316	}
317	return nil
318}
319
320func newServiceMetadataMiddleware_opUpdateIntegration(region string) *awsmiddleware.RegisterServiceMetadata {
321	return &awsmiddleware.RegisterServiceMetadata{
322		Region:        region,
323		ServiceID:     ServiceID,
324		SigningName:   "apigateway",
325		OperationName: "UpdateIntegration",
326	}
327}
328