boto3_apigateway

Connection module for Amazon APIGateway using boto3.

Renamed from boto_apigateway to boto3_apigateway and rewritten to use the boto3 apigateway client APIs directly via saltext.boto3.utils.boto3mod. The legacy boto2 code path (object-style access, retry loops) has been removed.

depends:
  • boto3 >= 1.28.0

  • botocore >= 1.31.0

configuration:

This module accepts explicit API Gateway credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

If IAM roles are not used you need to specify them either in a pillar or in the minion’s config file:

apigateway.keyid: GKTADJGHEIQSXMKKRBJ08H
apigateway.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

A region may also be specified in the configuration:

apigateway.region: us-west-2

If a region is not specified, the default is us-east-1.

It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:

myprofile:
    keyid: GKTADJGHEIQSXMKKRBJ08H
    key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
    region: us-west-2

Added in version 1.0.0.

saltext.boto3.modules.boto3_apigateway.__virtual__()[source]

Only load if boto3 is available. Minimum version is enforced via the project’s pyproject.toml dependency declaration.

saltext.boto3.modules.boto3_apigateway.describe_apis(name=None, description=None, region=None, key=None, keyid=None, profile=None)[source]

Returns all rest apis in the defined region. If optional parameter name is included, returns all rest apis matching the name in the defined region.

CLI Example:

salt myminion boto3_apigateway.describe_apis

salt myminion boto3_apigateway.describe_apis name='api name'

salt myminion boto3_apigateway.describe_apis name='api name' description='desc str'
saltext.boto3.modules.boto3_apigateway.api_exists(name, description=None, region=None, key=None, keyid=None, profile=None)[source]

Check to see if the given Rest API Name and optionally description exists.

CLI Example:

salt myminion boto3_apigateway.exists myapi_name
saltext.boto3.modules.boto3_apigateway.create_api(name, description, cloneFrom=None, region=None, key=None, keyid=None, profile=None)[source]

Create a new REST API Service with the given name

Returns {created: True} if the rest api was created and returns {created: False} if the rest api was not created.

CLI Example:

salt myminion boto3_apigateway.create_api myapi_name api_description
saltext.boto3.modules.boto3_apigateway.delete_api(name, description=None, region=None, key=None, keyid=None, profile=None)[source]

Delete all REST API Service with the given name and an optional API description

Returns {deleted: True, count: deleted_count} if apis were deleted, and returns {deleted: False} if error or not found.

CLI Example:

salt myminion boto3_apigateway.delete_api myapi_name

salt myminion boto3_apigateway.delete_api myapi_name description='api description'
saltext.boto3.modules.boto3_apigateway.describe_api_resources(restApiId, region=None, key=None, keyid=None, profile=None)[source]

Given rest api id, return all resources for this api.

CLI Example:

salt myminion boto3_apigateway.describe_api_resources myapi_id
saltext.boto3.modules.boto3_apigateway.describe_api_resource(restApiId, path, region=None, key=None, keyid=None, profile=None)[source]

Given rest api id, and an absolute resource path, returns the resource id for the given path.

CLI Example:

salt myminion boto3_apigateway.describe_api_resource myapi_id resource_path
saltext.boto3.modules.boto3_apigateway.create_api_resources(restApiId, path, region=None, key=None, keyid=None, profile=None)[source]

Given rest api id, and an absolute resource path, create all the resources and return all resources in the resourcepath, returns False on failure.

CLI Example:

salt myminion boto3_apigateway.create_api_resources myapi_id resource_path
saltext.boto3.modules.boto3_apigateway.delete_api_resources(restApiId, path, region=None, key=None, keyid=None, profile=None)[source]

Given restApiId and an absolute resource path, delete the resources starting from the absolute resource path. If resourcepath is the root resource ‘/’, the function will return False. Returns False on failure.

CLI Example:

salt myminion boto3_apigateway.delete_api_resources myapi_id, resource_path
saltext.boto3.modules.boto3_apigateway.describe_api_resource_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)[source]

Given rest api id, resource path, and http method (must be one of DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT), return the method for the api/resource path if defined. Return False if method is not defined.

CLI Example:

salt myminion boto3_apigateway.describe_api_resource_method myapi_id resource_path httpmethod
saltext.boto3.modules.boto3_apigateway.describe_api_key(apiKey, region=None, key=None, keyid=None, profile=None)[source]

Gets info about the given api key

CLI Example:

salt myminion boto3_apigateway.describe_api_key apigw_api_key
saltext.boto3.modules.boto3_apigateway.describe_api_keys(region=None, key=None, keyid=None, profile=None)[source]

Gets information about the defined API Keys. Return list of apiKeys.

CLI Example:

salt myminion boto3_apigateway.describe_api_keys
saltext.boto3.modules.boto3_apigateway.create_api_key(name, description, enabled=True, stageKeys=None, region=None, key=None, keyid=None, profile=None)[source]

Create an API key given name and description.

An optional enabled argument can be provided. If provided, the valid values are True|False. This argument defaults to True.

An optional stageKeys argument can be provided in the form of list of dictionary with ‘restApiId’ and ‘stageName’ as keys.

CLI Example:

salt myminion boto3_apigateway.create_api_key name description

salt myminion boto3_apigateway.create_api_key name description enabled=False

salt myminion boto3_apigateway.create_api_key name description \
     stageKeys='[{"restApiId": "id", "stageName": "stagename"}]'
saltext.boto3.modules.boto3_apigateway.delete_api_key(apiKey, region=None, key=None, keyid=None, profile=None)[source]

Deletes a given apiKey

CLI Example:

salt myminion boto3_apigateway.delete_api_key apikeystring
saltext.boto3.modules.boto3_apigateway.update_api_key_description(apiKey, description, region=None, key=None, keyid=None, profile=None)[source]

update the given apiKey with the given description.

CLI Example:

salt myminion boto3_apigateway.update_api_key_description api_key description
saltext.boto3.modules.boto3_apigateway.enable_api_key(apiKey, region=None, key=None, keyid=None, profile=None)[source]

enable the given apiKey.

CLI Example:

salt myminion boto3_apigateway.enable_api_key api_key
saltext.boto3.modules.boto3_apigateway.disable_api_key(apiKey, region=None, key=None, keyid=None, profile=None)[source]

disable the given apiKey.

CLI Example:

salt myminion boto3_apigateway.enable_api_key api_key
saltext.boto3.modules.boto3_apigateway.associate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None)[source]

associate the given stagekeyslist to the given apiKey.

CLI Example:

salt myminion boto3_apigateway.associate_stagekeys_api_key \
        api_key '["restapi id/stage name", ...]'
saltext.boto3.modules.boto3_apigateway.disassociate_api_key_stagekeys(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None)[source]

disassociate the given stagekeyslist to the given apiKey.

CLI Example:

salt myminion boto3_apigateway.disassociate_stagekeys_api_key \
        api_key '["restapi id/stage name", ...]'
saltext.boto3.modules.boto3_apigateway.describe_api_deployments(restApiId, region=None, key=None, keyid=None, profile=None)[source]

Gets information about the defined API Deployments. Return list of api deployments.

CLI Example:

salt myminion boto3_apigateway.describe_api_deployments restApiId
saltext.boto3.modules.boto3_apigateway.describe_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)[source]

Get API deployment for a given restApiId and deploymentId.

CLI Example:

salt myminion boto3_apigateway.describe_api_deployent restApiId deploymentId
saltext.boto3.modules.boto3_apigateway.activate_api_deployment(restApiId, stageName, deploymentId, region=None, key=None, keyid=None, profile=None)[source]

Activates previously deployed deployment for a given stage

CLI Example:

salt myminion boto3_apigateway.activate_api_deployent restApiId stagename deploymentId
saltext.boto3.modules.boto3_apigateway.create_api_deployment(restApiId, stageName, stageDescription='', description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None)[source]

Creates a new API deployment.

CLI Example:

salt myminion boto3_apigateway.create_api_deployent restApiId stagename stageDescription='' \
description='' cacheClusterEnabled=True|False cacheClusterSize=0.5 variables='{"name": "value"}'
saltext.boto3.modules.boto3_apigateway.delete_api_deployment(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)[source]

Deletes API deployment for a given restApiId and deploymentID

CLI Example:

salt myminion boto3_apigateway.delete_api_deployent restApiId deploymentId
saltext.boto3.modules.boto3_apigateway.overwrite_api_stage_variables(restApiId, stageName, variables, region=None, key=None, keyid=None, profile=None)[source]

Overwrite the stage variables for the given restApiId and stage name with the given variables, variables must be in the form of a dictionary. Overwrite will always remove all the existing stage variables associated with the given restApiId and stage name, follow by the adding of all the variables specified in the variables dictionary

CLI Example:

salt myminion boto3_apigateway.overwrite_api_stage_variables restApiId stageName variables='{"name": "value"}'
saltext.boto3.modules.boto3_apigateway.describe_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None)[source]

Get API stage for a given apiID and stage name

CLI Example:

salt myminion boto3_apigateway.describe_api_stage restApiId stageName
saltext.boto3.modules.boto3_apigateway.describe_api_stages(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)[source]

Get all API stages for a given apiID and deploymentID

CLI Example:

salt myminion boto3_apigateway.describe_api_stages restApiId deploymentId
saltext.boto3.modules.boto3_apigateway.create_api_stage(restApiId, stageName, deploymentId, description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None)[source]

Creates a new API stage for a given restApiId and deploymentId.

CLI Example:

salt myminion boto3_apigateway.create_api_stage restApiId stagename deploymentId \
    description='' cacheClusterEnabled=True|False cacheClusterSize='0.5' variables='{"name": "value"}'
saltext.boto3.modules.boto3_apigateway.delete_api_stage(restApiId, stageName, region=None, key=None, keyid=None, profile=None)[source]

Deletes stage identified by stageName from API identified by restApiId

CLI Example:

salt myminion boto3_apigateway.delete_api_stage restApiId stageName
saltext.boto3.modules.boto3_apigateway.flush_api_stage_cache(restApiId, stageName, region=None, key=None, keyid=None, profile=None)[source]

Flushes cache for the stage identified by stageName from API identified by restApiId

CLI Example:

salt myminion boto3_apigateway.flush_api_stage_cache restApiId stageName
saltext.boto3.modules.boto3_apigateway.create_api_method(restApiId, resourcePath, httpMethod, authorizationType, apiKeyRequired=False, requestParameters=None, requestModels=None, region=None, key=None, keyid=None, profile=None)[source]

Creates API method for a resource in the given API

CLI Example:

salt myminion boto3_apigateway.create_api_method restApiId resourcePath, httpMethod, authorizationType, \
    apiKeyRequired=False, requestParameters='{"name", "value"}', requestModels='{"content-type", "value"}'
saltext.boto3.modules.boto3_apigateway.describe_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)[source]

Get API method for a resource in the given API

CLI Example:

salt myminion boto3_apigateway.describe_api_method restApiId resourcePath httpMethod
saltext.boto3.modules.boto3_apigateway.delete_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)[source]

Delete API method for a resource in the given API

CLI Example:

salt myminion boto3_apigateway.delete_api_method restApiId resourcePath httpMethod
saltext.boto3.modules.boto3_apigateway.create_api_method_response(restApiId, resourcePath, httpMethod, statusCode, responseParameters=None, responseModels=None, region=None, key=None, keyid=None, profile=None)[source]

Create API method response for a method on a given resource in the given API

CLI Example:

salt myminion boto3_apigateway.create_api_method_response restApiId resourcePath httpMethod \
       statusCode responseParameters='{"name", "True|False"}' responseModels='{"content-type", "model"}'
saltext.boto3.modules.boto3_apigateway.delete_api_method_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)[source]

Delete API method response for a resource in the given API

CLI Example:

salt myminion boto3_apigateway.delete_api_method_response restApiId resourcePath httpMethod statusCode
saltext.boto3.modules.boto3_apigateway.describe_api_method_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)[source]

Get API method response for a resource in the given API

CLI Example:

salt myminion boto3_apigateway.describe_api_method_response restApiId resourcePath httpMethod statusCode
saltext.boto3.modules.boto3_apigateway.describe_api_models(restApiId, region=None, key=None, keyid=None, profile=None)[source]

Get all models for a given API

CLI Example:

salt myminion boto3_apigateway.describe_api_models restApiId
saltext.boto3.modules.boto3_apigateway.describe_api_model(restApiId, modelName, flatten=True, region=None, key=None, keyid=None, profile=None)[source]

Get a model by name for a given API

CLI Example:

salt myminion boto3_apigateway.describe_api_model restApiId modelName [True]
saltext.boto3.modules.boto3_apigateway.api_model_exists(restApiId, modelName, region=None, key=None, keyid=None, profile=None)[source]

Check to see if the given modelName exists in the given restApiId

CLI Example:

salt myminion boto3_apigateway.api_model_exists restApiId modelName
saltext.boto3.modules.boto3_apigateway.update_api_model_schema(restApiId, modelName, schema, region=None, key=None, keyid=None, profile=None)[source]

update the schema (in python dictionary format) for the given model in the given restApiId

CLI Example:

salt myminion boto3_apigateway.update_api_model_schema restApiId modelName schema
saltext.boto3.modules.boto3_apigateway.delete_api_model(restApiId, modelName, region=None, key=None, keyid=None, profile=None)[source]

Delete a model identified by name in a given API

CLI Example:

salt myminion boto3_apigateway.delete_api_model restApiId modelName
saltext.boto3.modules.boto3_apigateway.create_api_model(restApiId, modelName, modelDescription, schema, contentType='application/json', region=None, key=None, keyid=None, profile=None)[source]

Create a new model in a given API with a given schema, currently only contentType supported is ‘application/json’

CLI Example:

salt myminion boto3_apigateway.create_api_model restApiId modelName modelDescription '<schema>' 'content-type'
saltext.boto3.modules.boto3_apigateway.describe_api_integration(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)[source]

Get an integration for a given method in a given API

CLI Example:

salt myminion boto3_apigateway.describe_api_integration restApiId resourcePath httpMethod
saltext.boto3.modules.boto3_apigateway.describe_api_integration_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)[source]

Get an integration response for a given method in a given API

CLI Example:

salt myminion boto3_apigateway.describe_api_integration_response restApiId resourcePath httpMethod statusCode
saltext.boto3.modules.boto3_apigateway.delete_api_integration(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)[source]

Deletes an integration for a given method in a given API

CLI Example:

salt myminion boto3_apigateway.delete_api_integration restApiId resourcePath httpMethod
saltext.boto3.modules.boto3_apigateway.delete_api_integration_response(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)[source]

Deletes an integration response for a given method in a given API

CLI Example:

salt myminion boto3_apigateway.delete_api_integration_response restApiId resourcePath httpMethod statusCode
saltext.boto3.modules.boto3_apigateway.create_api_integration(restApiId, resourcePath, httpMethod, integrationType, integrationHttpMethod, uri, credentials, requestParameters=None, requestTemplates=None, region=None, key=None, keyid=None, profile=None)[source]

Creates an integration for a given method in a given API. If integrationType is MOCK, uri and credential parameters will be ignored.

uri is in the form of (substitute APIGATEWAY_REGION and LAMBDA_FUNC_ARN) “arn:aws:apigateway:APIGATEWAY_REGION:lambda:path/2015-03-31/functions/LAMBDA_FUNC_ARN/invocations”

credentials is in the form of an iam role name or role arn.

CLI Example:

salt myminion boto3_apigateway.create_api_integration restApiId resourcePath httpMethod \
                     integrationType integrationHttpMethod uri credentials ['{}' ['{}']]
saltext.boto3.modules.boto3_apigateway.create_api_integration_response(restApiId, resourcePath, httpMethod, statusCode, selectionPattern, responseParameters=None, responseTemplates=None, region=None, key=None, keyid=None, profile=None)[source]

Creates an integration response for a given method in a given API

CLI Example:

salt myminion boto3_apigateway.create_api_integration_response restApiId resourcePath httpMethod \
                    statusCode selectionPattern ['{}' ['{}']]
saltext.boto3.modules.boto3_apigateway.describe_usage_plans(name=None, plan_id=None, region=None, key=None, keyid=None, profile=None)[source]

Returns a list of existing usage plans, optionally filtered to match a given plan name

CLI Example:

salt myminion boto3_apigateway.describe_usage_plans
salt myminion boto3_apigateway.describe_usage_plans name='usage plan name'
salt myminion boto3_apigateway.describe_usage_plans plan_id='usage plan id'
saltext.boto3.modules.boto3_apigateway.create_usage_plan(name, description=None, throttle=None, quota=None, region=None, key=None, keyid=None, profile=None)[source]

Creates a new usage plan with throttling and quotas optionally applied

name

Name of the usage plan

throttle

A dictionary consisting of the following keys:

rateLimit

requests per second at steady rate, float

burstLimit

maximum number of requests per second, integer

quota

A dictionary consisting of the following keys:

limit

number of allowed requests per specified quota period [required if quota parameter is present]

offset

number of requests to be subtracted from limit at the beginning of the period [optional]

period

quota period, must be one of DAY, WEEK, or MONTH. [required if quota parameter is present

CLI Example:

salt myminion boto3_apigateway.create_usage_plan name='usage plan name' throttle='{"rateLimit": 10.0, "burstLimit": 10}'
saltext.boto3.modules.boto3_apigateway.update_usage_plan(plan_id, throttle=None, quota=None, region=None, key=None, keyid=None, profile=None)[source]

Updates an existing usage plan with throttling and quotas

plan_id

Id of the created usage plan

throttle

A dictionary consisting of the following keys:

rateLimit

requests per second at steady rate, float

burstLimit

maximum number of requests per second, integer

quota

A dictionary consisting of the following keys:

limit

number of allowed requests per specified quota period [required if quota parameter is present]

offset

number of requests to be subtracted from limit at the beginning of the period [optional]

period

quota period, must be one of DAY, WEEK, or MONTH. [required if quota parameter is present

CLI Example:

salt myminion boto3_apigateway.update_usage_plan plan_id='usage plan id' throttle='{"rateLimit": 10.0, "burstLimit": 10}'
saltext.boto3.modules.boto3_apigateway.delete_usage_plan(plan_id, region=None, key=None, keyid=None, profile=None)[source]

Deletes usage plan identified by plan_id

CLI Example:

salt myminion boto3_apigateway.delete_usage_plan plan_id='usage plan id'
saltext.boto3.modules.boto3_apigateway.attach_usage_plan_to_apis(plan_id, apis, region=None, key=None, keyid=None, profile=None)[source]

Attaches given usage plan to each of the apis provided in a list of apiId and stage values

apis

a list of dictionaries, where each dictionary contains the following:

apiId

a string, which is the id of the created API in AWS ApiGateway

stage

a string, which is the stage that the created API is deployed to.

CLI Example:

salt myminion boto3_apigateway.attach_usage_plan_to_apis plan_id='usage plan id' apis='[{"apiId": "some id 1", "stage": "some stage 1"}]'
saltext.boto3.modules.boto3_apigateway.detach_usage_plan_from_apis(plan_id, apis, region=None, key=None, keyid=None, profile=None)[source]

Detaches given usage plan from each of the apis provided in a list of apiId and stage values

apis

a list of dictionaries, where each dictionary contains the following:

apiId

a string, which is the id of the created API in AWS ApiGateway

stage

a string, which is the stage that the created API is deployed to.

CLI Example:

salt myminion boto3_apigateway.detach_usage_plan_to_apis plan_id='usage plan id' apis='[{"apiId": "some id 1", "stage": "some stage 1"}]'