methods
Creates, updates, deletes or gets a method resource or lists methods in a region
Overview
| Name | methods |
| Type | Resource |
| Description | The ``AWS::ApiGateway::Method`` resource creates API Gateway methods that define the parameters and body that clients must send in their requests. |
| Id | awscc.apigateway.methods |
Fields
| Name | Datatype | Description |
|---|---|---|
integration | object | ``Integration`` is a property of the [AWS::ApiGateway::Method](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-method.html) resource that specifies information about the target backend that a method calls. |
operation_name | string | |
request_models | object | |
rest_api_id | string | |
authorization_scopes | array | |
request_validator_id | string | |
request_parameters | object | |
method_responses | array | |
authorizer_id | string | |
resource_id | string | |
api_key_required | boolean | |
authorization_type | string | The method's authorization type. This parameter is required. For valid values, see [Method](https://docs.aws.amazon.com/apigateway/latest/api/API_Method.html) in the *API Gateway API Reference*.<br />If you specify the ``AuthorizerId`` property, specify ``CUSTOM`` or ``COGNITO_USER_POOLS`` for this property. |
http_method | string | |
region | string | AWS region. |
For more information, see AWS::ApiGateway::Method.
Methods
| Name | Accessible by | Required Params |
|---|---|---|
create_resource | INSERT | RestApiId, ResourceId, HttpMethod, region |
delete_resource | DELETE | Identifier, region |
update_resource | UPDATE | Identifier, PatchDocument, region |
get_resource | SELECT | Identifier, region |
SELECT examples
Gets all properties from an individual method.
SELECT
region,
integration,
operation_name,
request_models,
rest_api_id,
authorization_scopes,
request_validator_id,
request_parameters,
method_responses,
authorizer_id,
resource_id,
api_key_required,
authorization_type,
http_method
FROM awscc.apigateway.methods
WHERE
region = 'us-east-1' AND
Identifier = '{{ rest_api_id }}|{{ resource_id }}|{{ http_method }}';
INSERT example
Use the following StackQL query and manifest file to create a new method resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.apigateway.methods (
RestApiId,
ResourceId,
HttpMethod,
region
)
SELECT
'{{ rest_api_id }}',
'{{ resource_id }}',
'{{ http_method }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.apigateway.methods (
Integration,
OperationName,
RequestModels,
RestApiId,
AuthorizationScopes,
RequestValidatorId,
RequestParameters,
MethodResponses,
AuthorizerId,
ResourceId,
ApiKeyRequired,
AuthorizationType,
HttpMethod,
region
)
SELECT
'{{ integration }}',
'{{ operation_name }}',
'{{ request_models }}',
'{{ rest_api_id }}',
'{{ authorization_scopes }}',
'{{ request_validator_id }}',
'{{ request_parameters }}',
'{{ method_responses }}',
'{{ authorizer_id }}',
'{{ resource_id }}',
'{{ api_key_required }}',
'{{ authorization_type }}',
'{{ http_method }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: method
props:
- name: integration
value:
cache_namespace: '{{ cache_namespace }}'
connection_type: '{{ connection_type }}'
integration_responses:
- response_templates: {}
selection_pattern: '{{ selection_pattern }}'
content_handling: '{{ content_handling }}'
response_parameters: {}
status_code: '{{ status_code }}'
integration_http_method: '{{ integration_http_method }}'
uri: '{{ uri }}'
passthrough_behavior: '{{ passthrough_behavior }}'
request_parameters: {}
connection_id: '{{ connection_id }}'
type: '{{ type }}'
cache_key_parameters:
- '{{ cache_key_parameters[0] }}'
content_handling: '{{ content_handling }}'
request_templates: {}
timeout_in_millis: '{{ timeout_in_millis }}'
credentials: '{{ credentials }}'
- name: operation_name
value: '{{ operation_name }}'
- name: request_models
value: {}
- name: rest_api_id
value: '{{ rest_api_id }}'
- name: authorization_scopes
value:
- '{{ authorization_scopes[0] }}'
- name: request_validator_id
value: '{{ request_validator_id }}'
- name: request_parameters
value: {}
- name: method_responses
value:
- response_parameters: {}
status_code: '{{ status_code }}'
response_models: {}
- name: authorizer_id
value: '{{ authorizer_id }}'
- name: resource_id
value: '{{ resource_id }}'
- name: api_key_required
value: '{{ api_key_required }}'
- name: authorization_type
value: '{{ authorization_type }}'
- name: http_method
value: '{{ http_method }}'
UPDATE example
Use the following StackQL query and manifest file to update a method resource, using stack-deploy.
/*+ update */
UPDATE awscc.apigateway.methods
SET PatchDocument = string('{{ {
"Integration": integration,
"OperationName": operation_name,
"RequestModels": request_models,
"AuthorizationScopes": authorization_scopes,
"RequestValidatorId": request_validator_id,
"RequestParameters": request_parameters,
"MethodResponses": method_responses,
"AuthorizerId": authorizer_id,
"ApiKeyRequired": api_key_required,
"AuthorizationType": authorization_type
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ rest_api_id }}|{{ resource_id }}|{{ http_method }}';
DELETE example
/*+ delete */
DELETE FROM awscc.apigateway.methods
WHERE
Identifier = '{{ rest_api_id }}|{{ resource_id }}|{{ http_method }}' AND
region = 'us-east-1';
Permissions
To operate on the methods resource, the following permissions are required:
- Read
- Create
- Update
- Delete
apigateway:GET
apigateway:PUT,
apigateway:GET,
iam:PassRole
apigateway:GET,
apigateway:DELETE,
apigateway:PUT,
iam:PassRole
apigateway:DELETE