ApiGatewayV2 / Client / create_stage

create_stage#

ApiGatewayV2.Client.create_stage(**kwargs)#

Creates a Stage for an API.

See also: AWS API Documentation

Request Syntax

response = client.create_stage(
    AccessLogSettings={
        'DestinationArn': 'string',
        'Format': 'string'
    },
    ApiId='string',
    AutoDeploy=True|False,
    ClientCertificateId='string',
    DefaultRouteSettings={
        'DataTraceEnabled': True|False,
        'DetailedMetricsEnabled': True|False,
        'LoggingLevel': 'ERROR'|'INFO'|'OFF',
        'ThrottlingBurstLimit': 123,
        'ThrottlingRateLimit': 123.0
    },
    DeploymentId='string',
    Description='string',
    RouteSettings={
        'string': {
            'DataTraceEnabled': True|False,
            'DetailedMetricsEnabled': True|False,
            'LoggingLevel': 'ERROR'|'INFO'|'OFF',
            'ThrottlingBurstLimit': 123,
            'ThrottlingRateLimit': 123.0
        }
    },
    StageName='string',
    StageVariables={
        'string': 'string'
    },
    Tags={
        'string': 'string'
    }
)
Parameters:
  • AccessLogSettings (dict) –

    Settings for logging access in this stage.

    • DestinationArn (string) –

      The ARN of the CloudWatch Logs log group to receive access logs.

    • Format (string) –

      A single line format of the access logs of data, as specified by selected $context variables. The format must include at least $context.requestId.

  • ApiId (string) –

    [REQUIRED]

    The API identifier.

  • AutoDeploy (boolean) – Specifies whether updates to an API automatically trigger a new deployment. The default value is false.

  • ClientCertificateId (string) – The identifier of a client certificate for a Stage. Supported only for WebSocket APIs.

  • DefaultRouteSettings (dict) –

    The default route settings for the stage.

    • DataTraceEnabled (boolean) –

      Specifies whether (true) or not (false) data trace logging is enabled for this route. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

    • DetailedMetricsEnabled (boolean) –

      Specifies whether detailed metrics are enabled.

    • LoggingLevel (string) –

      Specifies the logging level for this route: INFO, ERROR, or OFF. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

    • ThrottlingBurstLimit (integer) –

      Specifies the throttling burst limit.

    • ThrottlingRateLimit (float) –

      Specifies the throttling rate limit.

  • DeploymentId (string) – The deployment identifier of the API stage.

  • Description (string) – The description for the API stage.

  • RouteSettings (dict) –

    Route settings for the stage, by routeKey.

    • (string) –

      • (dict) –

        Represents a collection of route settings.

        • DataTraceEnabled (boolean) –

          Specifies whether (true) or not (false) data trace logging is enabled for this route. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

        • DetailedMetricsEnabled (boolean) –

          Specifies whether detailed metrics are enabled.

        • LoggingLevel (string) –

          Specifies the logging level for this route: INFO, ERROR, or OFF. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

        • ThrottlingBurstLimit (integer) –

          Specifies the throttling burst limit.

        • ThrottlingRateLimit (float) –

          Specifies the throttling rate limit.

  • StageName (string) –

    [REQUIRED]

    The name of the stage.

  • StageVariables (dict) –

    A map that defines the stage variables for a Stage. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.

    • (string) –

      • (string) –

        A string with a length between [0-2048].

  • Tags (dict) –

    The collection of tags. Each tag element is associated with a given resource.

    • (string) –

      • (string) –

        A string with a length between [0-1600].

Return type:

dict

Returns:

Response Syntax

{
    'AccessLogSettings': {
        'DestinationArn': 'string',
        'Format': 'string'
    },
    'ApiGatewayManaged': True|False,
    'AutoDeploy': True|False,
    'ClientCertificateId': 'string',
    'CreatedDate': datetime(2015, 1, 1),
    'DefaultRouteSettings': {
        'DataTraceEnabled': True|False,
        'DetailedMetricsEnabled': True|False,
        'LoggingLevel': 'ERROR'|'INFO'|'OFF',
        'ThrottlingBurstLimit': 123,
        'ThrottlingRateLimit': 123.0
    },
    'DeploymentId': 'string',
    'Description': 'string',
    'LastDeploymentStatusMessage': 'string',
    'LastUpdatedDate': datetime(2015, 1, 1),
    'RouteSettings': {
        'string': {
            'DataTraceEnabled': True|False,
            'DetailedMetricsEnabled': True|False,
            'LoggingLevel': 'ERROR'|'INFO'|'OFF',
            'ThrottlingBurstLimit': 123,
            'ThrottlingRateLimit': 123.0
        }
    },
    'StageName': 'string',
    'StageVariables': {
        'string': 'string'
    },
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    The request has succeeded and has resulted in the creation of a resource.

    • AccessLogSettings (dict) –

      Settings for logging access in this stage.

      • DestinationArn (string) –

        The ARN of the CloudWatch Logs log group to receive access logs.

      • Format (string) –

        A single line format of the access logs of data, as specified by selected $context variables. The format must include at least $context.requestId.

    • ApiGatewayManaged (boolean) –

      Specifies whether a stage is managed by API Gateway. If you created an API using quick create, the $default stage is managed by API Gateway. You can’t modify the $default stage.

    • AutoDeploy (boolean) –

      Specifies whether updates to an API automatically trigger a new deployment. The default value is false.

    • ClientCertificateId (string) –

      The identifier of a client certificate for a Stage. Supported only for WebSocket APIs.

    • CreatedDate (datetime) –

      The timestamp when the stage was created.

    • DefaultRouteSettings (dict) –

      Default route settings for the stage.

      • DataTraceEnabled (boolean) –

        Specifies whether (true) or not (false) data trace logging is enabled for this route. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

      • DetailedMetricsEnabled (boolean) –

        Specifies whether detailed metrics are enabled.

      • LoggingLevel (string) –

        Specifies the logging level for this route: INFO, ERROR, or OFF. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

      • ThrottlingBurstLimit (integer) –

        Specifies the throttling burst limit.

      • ThrottlingRateLimit (float) –

        Specifies the throttling rate limit.

    • DeploymentId (string) –

      The identifier of the Deployment that the Stage is associated with. Can’t be updated if autoDeploy is enabled.

    • Description (string) –

      The description of the stage.

    • LastDeploymentStatusMessage (string) –

      Describes the status of the last deployment of a stage. Supported only for stages with autoDeploy enabled.

    • LastUpdatedDate (datetime) –

      The timestamp when the stage was last updated.

    • RouteSettings (dict) –

      Route settings for the stage, by routeKey.

      • (string) –

        • (dict) –

          Represents a collection of route settings.

          • DataTraceEnabled (boolean) –

            Specifies whether (true) or not (false) data trace logging is enabled for this route. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

          • DetailedMetricsEnabled (boolean) –

            Specifies whether detailed metrics are enabled.

          • LoggingLevel (string) –

            Specifies the logging level for this route: INFO, ERROR, or OFF. This property affects the log entries pushed to Amazon CloudWatch Logs. Supported only for WebSocket APIs.

          • ThrottlingBurstLimit (integer) –

            Specifies the throttling burst limit.

          • ThrottlingRateLimit (float) –

            Specifies the throttling rate limit.

    • StageName (string) –

      The name of the stage.

    • StageVariables (dict) –

      A map that defines the stage variables for a stage resource. Variable names can have alphanumeric and underscore characters, and the values must match [A-Za-z0-9-._~:/?#&=,]+.

      • (string) –

        • (string) –

          A string with a length between [0-2048].

    • Tags (dict) –

      The collection of tags. Each tag element is associated with a given resource.

      • (string) –

        • (string) –

          A string with a length between [0-1600].

Exceptions

  • ApiGatewayV2.Client.exceptions.NotFoundException

  • ApiGatewayV2.Client.exceptions.TooManyRequestsException

  • ApiGatewayV2.Client.exceptions.BadRequestException

  • ApiGatewayV2.Client.exceptions.ConflictException