Skip to content

create_deployment

create_deployment(
    rest_api_id: String,
    *,
    config_overrides: Optional[APIGatewayClientConfig] = None,
    stage_name: Optional[String] = None,
    stage_description: Optional[String] = None,
    description: Optional[String] = None,
    cache_cluster_enabled: Optional[NullableBoolean] = None,
    cache_cluster_size: Optional[CacheClusterSize] = None,
    variables: Optional[MapOfStringToString] = None,
    canary_settings: Optional[DeploymentCanarySettings] = None,
    tracing_enabled: Optional[NullableBoolean] = None,
) -> Deployment

Creates a Deployment resource, which makes a specified RestApi callable over the internet.

Parameters:

  • rest_api_id (String) –

    The string identifier of the associated RestApi.

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

    The name of the Stage resource for the Deployment resource to create.

  • stage_description (Optional[String], default: None ) –

    The description of the Stage resource for the Deployment resource to create.

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

    The description for the Deployment resource to create.

  • cache_cluster_enabled (Optional[NullableBoolean], default: None ) –

    Enables a cache cluster for the Stage resource specified in the input.

  • cache_cluster_size (Optional[CacheClusterSize], default: None ) –

    The stage's cache capacity in GB. For more information about choosing a cache size, see Enabling API caching to enhance responsiveness.

  • variables (Optional[MapOfStringToString], default: None ) –

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

  • canary_settings (Optional[DeploymentCanarySettings], default: None ) –

    The input configuration for the canary deployment when the deployment is a canary release deployment.

  • tracing_enabled (Optional[NullableBoolean], default: None ) –

    Specifies whether active tracing with X-ray is enabled for the Stage.

Raises:

  • BadRequestException –

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

  • ConflictException –

    The request configuration has conflicts. For details, see the accompanying error message.

  • LimitExceededException –

    The request exceeded the rate limit. Retry after the specified time period.

  • NotFoundException –

    The requested resource is not found. Make sure that the request URI is correct.

  • ServiceUnavailableException –

    The requested service is not available. For details see the accompanying error message. Retry after the specified time period.

  • TooManyRequestsException –

    The request has reached its throttling limit. Retry after the specified time period.

  • UnauthorizedException –

    The request is denied because the caller has insufficient permissions.

  • UnknownServiceError –

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

Source code in docs_src/capo_api_gateway/_services/api_gateway.py
def create_deployment(
    self,
    rest_api_id: "capo_api_gateway.types.string.String",
    *,
    config_overrides: Optional[APIGatewayClientConfig] = None,
    stage_name: Optional["capo_api_gateway.types.string.String"] = None,
    stage_description: Optional["capo_api_gateway.types.string.String"] = None,
    description: Optional["capo_api_gateway.types.string.String"] = None,
    cache_cluster_enabled: Optional[
        "capo_api_gateway.types.nullable_boolean.NullableBoolean"
    ] = None,
    cache_cluster_size: Optional[
        "capo_api_gateway.types.cache_cluster_size.CacheClusterSize"
    ] = None,
    variables: Optional[
        "capo_api_gateway.types.map_of_string_to_string.MapOfStringToString"
    ] = None,
    canary_settings: Optional[
        "capo_api_gateway.types.deployment_canary_settings.DeploymentCanarySettings"
    ] = None,
    tracing_enabled: Optional[
        "capo_api_gateway.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_api_gateway.types.deployment.Deployment":
    """<p>Creates a Deployment resource, which makes a specified RestApi callable over the internet.</p>

    Args:
        rest_api_id: <p>The string identifier of the associated RestApi.</p>
        stage_name: <p>The name of the Stage resource for the Deployment resource to create.</p>
        stage_description: <p>The description of the Stage resource for the Deployment resource to create.</p>
        description: <p>The description for the Deployment resource to create.</p>
        cache_cluster_enabled: <p>Enables a cache cluster for the Stage resource specified in the input.</p>
        cache_cluster_size: <p>The stage's cache capacity in GB. For more information about choosing a cache size, see <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html">Enabling API caching to enhance responsiveness</a>.</p>
        variables: <p>A map that defines the stage variables for the Stage resource that is associated with the new deployment. Variable names can have alphanumeric and underscore characters, and the values must match <code>[A-Za-z0-9-._~:/?#&=,]+</code>.</p>
        canary_settings: <p>The input configuration for the canary deployment when the deployment is a canary release deployment. </p>
        tracing_enabled: <p>Specifies whether active tracing with X-ray is enabled for the Stage.</p>

    Raises:
        capo_api_gateway.errors.bad_request_exception.BadRequestException: <p>The submitted request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.</p>
        capo_api_gateway.errors.conflict_exception.ConflictException: <p>The request configuration has conflicts. For details, see the accompanying error message.</p>
        capo_api_gateway.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded the rate limit. Retry after the specified time period.</p>
        capo_api_gateway.errors.not_found_exception.NotFoundException: <p>The requested resource is not found. Make sure that the request URI is correct.</p>
        capo_api_gateway.errors.service_unavailable_exception.ServiceUnavailableException: <p>The requested service is not available. For details see the accompanying error message. Retry after the specified time period.</p>
        capo_api_gateway.errors.too_many_requests_exception.TooManyRequestsException: <p>The request has reached its throttling limit. Retry after the specified time period.</p>
        capo_api_gateway.errors.unauthorized_exception.UnauthorizedException: <p>The request is denied because the caller has insufficient permissions.</p>
        capo_api_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_api_gateway.types.create_deployment_request.CreateDeploymentRequest]",
    ) -> OperationResponse["capo_api_gateway.types.deployment.Deployment"]:
        import capo_api_gateway._operations.backplane_control_service.create_deployment

        output, http_response = (
            capo_api_gateway._operations.backplane_control_service.create_deployment.create_deployment(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDeployment")
    )
    input_: capo_api_gateway.types.create_deployment_request.CreateDeploymentRequest = {
        "rest_api_id": rest_api_id
    }
    if stage_name is not None:
        input_["stage_name"] = stage_name
    if stage_description is not None:
        input_["stage_description"] = stage_description
    if description is not None:
        input_["description"] = description
    if cache_cluster_enabled is not None:
        input_["cache_cluster_enabled"] = cache_cluster_enabled
    if cache_cluster_size is not None:
        input_["cache_cluster_size"] = cache_cluster_size
    if variables is not None:
        input_["variables"] = variables
    if canary_settings is not None:
        input_["canary_settings"] = canary_settings
    if tracing_enabled is not None:
        input_["tracing_enabled"] = tracing_enabled

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