Connection module for Amazon APIGateway
New in version 2016.11.0.
boto >= 2.8.0
boto3 >= 1.2.1
botocore >= 1.4.49
This module accepts explicit Lambda credentials but can also utilize IAM roles assigned to the instance trough 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
Changed in version 2015.8.0: All methods now return a dictionary. Create and delete methods return:
created: true
or
created: false
error:
message: error message
Request methods (e.g., describe_apigateway
) return:
apigateway:
- {...}
- {...}
or
error:
message: error message
salt.modules.boto_apigateway.
activate_api_deployment
(restApiId, stageName, deploymentId, region=None, key=None, keyid=None, profile=None)¶Activates previously deployed deployment for a given stage
CLI Example:
salt myminion boto_apigateway.activate_api_deployent restApiId stagename deploymentId
salt.modules.boto_apigateway.
api_exists
(name, description=None, region=None, key=None, keyid=None, profile=None)¶Check to see if the given Rest API Name and optionally description exists.
CLI Example:
salt myminion boto_apigateway.exists myapi_name
salt.modules.boto_apigateway.
api_model_exists
(restApiId, modelName, region=None, key=None, keyid=None, profile=None)¶Check to see if the given modelName exists in the given restApiId
CLI Example:
salt myminion boto_apigateway.api_model_exists restApiId modelName
salt.modules.boto_apigateway.
associate_api_key_stagekeys
(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None)¶associate the given stagekeyslist to the given apiKey.
CLI Example:
salt myminion boto_apigateway.associate_stagekeys_api_key \
api_key '["restapi id/stage name", ...]'
salt.modules.boto_apigateway.
attach_usage_plan_to_apis
(plan_id, apis, region=None, key=None, keyid=None, profile=None)¶Attaches given usage plan to each of the apis provided in a list of apiId and stage values
New in version 2017.7.0.
a list of dictionaries, where each dictionary contains the following:
a string, which is the id of the created API in AWS ApiGateway
a string, which is the stage that the created API is deployed to.
CLI Example:
salt myminion boto_apigateway.attach_usage_plan_to_apis plan_id='usage plan id' apis='[{"apiId": "some id 1", "stage": "some stage 1"}]'
salt.modules.boto_apigateway.
create_api
(name, description, cloneFrom=None, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.create_api myapi_name api_description
salt.modules.boto_apigateway.
create_api_deployment
(restApiId, stageName, stageDescription='', description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None)¶Creates a new API deployment.
CLI Example:
salt myminion boto_apigateway.create_api_deployent restApiId stagename stageDescription='' \
description='' cacheClusterEnabled=True|False cacheClusterSize=0.5 variables='{"name": "value"}'
salt.modules.boto_apigateway.
create_api_integration
(restApiId, resourcePath, httpMethod, integrationType, integrationHttpMethod, uri, credentials, requestParameters=None, requestTemplates=None, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.create_api_integration restApiId resourcePath httpMethod \
integrationType integrationHttpMethod uri credentials ['{}' ['{}']]
salt.modules.boto_apigateway.
create_api_integration_response
(restApiId, resourcePath, httpMethod, statusCode, selectionPattern, responseParameters=None, responseTemplates=None, region=None, key=None, keyid=None, profile=None)¶Creates an integration response for a given method in a given API
CLI Example:
salt myminion boto_apigateway.create_api_integration_response restApiId resourcePath httpMethod \
statusCode selectionPattern ['{}' ['{}']]
salt.modules.boto_apigateway.
create_api_key
(name, description, enabled=True, stageKeys=None, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.create_api_key name description
salt myminion boto_apigateway.create_api_key name description enabled=False
salt myminion boto_apigateway.create_api_key name description \
stageKeys='[{"restApiId": "id", "stageName": "stagename"}]'
salt.modules.boto_apigateway.
create_api_method
(restApiId, resourcePath, httpMethod, authorizationType, apiKeyRequired=False, requestParameters=None, requestModels=None, region=None, key=None, keyid=None, profile=None)¶Creates API method for a resource in the given API
CLI Example:
salt myminion boto_apigateway.create_api_method restApiId resourcePath, httpMethod, authorizationType, \
apiKeyRequired=False, requestParameters='{"name", "value"}', requestModels='{"content-type", "value"}'
salt.modules.boto_apigateway.
create_api_method_response
(restApiId, resourcePath, httpMethod, statusCode, responseParameters=None, responseModels=None, region=None, key=None, keyid=None, profile=None)¶Create API method response for a method on a given resource in the given API
CLI Example:
salt myminion boto_apigateway.create_api_method_response restApiId resourcePath httpMethod \
statusCode responseParameters='{"name", "True|False"}' responseModels='{"content-type", "model"}'
salt.modules.boto_apigateway.
create_api_model
(restApiId, modelName, modelDescription, schema, contentType='application/json', region=None, key=None, keyid=None, profile=None)¶Create a new model in a given API with a given schema, currently only contentType supported is 'application/json'
CLI Example:
salt myminion boto_apigateway.create_api_model restApiId modelName modelDescription '<schema>' 'content-type'
salt.modules.boto_apigateway.
create_api_resources
(restApiId, path, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.create_api_resources myapi_id resource_path
salt.modules.boto_apigateway.
create_api_stage
(restApiId, stageName, deploymentId, description='', cacheClusterEnabled=False, cacheClusterSize='0.5', variables=None, region=None, key=None, keyid=None, profile=None)¶Creates a new API stage for a given restApiId and deploymentId.
CLI Example:
salt myminion boto_apigateway.create_api_stage restApiId stagename deploymentId \
description='' cacheClusterEnabled=True|False cacheClusterSize='0.5' variables='{"name": "value"}'
salt.modules.boto_apigateway.
create_usage_plan
(name, description=None, throttle=None, quota=None, region=None, key=None, keyid=None, profile=None)¶Creates a new usage plan with throttling and quotas optionally applied
New in version 2017.7.0.
Name of the usage plan
A dictionary consisting of the following keys:
requests per second at steady rate, float
maximum number of requests per second, integer
A dictionary consisting of the following keys:
number of allowed requests per specified quota period [required if quota parameter is present]
number of requests to be subtracted from limit at the beginning of the period [optional]
quota period, must be one of DAY, WEEK, or MONTH. [required if quota parameter is present
CLI Example:
salt myminion boto_apigateway.create_usage_plan name='usage plan name' throttle='{"rateLimit": 10.0, "burstLimit": 10}'
salt.modules.boto_apigateway.
delete_api
(name, description=None, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.delete_api myapi_name
salt myminion boto_apigateway.delete_api myapi_name description='api description'
salt.modules.boto_apigateway.
delete_api_deployment
(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)¶Deletes API deployment for a given restApiId and deploymentID
CLI Example:
salt myminion boto_apigateway.delete_api_deployent restApiId deploymentId
salt.modules.boto_apigateway.
delete_api_integration
(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)¶Deletes an integration for a given method in a given API
CLI Example:
salt myminion boto_apigateway.delete_api_integration restApiId resourcePath httpMethod
salt.modules.boto_apigateway.
delete_api_integration_response
(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)¶Deletes an integration response for a given method in a given API
CLI Example:
salt myminion boto_apigateway.delete_api_integration_response restApiId resourcePath httpMethod statusCode
salt.modules.boto_apigateway.
delete_api_key
(apiKey, region=None, key=None, keyid=None, profile=None)¶Deletes a given apiKey
CLI Example:
salt myminion boto_apigateway.delete_api_key apikeystring
salt.modules.boto_apigateway.
delete_api_method
(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)¶Delete API method for a resource in the given API
CLI Example:
salt myminion boto_apigateway.delete_api_method restApiId resourcePath httpMethod
salt.modules.boto_apigateway.
delete_api_method_response
(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)¶Delete API method response for a resource in the given API
CLI Example:
salt myminion boto_apigateway.delete_api_method_response restApiId resourcePath httpMethod statusCode
salt.modules.boto_apigateway.
delete_api_model
(restApiId, modelName, region=None, key=None, keyid=None, profile=None)¶Delete a model identified by name in a given API
CLI Example:
salt myminion boto_apigateway.delete_api_model restApiId modelName
salt.modules.boto_apigateway.
delete_api_resources
(restApiId, path, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.delete_api_resources myapi_id, resource_path
salt.modules.boto_apigateway.
delete_api_stage
(restApiId, stageName, region=None, key=None, keyid=None, profile=None)¶Deletes stage identified by stageName from API identified by restApiId
CLI Example:
salt myminion boto_apigateway.delete_api_stage restApiId stageName
salt.modules.boto_apigateway.
delete_usage_plan
(plan_id, region=None, key=None, keyid=None, profile=None)¶Deletes usage plan identified by plan_id
New in version 2017.7.0.
CLI Example:
salt myminion boto_apigateway.delete_usage_plan plan_id='usage plan id'
salt.modules.boto_apigateway.
describe_api_deployment
(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)¶Get API deployment for a given restApiId and deploymentId.
CLI Example:
salt myminion boto_apigateway.describe_api_deployent restApiId deploymentId
salt.modules.boto_apigateway.
describe_api_deployments
(restApiId, region=None, key=None, keyid=None, profile=None)¶Gets information about the defined API Deployments. Return list of api deployments.
CLI Example:
salt myminion boto_apigateway.describe_api_deployments restApiId
salt.modules.boto_apigateway.
describe_api_integration
(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)¶Get an integration for a given method in a given API
CLI Example:
salt myminion boto_apigateway.describe_api_integration restApiId resourcePath httpMethod
salt.modules.boto_apigateway.
describe_api_integration_response
(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)¶Get an integration response for a given method in a given API
CLI Example:
salt myminion boto_apigateway.describe_api_integration_response restApiId resourcePath httpMethod statusCode
salt.modules.boto_apigateway.
describe_api_key
(apiKey, region=None, key=None, keyid=None, profile=None)¶Gets info about the given api key
CLI Example:
salt myminion boto_apigateway.describe_api_key apigw_api_key
salt.modules.boto_apigateway.
describe_api_keys
(region=None, key=None, keyid=None, profile=None)¶Gets information about the defined API Keys. Return list of apiKeys.
CLI Example:
salt myminion boto_apigateway.describe_api_keys
salt.modules.boto_apigateway.
describe_api_method
(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)¶Get API method for a resource in the given API
CLI Example:
salt myminion boto_apigateway.describe_api_method restApiId resourcePath httpMethod
salt.modules.boto_apigateway.
describe_api_method_response
(restApiId, resourcePath, httpMethod, statusCode, region=None, key=None, keyid=None, profile=None)¶Get API method response for a resource in the given API
CLI Example:
salt myminion boto_apigateway.describe_api_method_response restApiId resourcePath httpMethod statusCode
salt.modules.boto_apigateway.
describe_api_model
(restApiId, modelName, flatten=True, region=None, key=None, keyid=None, profile=None)¶Get a model by name for a given API
CLI Example:
salt myminion boto_apigateway.describe_api_model restApiId modelName [True]
salt.modules.boto_apigateway.
describe_api_models
(restApiId, region=None, key=None, keyid=None, profile=None)¶Get all models for a given API
CLI Example:
salt myminion boto_apigateway.describe_api_models restApiId
salt.modules.boto_apigateway.
describe_api_resource
(restApiId, path, region=None, key=None, keyid=None, profile=None)¶Given rest api id, and an absolute resource path, returns the resource id for the given path.
CLI Example:
salt myminion boto_apigateway.describe_api_resource myapi_id resource_path
salt.modules.boto_apigateway.
describe_api_resource_method
(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.describe_api_resource_method myapi_id resource_path httpmethod
salt.modules.boto_apigateway.
describe_api_resources
(restApiId, region=None, key=None, keyid=None, profile=None)¶Given rest api id, return all resources for this api.
CLI Example:
salt myminion boto_apigateway.describe_api_resources myapi_id
salt.modules.boto_apigateway.
describe_api_stage
(restApiId, stageName, region=None, key=None, keyid=None, profile=None)¶Get API stage for a given apiID and stage name
CLI Example:
salt myminion boto_apigateway.describe_api_stage restApiId stageName
salt.modules.boto_apigateway.
describe_api_stages
(restApiId, deploymentId, region=None, key=None, keyid=None, profile=None)¶Get all API stages for a given apiID and deploymentID
CLI Example:
salt myminion boto_apigateway.describe_api_stages restApiId deploymentId
salt.modules.boto_apigateway.
describe_apis
(name=None, description=None, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.describe_apis
salt myminion boto_apigateway.describe_apis name='api name'
salt myminion boto_apigateway.describe_apis name='api name' description='desc str'
salt.modules.boto_apigateway.
describe_usage_plans
(name=None, plan_id=None, region=None, key=None, keyid=None, profile=None)¶Returns a list of existing usage plans, optionally filtered to match a given plan name
New in version 2017.7.0.
CLI Example:
salt myminion boto_apigateway.describe_usage_plans
salt myminion boto_apigateway.describe_usage_plans name='usage plan name'
salt myminion boto_apigateway.describe_usage_plans plan_id='usage plan id'
salt.modules.boto_apigateway.
detach_usage_plan_from_apis
(plan_id, apis, region=None, key=None, keyid=None, profile=None)¶Detaches given usage plan from each of the apis provided in a list of apiId and stage value
New in version 2017.7.0.
a list of dictionaries, where each dictionary contains the following:
a string, which is the id of the created API in AWS ApiGateway
a string, which is the stage that the created API is deployed to.
CLI Example:
salt myminion boto_apigateway.detach_usage_plan_to_apis plan_id='usage plan id' apis='[{"apiId": "some id 1", "stage": "some stage 1"}]'
salt.modules.boto_apigateway.
disable_api_key
(apiKey, region=None, key=None, keyid=None, profile=None)¶disable the given apiKey.
CLI Example:
salt myminion boto_apigateway.enable_api_key api_key
salt.modules.boto_apigateway.
disassociate_api_key_stagekeys
(apiKey, stagekeyslist, region=None, key=None, keyid=None, profile=None)¶disassociate the given stagekeyslist to the given apiKey.
CLI Example:
salt myminion boto_apigateway.disassociate_stagekeys_api_key \
api_key '["restapi id/stage name", ...]'
salt.modules.boto_apigateway.
enable_api_key
(apiKey, region=None, key=None, keyid=None, profile=None)¶enable the given apiKey.
CLI Example:
salt myminion boto_apigateway.enable_api_key api_key
salt.modules.boto_apigateway.
flush_api_stage_cache
(restApiId, stageName, region=None, key=None, keyid=None, profile=None)¶Flushes cache for the stage identified by stageName from API identified by restApiId
CLI Example:
salt myminion boto_apigateway.flush_api_stage_cache restApiId stageName
salt.modules.boto_apigateway.
overwrite_api_stage_variables
(restApiId, stageName, variables, region=None, key=None, keyid=None, profile=None)¶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 boto_apigateway.overwrite_api_stage_variables restApiId stageName variables='{"name": "value"}'
salt.modules.boto_apigateway.
update_api_key_description
(apiKey, description, region=None, key=None, keyid=None, profile=None)¶update the given apiKey with the given description.
CLI Example:
salt myminion boto_apigateway.update_api_key_description api_key description
salt.modules.boto_apigateway.
update_api_model_schema
(restApiId, modelName, schema, region=None, key=None, keyid=None, profile=None)¶update the schema (in python dictionary format) for the given model in the given restApiId
CLI Example:
salt myminion boto_apigateway.update_api_model_schema restApiId modelName schema
salt.modules.boto_apigateway.
update_usage_plan
(plan_id, throttle=None, quota=None, region=None, key=None, keyid=None, profile=None)¶Updates an existing usage plan with throttling and quotas
New in version 2017.7.0.
Id of the created usage plan
A dictionary consisting of the following keys:
requests per second at steady rate, float
maximum number of requests per second, integer
A dictionary consisting of the following keys:
number of allowed requests per specified quota period [required if quota parameter is present]
number of requests to be subtracted from limit at the beginning of the period [optional]
quota period, must be one of DAY, WEEK, or MONTH. [required if quota parameter is present
CLI Example:
salt myminion boto_apigateway.update_usage_plan plan_id='usage plan id' throttle='{"rateLimit": 10.0, "burstLimit": 10}'