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 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 in the API Gateway API Reference.If you specify theAuthorizerId 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 = '{{ region }}' 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.apigateway.methods
WHERE
Identifier = '{{ rest_api_id }}|{{ resource_id }}|{{ http_method }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
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