Skip to content

create_environment async

create_environment(
    name: EnvironmentName,
    *,
    config_overrides: Optional[AsyncContinuumClientConfig] = None,
    configuration: Optional[CreateEnvironmentConfiguration] = None,
) -> CreateEnvironmentOutput

Creates an environment and starts its validation and any requested provisioning. Storage provisioning and dependency checks may continue after the initial 201 response; use GetEnvironment to observe completion.

Parameters:

  • name (EnvironmentName) –

    The customer-visible name of the environment.

  • configuration (Optional[CreateEnvironmentConfiguration], default: None ) –

    Type-specific configuration. Omission creates a code environment with the default operating policy and no sources.

Raises:

  • AccessDeniedException –

    The request is not authorized. Verify that your credentials and request signature are valid and that you have permission to perform this action.

  • ConflictException –

    The request could not be completed due to a conflict with the current state of the resource.

  • InternalServerException –

    The request couldn't be processed because of an internal server issue. Try again later. If the problem persists, contact AWS Support.

  • ResourceNotFoundException –

    The specified resource was not found. Verify that the resource identifier is correct and that the resource exists.

  • ServiceQuotaExceededException –

    The request would exceed a service quota. Review your quota and request an increase if needed.

  • ThrottlingException –

    The request was denied due to request throttling.

  • UnknownServiceError –

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

Source code in docs_src/capo_continuum/_services/async_continuum.py
async def create_environment(
    self,
    name: "capo_continuum.types.environment_name.EnvironmentName",
    *,
    config_overrides: Optional[AsyncContinuumClientConfig] = None,
    configuration: Optional[
        "capo_continuum.types.create_environment_configuration.CreateEnvironmentConfiguration"
    ] = None,
) -> "capo_continuum.types.create_environment_output.CreateEnvironmentOutput":
    """Creates an environment and starts its validation and any requested provisioning. Storage provisioning and dependency checks may continue after the initial 201 response; use GetEnvironment to observe completion.

    Args:
        name: The customer-visible name of the environment.
        configuration: Type-specific configuration. Omission creates a code environment with the default operating policy and no sources.

    Raises:
        capo_continuum.errors.access_denied_exception.AccessDeniedException: The request is not authorized. Verify that your credentials and request signature are valid and that you have permission to perform this action.
        capo_continuum.errors.conflict_exception.ConflictException: The request could not be completed due to a conflict with the current state of the resource.
        capo_continuum.errors.internal_server_exception.InternalServerException: The request couldn't be processed because of an internal server issue. Try again later. If the problem persists, contact AWS Support.
        capo_continuum.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource was not found. Verify that the resource identifier is correct and that the resource exists.
        capo_continuum.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: The request would exceed a service quota. Review your quota and request an increase if needed.
        capo_continuum.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_continuum.errors.validation_exception.ValidationException
        capo_continuum.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_continuum.types.create_environment_input.CreateEnvironmentInput]",
    ) -> AsyncOperationResponse[
        "capo_continuum.types.create_environment_output.CreateEnvironmentOutput"
    ]:
        import capo_continuum._operations.continuum_control_plane.create_environment

        (
            output,
            http_response,
        ) = await capo_continuum._operations.continuum_control_plane.create_environment.async_create_environment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEnvironment")
    )
    input_: capo_continuum.types.create_environment_input.CreateEnvironmentInput = {
        "name": name
    }
    if configuration is not None:
        input_["configuration"] = configuration

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