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