x-yc-apigateway-integration:http extension
Written by
Updated at September 2, 2024
The x-yc-apigateway-integration:http
extension redirects a request to the relevant URL.
You can add an extension to a specification using the specification constructor.
Supported parameters
The table below lists the parameters specific to API Gateway API gateways. You can find the description of other parameters in the OpenAPI 3.0 specification
Parameter | Type | Description |
---|---|---|
url |
string |
URL to redirect the invocation to. url is used for parameter substitution. |
method |
enum |
This is an optional parameter. It sets the HTTP method used for the invocation. If it is not specified, the method to send a request to API Gateway is used by default. |
headers |
map[string](string | string[]) |
HTTP headers to provide. By default, the headers of the original request are not provided. headers is used for parameter substitution. |
query |
map[string](string | string[]) |
Query parameters to provide. By default, the query parameters of the original request are not provided. query is used for parameter substitution. |
timeouts |
object |
This is an optional parameter. It sets the read and connect invocation timeouts in seconds. |
omitEmptyHeaders |
boolean |
This is an optional parameter. If the value is true , empty headers are not provided. |
omitEmptyQueryParameters |
boolean |
This is an optional parameter. If the value is true , empty query parameters are not provided. |
serviceAccountId |
string |
Service account ID. It is used for authorization when accessing the specified URL. The value of the serviceAccountId parent parameter is ignored. |
Extension specification
Specification example:
x-yc-apigateway-integration:
type: http
url: https://example.com/backend1
method: POST
headers:
Authorization: Basic ZjTqBB3f$IF9gdYAGlMrs2********
query:
my_param: myInfo
timeouts:
connect: 0.5
read: 5
Extension features:
- If the value of a header or query parameter is an array, it is provided as a single row separated by commas.
- By default, any headers other than
User-Agent
and the original request query parameters are not provided. To send all original request headers and query parameters that are not overridden in the specification, add'*': '*'
to thequery
andheaders
sections. If you need to prevent certain headers from being provided, set their values to empty and theomitEmptyHeaders
field value, totrue
. Similarly, you can omit certain query parameters by using theomitEmptyQueryParameters
field. - The
User-Agent
header is provided by default unless it is overridden in the specification. - To redirect all requests, use greedy parameters and the generalized HTTP method.
Below, there is an example of proxying all requests to https://example.com
with the Content-Type
header and the param
query parameter provided:
paths:
/{path+}:
x-yc-apigateway-any-method:
x-yc-apigateway-integration:
type: http
url: https://example.com/{path}
headers:
Content-Type: '{Content-Type}'
query:
param: '{param}'
timeouts:
connect: 0.5
read: 5
parameters:
- name: Content-Type
in: header
required: false
schema:
type: string
- name: path
in: path
required: false
schema:
type: string
- name: param
in: query
required: false
schema:
type: string
Here is another example of proxying all requests to https://example.com
, where:
- All headers, except
Foo-Header
, and all query parameters, exceptfoo_param
, are provided. - The
Bar-Header
header and thebar_param
query parameter with an array as a value are added.
paths:
/{path+}:
x-yc-apigateway-any-method:
x-yc-apigateway-integration:
type: http
url: https://example.com/{path}
query:
'*': '*'
foo_param: ""
bar_param: [ "one", "two" ]
single_param: three
headers:
Host: example.com
'*': '*'
Foo-Header: ""
Bar-Header: [ "one", "two" ]
Single-header: three
omitEmptyHeaders: true
omitEmptyQueryParameters: true
parameters:
- name: path
in: path
required: false
schema:
type: string