Skip to content

update_service_environment async

update_service_environment(
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    service_environment: Optional[String] = None,
    state: Optional[ServiceEnvironmentState] = None,
    capacity_limits: Optional[CapacityLimits] = None,
) -> UpdateServiceEnvironmentResponse

Updates a service environment. You can update the state of a service environment from ENABLED to DISABLED to prevent new service jobs from being placed in the service environment.

Parameters:

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

    The name or ARN of the service environment to update.

  • state (Optional[ServiceEnvironmentState], default: None ) –

    The state of the service environment.

  • capacity_limits (Optional[CapacityLimits], default: None ) –

    The capacity limits for the service environment. This defines the maximum resources that can be used by service jobs in this environment.

Raises:

  • ClientException –

    These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.

  • ServerException –

    These errors are usually caused by a server issue.

  • UnknownServiceError –

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

Source code in docs_src/capo_batch/_services/async_batch.py
async def update_service_environment(
    self,
    *,
    config_overrides: Optional[AsyncBatchClientConfig] = None,
    service_environment: Optional["capo_batch.types.string.String"] = None,
    state: Optional[
        "capo_batch.types.service_environment_state.ServiceEnvironmentState"
    ] = None,
    capacity_limits: Optional[
        "capo_batch.types.capacity_limits.CapacityLimits"
    ] = None,
) -> "capo_batch.types.update_service_environment_response.UpdateServiceEnvironmentResponse":
    """<p>Updates a service environment. You can update the state of a service environment from <code>ENABLED</code> to <code>DISABLED</code> to prevent new service jobs from being placed in the service environment.</p>

    Args:
        service_environment: <p>The name or ARN of the service environment to update.</p>
        state: <p>The state of the service environment. </p>
        capacity_limits: <p>The capacity limits for the service environment. This defines the maximum resources that can be used by service jobs in this environment.</p>

    Raises:
        capo_batch.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier that's not valid.</p>
        capo_batch.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
        capo_batch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_batch.types.update_service_environment_request.UpdateServiceEnvironmentRequest]",
    ) -> AsyncOperationResponse[
        "capo_batch.types.update_service_environment_response.UpdateServiceEnvironmentResponse"
    ]:
        import capo_batch._operations.aws_batch_v20160810.update_service_environment

        (
            output,
            http_response,
        ) = await capo_batch._operations.aws_batch_v20160810.update_service_environment.async_update_service_environment(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateServiceEnvironment")
    )
    input_: capo_batch.types.update_service_environment_request.UpdateServiceEnvironmentRequest = {}
    if service_environment is not None:
        input_["service_environment"] = service_environment
    if state is not None:
        input_["state"] = state
    if capacity_limits is not None:
        input_["capacity_limits"] = capacity_limits

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