methods
Creates, updates, deletes, gets or lists a methods resource.
Overview
| Name | methods |
| Type | Resource |
| Id | aws.apigateway.methods |
Fields
The following fields are returned by SELECT queries:
- get_method
| Name | Datatype | Description |
|---|---|---|
api_key_required | boolean | A boolean flag specifying whether a valid ApiKey is required to invoke this method. |
authorization_scopes | array | A list of authorization scopes configured on the method. The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes. |
authorization_type | string | The method's authorization type. Valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, CUSTOM for using a custom authorizer, or COGNITO_USER_POOLS for using a Cognito user pool. |
authorizer_id | string | The identifier of an Authorizer to use on this method. The authorizationType must be CUSTOM. |
http_method | string | The method's HTTP verb. |
method_integration | object | Represents an HTTP, HTTP_PROXY, AWS, AWS_PROXY, or Mock integration. |
method_responses | object | Gets a method response associated with a given HTTP status code. |
operation_name | string | A human-friendly operation identifier for the method. For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example. |
request_models | object | A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key). |
request_parameters | object | A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of method.request.{location}.{name}, where location is querystring, path, or header and name is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (true) or optional (false). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates. |
request_validator_id | string | The identifier of a RequestValidator for request validation. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_method | select | restapi_id, resource_id, http_method, region | Describe an existing Method resource. | |
update_method | update | restapi_id, resource_id, http_method, region | Updates an existing Method resource. | |
put_method | replace | restapi_id, resource_id, http_method, region, authorizationType | Add a method to an existing Resource resource. | |
delete_method | delete | restapi_id, resource_id, http_method, region | Deletes an existing Method resource. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
http_method | string | The HTTP verb of the Method resource. |
region | string | AWS region (default: us-east-1) |
resource_id | string | The Resource identifier for the Method resource. |
restapi_id | string | The string identifier of the associated RestApi. |
SELECT examples
- get_method
Describe an existing Method resource.
SELECT
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id
FROM aws.apigateway.methods
WHERE restapi_id = '{{ restapi_id }}' -- required
AND resource_id = '{{ resource_id }}' -- required
AND http_method = '{{ http_method }}' -- required
AND region = '{{ region }}' -- required
;
UPDATE examples
- update_method
Updates an existing Method resource.
UPDATE aws.apigateway.methods
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
RETURNING
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id;
REPLACE examples
- put_method
Add a method to an existing Resource resource.
REPLACE aws.apigateway.methods
SET
authorizationType = '{{ authorizationType }}',
authorizerId = '{{ authorizerId }}',
apiKeyRequired = {{ apiKeyRequired }},
operationName = '{{ operationName }}',
requestParameters = '{{ requestParameters }}',
requestModels = '{{ requestModels }}',
requestValidatorId = '{{ requestValidatorId }}',
authorizationScopes = '{{ authorizationScopes }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
AND authorizationType = '{{ authorizationType }}' --required
RETURNING
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id;
DELETE examples
- delete_method
Deletes an existing Method resource.
DELETE FROM aws.apigateway.methods
WHERE restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
;