Skip to content

update_stage

update_stage(
    api_id: __string,
    stage_name: __string,
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = 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_variables: Optional[StageVariablesMap] = None,
) -> UpdateStageResponse

Updates a Stage.

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.

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

    The default route settings for the stage.

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

    The deployment identifier for the API stage. Can't be updated if autoDeploy is enabled.

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

    The description for the API stage.

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

    Route settings for the stage.

  • stage_name (__string) –

    The stage name. Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default. Maximum length is 128 characters.

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

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/api_gateway_v2.py
def update_stage(
    self,
    api_id: "capo_apigatewayv2.types.__string.__string",
    stage_name: "capo_apigatewayv2.types.__string.__string",
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = 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_variables: Optional[
        "capo_apigatewayv2.types.stage_variables_map.StageVariablesMap"
    ] = None,
) -> "capo_apigatewayv2.types.update_stage_response.UpdateStageResponse":
    """<p>Updates a Stage.</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.</p>
        default_route_settings: <p>The default route settings for the stage.</p>
        deployment_id: <p>The deployment identifier for the API stage. Can't be updated if autoDeploy is enabled.</p>
        description: <p>The description for the API stage.</p>
        route_settings: <p>Route settings for the stage.</p>
        stage_name: <p>The stage name. Stage names can contain only alphanumeric characters, hyphens, and underscores, or be $default. Maximum length is 128 characters.</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>

    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.
    """

    def _handler(
        req: "OperationRequest[capo_apigatewayv2.types.update_stage_request.UpdateStageRequest]",
    ) -> OperationResponse[
        "capo_apigatewayv2.types.update_stage_response.UpdateStageResponse"
    ]:
        import capo_apigatewayv2._operations.api_gateway_v2.update_stage

        output, http_response = (
            capo_apigatewayv2._operations.api_gateway_v2.update_stage.update_stage(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateStage")
    )
    input_: capo_apigatewayv2.types.update_stage_request.UpdateStageRequest = {
        "api_id": api_id,
        "stage_name": stage_name,
    }
    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_variables is not None:
        input_["stage_variables"] = stage_variables

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output