Skip to content

enable_capacity_manager async

enable_capacity_manager(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    organizations_access: Optional[Boolean] = None,
    dry_run: Optional[Boolean] = None,
    client_token: Optional[String] = None,
) -> EnableCapacityManagerResult

Enables EC2 Capacity Manager for your account. This starts data ingestion for your EC2 capacity usage across On-Demand, Spot, and Capacity Reservations. Initial data processing may take several hours to complete.

Parameters:

  • organizations_access (Optional[Boolean], default: None ) –

    Specifies whether to enable cross-account access for Amazon Web Services Organizations. When enabled, Capacity Manager can aggregate data from all accounts in your organization. Default is false.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

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

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def enable_capacity_manager(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    organizations_access: Optional["capo_ec2.types.boolean.Boolean"] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    client_token: Optional["capo_ec2.types.string.String"] = None,
) -> "capo_ec2.types.enable_capacity_manager_result.EnableCapacityManagerResult":
    """<p> Enables EC2 Capacity Manager for your account. This starts data ingestion for your EC2 capacity usage across On-Demand, Spot, and Capacity Reservations. Initial data processing may take several hours to complete. </p>

    Args:
        organizations_access: <p> Specifies whether to enable cross-account access for Amazon Web Services Organizations. When enabled, Capacity Manager can aggregate data from all accounts in your organization. Default is false. </p>
        dry_run: <p> Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>. </p>
        client_token: <p> Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. </p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.enable_capacity_manager_request.EnableCapacityManagerRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.enable_capacity_manager_result.EnableCapacityManagerResult"
    ]:
        import capo_ec2._operations.amazon_ec2.enable_capacity_manager

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.enable_capacity_manager.async_enable_capacity_manager(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("EnableCapacityManager")
    )
    input_: capo_ec2.types.enable_capacity_manager_request.EnableCapacityManagerRequest = {}
    if organizations_access is not None:
        input_["organizations_access"] = organizations_access
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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