Skip to content

create_entitlement async

create_entitlement(
    environment_id: EnvironmentId,
    connector_id: ConnectorId,
    entitlement_type: EntitlementType,
    vm_ids: VmIdList,
    *,
    config_overrides: Optional[AsyncevsClientConfig] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateEntitlementResponse

Creates a Windows Server License entitlement for virtual machines in an Amazon EVS environment using the provided vCenter Server connector. This is an asynchronous operation. Amazon EVS validates the specified virtual machines before starting usage tracking.

Parameters:

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

    This parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the entitlement creation request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.

  • environment_id (EnvironmentId) –

    A unique ID for the environment to create the entitlement in.

  • connector_id (ConnectorId) –

    A unique ID for the connector associated with the entitlement.

  • entitlement_type (EntitlementType) –

    The type of entitlement to create.

  • vm_ids (VmIdList) –

    The list of VMware vSphere virtual machine managed object IDs to create entitlements for.

Raises:

  • ResourceNotFoundException –

    A service resource associated with the request could not be found. The resource might not be specified correctly, or it may have a state of DELETED.

  • ThrottlingException –

    The operation could not be performed because the service is throttling requests. This exception is thrown when the service endpoint receives too many concurrent requests.

  • ValidationException –

    The input fails to satisfy the specified constraints. You will see this exception if invalid inputs are provided for any of the Amazon EVS environment operations, or if a list operation is performed on an environment resource that is still initializing.

  • UnknownServiceError –

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

Source code in docs_src/capo_evs/_services/async_evs.py
async def create_entitlement(
    self,
    environment_id: "capo_evs.types.environment_id.EnvironmentId",
    connector_id: "capo_evs.types.connector_id.ConnectorId",
    entitlement_type: "capo_evs.types.entitlement_type.EntitlementType",
    vm_ids: "capo_evs.types.vm_id_list.VmIdList",
    *,
    config_overrides: Optional[AsyncevsClientConfig] = None,
    client_token: Optional["capo_evs.types.client_token.ClientToken"] = None,
) -> "capo_evs.types.create_entitlement_response.CreateEntitlementResponse":
    """<p>Creates a Windows Server License entitlement for virtual machines in an Amazon EVS environment using the provided vCenter Server connector. This is an asynchronous operation. Amazon EVS validates the specified virtual machines before starting usage tracking.</p>

    Args:
        client_token: <note> <p>This parameter is not used in Amazon EVS currently. If you supply input for this parameter, it will have no effect.</p> </note> <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the entitlement creation request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
        environment_id: <p>A unique ID for the environment to create the entitlement in.</p>
        connector_id: <p>A unique ID for the connector associated with the entitlement.</p>
        entitlement_type: <p>The type of entitlement to create.</p>
        vm_ids: <p>The list of VMware vSphere virtual machine managed object IDs to create entitlements for.</p>

    Raises:
        capo_evs.errors.resource_not_found_exception.ResourceNotFoundException: <p>A service resource associated with the request could not be found. The resource might not be specified correctly, or it may have a <code>state</code> of <code>DELETED</code>.</p>
        capo_evs.errors.throttling_exception.ThrottlingException: <p>The operation could not be performed because the service is throttling requests. This exception is thrown when the service endpoint receives too many concurrent requests.</p>
        capo_evs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the specified constraints. You will see this exception if invalid inputs are provided for any of the Amazon EVS environment operations, or if a list operation is performed on an environment resource that is still initializing.</p>
        capo_evs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_evs.types.create_entitlement_request.CreateEntitlementRequest]",
    ) -> AsyncOperationResponse[
        "capo_evs.types.create_entitlement_response.CreateEntitlementResponse"
    ]:
        import capo_evs._operations.amazon_elastic_v_mware_service.create_entitlement

        (
            output,
            http_response,
        ) = await capo_evs._operations.amazon_elastic_v_mware_service.create_entitlement.async_create_entitlement(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEntitlement")
    )
    input_: capo_evs.types.create_entitlement_request.CreateEntitlementRequest = {
        "environment_id": environment_id,
        "connector_id": connector_id,
        "entitlement_type": entitlement_type,
        "vm_ids": vm_ids,
    }
    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