Skip to content

create_stage async

create_stage(
    api_id: __string,
    *,
    config_overrides: Optional[AsyncApiGatewayV2ClientConfig] = None,
    access_log_settings: Optional[AccessLogSettings] = None,
    auto_deploy: Optional[__boolean] = None,
    client_certificate_id: Optional[Id] = None,
    default_route_settings: Optional[RouteSettings] = None,
    deployment_id: Optional[Id] = None,
    description: Optional[StringWithLengthBetween0And1024] = None,
    route_settings: Optional[RouteSettingsMap] = None,
    stage_name: Optional[StringWithLengthBetween1And128] = None,
    stage_variables: Optional[StageVariablesMap] = None,
    tags: Optional[Tags] = None,
) -> CreateStageResponse

Creates a Stage for an API.

Parameters:

  • access_log_settings (Optional[AccessLogSettings], default: None ) –

    Settings for logging access in this stage.

  • api_id (__string) –

    The API identifier.

  • auto_deploy (Optional[__boolean], default: None ) –

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

  • client_certificate_id (Optional[Id], default: None ) –

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

  • default_route_settings (Optional[RouteSettings], default: None ) –

    The default route settings for the stage.

  • deployment_id (Optional[Id], default: None ) –

    The deployment identifier of the API stage.

  • description (Optional[StringWithLengthBetween0And1024], default: None ) –

    The description for the API stage.

  • route_settings (Optional[RouteSettingsMap], default: None ) –

    Route settings for the stage, by routeKey.

  • stage_name (Optional[StringWithLengthBetween1And128], default: None ) –

    The name of the stage.

  • stage_variables (Optional[StageVariablesMap], default: None ) –

    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-._~:/?#&=,]+.

  • tags (Optional[Tags], default: None ) –

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

Raises:

  • BadRequestException –

    The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • NotFoundException –

    The resource specified in the request was not found. See the message field for more information.

  • TooManyRequestsException –

    A limit has been exceeded. See the accompanying error message for details.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_apigatewayv2/_services/async_api_gateway_v2.py
async def create_stage(
    self,
    api_id: "capo_apigatewayv2.types.__string.__string",
    *,
    config_overrides: Optional[AsyncApiGatewayV2ClientConfig] = None,
    access_log_settings: Optional[
        "capo_apigatewayv2.types.access_log_settings.AccessLogSettings"
    ] = None,
    auto_deploy: Optional["capo_apigatewayv2.types.__boolean.__boolean"] = None,
    client_certificate_id: Optional["capo_apigatewayv2.types.id.Id"] = None,
    default_route_settings: Optional[
        "capo_apigatewayv2.types.route_settings.RouteSettings"
    ] = None,
    deployment_id: Optional["capo_apigatewayv2.types.id.Id"] = None,
    description: Optional[
        "capo_apigatewayv2.types.string_with_length_between0_and1024.StringWithLengthBetween0And1024"
    ] = None,
    route_settings: Optional[
        "capo_apigatewayv2.types.route_settings_map.RouteSettingsMap"
    ] = None,
    stage_name: Optional[
        "capo_apigatewayv2.types.string_with_length_between1_and128.StringWithLengthBetween1And128"
    ] = None,
    stage_variables: Optional[
        "capo_apigatewayv2.types.stage_variables_map.StageVariablesMap"
    ] = None,
    tags: Optional["capo_apigatewayv2.types.tags.Tags"] = None,
) -> "capo_apigatewayv2.types.create_stage_response.CreateStageResponse":
    """<p>Creates a Stage for an API.</p>

    Args:
        access_log_settings: <p>Settings for logging access in this stage.</p>
        api_id: <p>The API identifier.</p>
        auto_deploy: <p>Specifies whether updates to an API automatically trigger a new deployment. The default value is false.</p>
        client_certificate_id: <p>The identifier of a client certificate for a Stage. Supported only for WebSocket APIs.</p>
        default_route_settings: <p>The default route settings for the stage.</p>
        deployment_id: <p>The deployment identifier of the API stage.</p>
        description: <p>The description for the API stage.</p>
        route_settings: <p>Route settings for the stage, by routeKey.</p>
        stage_name: <p>The name of the stage.</p>
        stage_variables: <p>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-._~:/?#&amp;=,]+.</p>
        tags: <p>The collection of tags. Each tag element is associated with a given resource.</p>

    Raises:
        capo_apigatewayv2.errors.bad_request_exception.BadRequestException: <p>The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. See the message field for more information.</p>
        capo_apigatewayv2.errors.too_many_requests_exception.TooManyRequestsException: <p>A limit has been exceeded. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_apigatewayv2.types.create_stage_request.CreateStageRequest]",
    ) -> AsyncOperationResponse[
        "capo_apigatewayv2.types.create_stage_response.CreateStageResponse"
    ]:
        import capo_apigatewayv2._operations.api_gateway_v2.create_stage

        (
            output,
            http_response,
        ) = await capo_apigatewayv2._operations.api_gateway_v2.create_stage.async_create_stage(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStage")
    )
    input_: capo_apigatewayv2.types.create_stage_request.CreateStageRequest = {
        "api_id": api_id
    }
    if access_log_settings is not None:
        input_["access_log_settings"] = access_log_settings
    if auto_deploy is not None:
        input_["auto_deploy"] = auto_deploy
    if client_certificate_id is not None:
        input_["client_certificate_id"] = client_certificate_id
    if default_route_settings is not None:
        input_["default_route_settings"] = default_route_settings
    if deployment_id is not None:
        input_["deployment_id"] = deployment_id
    if description is not None:
        input_["description"] = description
    if route_settings is not None:
        input_["route_settings"] = route_settings
    if stage_name is not None:
        input_["stage_name"] = stage_name
    if stage_variables is not None:
        input_["stage_variables"] = stage_variables
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output