Amazon API Gateway

2018/07/11 - Amazon API Gateway - 4 updated api methods

Changes  Support for fine grain throttling for API gateway.

CreateUsagePlan (updated) Link ¶
Changes (both)
{'apiStages': {'throttle': {'string': {'burstLimit': 'integer',
                                       'rateLimit': 'double'}}}}

Creates a usage plan with the throttle and quota limits, as well as the associated API stages, specified in the payload.

See also: AWS API Documentation

Request Syntax

client.create_usage_plan(
    name='string',
    description='string',
    apiStages=[
        {
            'apiId': 'string',
            'stage': 'string',
            'throttle': {
                'string': {
                    'burstLimit': 123,
                    'rateLimit': 123.0
                }
            }
        },
    ],
    throttle={
        'burstLimit': 123,
        'rateLimit': 123.0
    },
    quota={
        'limit': 123,
        'offset': 123,
        'period': 'DAY'|'WEEK'|'MONTH'
    }
)
type name

string

param name

[REQUIRED]

[Required] The name of the usage plan.

type description

string

param description

The description of the usage plan.

type apiStages

list

param apiStages

The associated API stages of the usage plan.

  • (dict) --

    API stage name of the associated API stage in a usage plan.

    • apiId (string) --

      API Id of the associated API stage in a usage plan.

    • stage (string) --

      API stage name of the associated API stage in a usage plan.

    • throttle (dict) --

      Map containing method level throttling information for API stage in a usage plan.

      • (string) --

        • (dict) --

          The API request rate limits.

          • burstLimit (integer) --

            The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

          • rateLimit (float) --

            The API request steady-state rate limit.

type throttle

dict

param throttle

The throttling limits of the usage plan.

  • burstLimit (integer) --

    The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

  • rateLimit (float) --

    The API request steady-state rate limit.

type quota

dict

param quota

The quota of the usage plan.

  • limit (integer) --

    The maximum number of requests that can be made in a given time period.

  • offset (integer) --

    The number of requests subtracted from the given limit in the initial time period.

  • period (string) --

    The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'apiStages': [
        {
            'apiId': 'string',
            'stage': 'string',
            'throttle': {
                'string': {
                    'burstLimit': 123,
                    'rateLimit': 123.0
                }
            }
        },
    ],
    'throttle': {
        'burstLimit': 123,
        'rateLimit': 123.0
    },
    'quota': {
        'limit': 123,
        'offset': 123,
        'period': 'DAY'|'WEEK'|'MONTH'
    },
    'productCode': 'string'
}

Response Structure

  • (dict) --

    Represents a usage plan than can specify who can assess associated API stages with specified request limits and quotas.

    In a usage plan, you associate an API by specifying the API's Id and a stage name of the specified API. You add plan customers by adding API keys to the plan.

    Create and Use Usage Plans

    • id (string) --

      The identifier of a UsagePlan resource.

    • name (string) --

      The name of a usage plan.

    • description (string) --

      The description of a usage plan.

    • apiStages (list) --

      The associated API stages of a usage plan.

      • (dict) --

        API stage name of the associated API stage in a usage plan.

        • apiId (string) --

          API Id of the associated API stage in a usage plan.

        • stage (string) --

          API stage name of the associated API stage in a usage plan.

        • throttle (dict) --

          Map containing method level throttling information for API stage in a usage plan.

          • (string) --

            • (dict) --

              The API request rate limits.

              • burstLimit (integer) --

                The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

              • rateLimit (float) --

                The API request steady-state rate limit.

    • throttle (dict) --

      The request throttle limits of a usage plan.

      • burstLimit (integer) --

        The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

      • rateLimit (float) --

        The API request steady-state rate limit.

    • quota (dict) --

      The maximum number of permitted requests per a given unit time interval.

      • limit (integer) --

        The maximum number of requests that can be made in a given time period.

      • offset (integer) --

        The number of requests subtracted from the given limit in the initial time period.

      • period (string) --

        The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

    • productCode (string) --

      The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.

GetUsagePlan (updated) Link ¶
Changes (response)
{'apiStages': {'throttle': {'string': {'burstLimit': 'integer',
                                       'rateLimit': 'double'}}}}

Gets a usage plan of a given plan identifier.

See also: AWS API Documentation

Request Syntax

client.get_usage_plan(
    usagePlanId='string'
)
type usagePlanId

string

param usagePlanId

[REQUIRED]

[Required] The identifier of the UsagePlan resource to be retrieved.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'apiStages': [
        {
            'apiId': 'string',
            'stage': 'string',
            'throttle': {
                'string': {
                    'burstLimit': 123,
                    'rateLimit': 123.0
                }
            }
        },
    ],
    'throttle': {
        'burstLimit': 123,
        'rateLimit': 123.0
    },
    'quota': {
        'limit': 123,
        'offset': 123,
        'period': 'DAY'|'WEEK'|'MONTH'
    },
    'productCode': 'string'
}

Response Structure

  • (dict) --

    Represents a usage plan than can specify who can assess associated API stages with specified request limits and quotas.

    In a usage plan, you associate an API by specifying the API's Id and a stage name of the specified API. You add plan customers by adding API keys to the plan.

    Create and Use Usage Plans

    • id (string) --

      The identifier of a UsagePlan resource.

    • name (string) --

      The name of a usage plan.

    • description (string) --

      The description of a usage plan.

    • apiStages (list) --

      The associated API stages of a usage plan.

      • (dict) --

        API stage name of the associated API stage in a usage plan.

        • apiId (string) --

          API Id of the associated API stage in a usage plan.

        • stage (string) --

          API stage name of the associated API stage in a usage plan.

        • throttle (dict) --

          Map containing method level throttling information for API stage in a usage plan.

          • (string) --

            • (dict) --

              The API request rate limits.

              • burstLimit (integer) --

                The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

              • rateLimit (float) --

                The API request steady-state rate limit.

    • throttle (dict) --

      The request throttle limits of a usage plan.

      • burstLimit (integer) --

        The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

      • rateLimit (float) --

        The API request steady-state rate limit.

    • quota (dict) --

      The maximum number of permitted requests per a given unit time interval.

      • limit (integer) --

        The maximum number of requests that can be made in a given time period.

      • offset (integer) --

        The number of requests subtracted from the given limit in the initial time period.

      • period (string) --

        The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

    • productCode (string) --

      The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.

GetUsagePlans (updated) Link ¶
Changes (response)
{'items': {'apiStages': {'throttle': {'string': {'burstLimit': 'integer',
                                                 'rateLimit': 'double'}}}}}

Gets all the usage plans of the caller's account.

See also: AWS API Documentation

Request Syntax

client.get_usage_plans(
    position='string',
    keyId='string',
    limit=123
)
type position

string

param position

The current pagination position in the paged result set.

type keyId

string

param keyId

The identifier of the API key associated with the usage plans.

type limit

integer

param limit

The maximum number of returned results per page. The default value is 25 and the maximum value is 500.

rtype

dict

returns

Response Syntax

{
    'position': 'string',
    'items': [
        {
            'id': 'string',
            'name': 'string',
            'description': 'string',
            'apiStages': [
                {
                    'apiId': 'string',
                    'stage': 'string',
                    'throttle': {
                        'string': {
                            'burstLimit': 123,
                            'rateLimit': 123.0
                        }
                    }
                },
            ],
            'throttle': {
                'burstLimit': 123,
                'rateLimit': 123.0
            },
            'quota': {
                'limit': 123,
                'offset': 123,
                'period': 'DAY'|'WEEK'|'MONTH'
            },
            'productCode': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Represents a collection of usage plans for an AWS account.

    Create and Use Usage Plans

    • position (string) --

    • items (list) --

      The current page of elements from this collection.

      • (dict) --

        Represents a usage plan than can specify who can assess associated API stages with specified request limits and quotas.

        In a usage plan, you associate an API by specifying the API's Id and a stage name of the specified API. You add plan customers by adding API keys to the plan.

        Create and Use Usage Plans

        • id (string) --

          The identifier of a UsagePlan resource.

        • name (string) --

          The name of a usage plan.

        • description (string) --

          The description of a usage plan.

        • apiStages (list) --

          The associated API stages of a usage plan.

          • (dict) --

            API stage name of the associated API stage in a usage plan.

            • apiId (string) --

              API Id of the associated API stage in a usage plan.

            • stage (string) --

              API stage name of the associated API stage in a usage plan.

            • throttle (dict) --

              Map containing method level throttling information for API stage in a usage plan.

              • (string) --

                • (dict) --

                  The API request rate limits.

                  • burstLimit (integer) --

                    The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

                  • rateLimit (float) --

                    The API request steady-state rate limit.

        • throttle (dict) --

          The request throttle limits of a usage plan.

          • burstLimit (integer) --

            The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

          • rateLimit (float) --

            The API request steady-state rate limit.

        • quota (dict) --

          The maximum number of permitted requests per a given unit time interval.

          • limit (integer) --

            The maximum number of requests that can be made in a given time period.

          • offset (integer) --

            The number of requests subtracted from the given limit in the initial time period.

          • period (string) --

            The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

        • productCode (string) --

          The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.

UpdateUsagePlan (updated) Link ¶
Changes (response)
{'apiStages': {'throttle': {'string': {'burstLimit': 'integer',
                                       'rateLimit': 'double'}}}}

Updates a usage plan of a given plan Id.

See also: AWS API Documentation

Request Syntax

client.update_usage_plan(
    usagePlanId='string',
    patchOperations=[
        {
            'op': 'add'|'remove'|'replace'|'move'|'copy'|'test',
            'path': 'string',
            'value': 'string',
            'from': 'string'
        },
    ]
)
type usagePlanId

string

param usagePlanId

[REQUIRED]

[Required] The Id of the to-be-updated usage plan.

type patchOperations

list

param patchOperations

A list of update operations to be applied to the specified resource and in the order specified in this list.

  • (dict) -- A single patch operation to apply to the specified resource. Please refer to http://tools.ietf.org/html/rfc6902#section-4 for an explanation of how each operation is used.

    • op (string) --

      An update operation to be performed with this PATCH request. The valid value can be add , remove , replace or copy . Not all valid operations are supported for a given resource. Support of the operations depends on specific operational contexts. Attempts to apply an unsupported operation on a resource will return an error message.

    • path (string) --

      The op operation's target, as identified by a JSON Pointer value that references a location within the targeted resource. For example, if the target resource has an updateable property of {"name":"value"} , the path for this property is /name . If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}} ), the path for the child/name property will be /name/child~1name . Any slash ("/") character appearing in path names must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated with it.

    • value (string) --

      The new target value of the update operation. It is applicable for the add or replace operation. When using AWS CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell, e.g., '{"a": ...}'. In a Windows shell, see Using JSON for Parameters .

    • from (string) --

      The copy update operation's source as identified by a JSON-Pointer value referencing the location within the targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy" , "from":"/canarySettings/deploymentId" and "path":"/deploymentId" .

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'apiStages': [
        {
            'apiId': 'string',
            'stage': 'string',
            'throttle': {
                'string': {
                    'burstLimit': 123,
                    'rateLimit': 123.0
                }
            }
        },
    ],
    'throttle': {
        'burstLimit': 123,
        'rateLimit': 123.0
    },
    'quota': {
        'limit': 123,
        'offset': 123,
        'period': 'DAY'|'WEEK'|'MONTH'
    },
    'productCode': 'string'
}

Response Structure

  • (dict) --

    Represents a usage plan than can specify who can assess associated API stages with specified request limits and quotas.

    In a usage plan, you associate an API by specifying the API's Id and a stage name of the specified API. You add plan customers by adding API keys to the plan.

    Create and Use Usage Plans

    • id (string) --

      The identifier of a UsagePlan resource.

    • name (string) --

      The name of a usage plan.

    • description (string) --

      The description of a usage plan.

    • apiStages (list) --

      The associated API stages of a usage plan.

      • (dict) --

        API stage name of the associated API stage in a usage plan.

        • apiId (string) --

          API Id of the associated API stage in a usage plan.

        • stage (string) --

          API stage name of the associated API stage in a usage plan.

        • throttle (dict) --

          Map containing method level throttling information for API stage in a usage plan.

          • (string) --

            • (dict) --

              The API request rate limits.

              • burstLimit (integer) --

                The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

              • rateLimit (float) --

                The API request steady-state rate limit.

    • throttle (dict) --

      The request throttle limits of a usage plan.

      • burstLimit (integer) --

        The API request burst limit, the maximum rate limit over a time ranging from one to a few seconds, depending upon whether the underlying token bucket is at its full capacity.

      • rateLimit (float) --

        The API request steady-state rate limit.

    • quota (dict) --

      The maximum number of permitted requests per a given unit time interval.

      • limit (integer) --

        The maximum number of requests that can be made in a given time period.

      • offset (integer) --

        The number of requests subtracted from the given limit in the initial time period.

      • period (string) --

        The time period in which the limit applies. Valid values are "DAY", "WEEK" or "MONTH".

    • productCode (string) --

      The AWS Markeplace product identifier to associate with the usage plan as a SaaS product on AWS Marketplace.