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
Activates previously deployed deployment for a given stage
CLI Example:
salt myminion boto_apigateway.activate_api_deployent restApiId stagename deploymentId
Check to see if the given Rest API Name and optionally description exists.
CLI Example:
salt myminion boto_apigateway.exists myapi_name
Check to see if the given modelName exists in the given restApiId
CLI Example:
salt myminion boto_apigateway.api_model_exists restApiId modelName
associate the given stagekeyslist to the given apiKey.
CLI Example:
salt myminion boto_apigateway.associate_stagekeys_api_key \
api_key '["restapi id/stage name", ...]'
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"}]'
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
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"}'
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 ['{}' ['{}']]
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 ['{}' ['{}']]
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"}]'
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"}'
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"}'
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'
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
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"}'
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}'
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'
Deletes API deployment for a given restApiId and deploymentID
CLI Example:
salt myminion boto_apigateway.delete_api_deployent restApiId deploymentId
Deletes an integration for a given method in a given API
CLI Example:
salt myminion boto_apigateway.delete_api_integration restApiId resourcePath httpMethod
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
Deletes a given apiKey
CLI Example:
salt myminion boto_apigateway.delete_api_key apikeystring
Delete API method for a resource in the given API
CLI Example:
salt myminion boto_apigateway.delete_api_method restApiId resourcePath httpMethod
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
Delete a model identified by name in a given API
CLI Example:
salt myminion boto_apigateway.delete_api_model restApiId modelName
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
Deletes stage identified by stageName from API identified by restApiId
CLI Example:
salt myminion boto_apigateway.delete_api_stage restApiId stageName
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'
Get API deployment for a given restApiId and deploymentId.
CLI Example:
salt myminion boto_apigateway.describe_api_deployent restApiId deploymentId
Gets information about the defined API Deployments. Return list of api deployments.
CLI Example:
salt myminion boto_apigateway.describe_api_deployments restApiId
Get an integration for a given method in a given API
CLI Example:
salt myminion boto_apigateway.describe_api_integration restApiId resourcePath httpMethod
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
Gets info about the given api key
CLI Example:
salt myminion boto_apigateway.describe_api_key apigw_api_key
Gets information about the defined API Keys. Return list of apiKeys.
CLI Example:
salt myminion boto_apigateway.describe_api_keys
Get API method for a resource in the given API
CLI Example:
salt myminion boto_apigateway.describe_api_method restApiId resourcePath httpMethod
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
Get a model by name for a given API
CLI Example:
salt myminion boto_apigateway.describe_api_model restApiId modelName [True]
Get all models for a given API
CLI Example:
salt myminion boto_apigateway.describe_api_models restApiId
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
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
Given rest api id, return all resources for this api.
CLI Example:
salt myminion boto_apigateway.describe_api_resources myapi_id
Get API stage for a given apiID and stage name
CLI Example:
salt myminion boto_apigateway.describe_api_stage restApiId stageName
Get all API stages for a given apiID and deploymentID
CLI Example:
salt myminion boto_apigateway.describe_api_stages restApiId deploymentId
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'
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'
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"}]'
disable the given apiKey.
CLI Example:
salt myminion boto_apigateway.enable_api_key api_key
disassociate the given stagekeyslist to the given apiKey.
CLI Example:
salt myminion boto_apigateway.disassociate_stagekeys_api_key \
api_key '["restapi id/stage name", ...]'
enable the given apiKey.
CLI Example:
salt myminion boto_apigateway.enable_api_key api_key
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
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"}'
update the given apiKey with the given description.
CLI Example:
salt myminion boto_apigateway.update_api_key_description api_key description
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
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}'