Skip to content

associate_user async

associate_user(
    username: str,
    instance_id: str,
    identity_provider: IdentityProvider,
    *,
    config_overrides: Optional[AsyncLicenseManagerUserSubscriptionsClientConfig] = None,
    domain: Optional[str] = None,
    tags: Optional[Tags] = None,
) -> AssociateUserResponse

Associates the user to an EC2 instance to utilize user-based subscriptions.

Your estimated bill for charges on the number of users and related costs will take 48 hours to appear for billing periods that haven't closed (marked as Pending billing status) in Amazon Web Services Billing. For more information, see Viewing your monthly charges in the Amazon Web Services Billing User Guide.

Parameters:

  • username (str) –

    The user name from the identity provider.

  • instance_id (str) –

    The ID of the EC2 instance that provides the user-based subscription.

  • identity_provider (IdentityProvider) –

    The identity provider for the user.

  • domain (Optional[str], default: None ) –

    The domain name of the Active Directory that contains information for the user to associate.

  • tags (Optional[Tags], default: None ) –

    The tags that apply for the user association.

Raises:

Source code in docs_src/capo_license_manager_user_subscriptions/_services/async_license_manager_user_subscriptions.py
async def associate_user(
    self,
    username: str,
    instance_id: str,
    identity_provider: "capo_license_manager_user_subscriptions.types.identity_provider.IdentityProvider",
    *,
    config_overrides: Optional[
        AsyncLicenseManagerUserSubscriptionsClientConfig
    ] = None,
    domain: Optional[str] = None,
    tags: Optional[
        "capo_license_manager_user_subscriptions.types.tags.Tags"
    ] = None,
) -> "capo_license_manager_user_subscriptions.types.associate_user_response.AssociateUserResponse":
    """<p>Associates the user to an EC2 instance to utilize user-based subscriptions.</p> <note> <p>Your estimated bill for charges on the number of users and related costs will take 48 hours to appear for billing periods that haven't closed (marked as <b>Pending</b> billing status) in Amazon Web Services Billing. For more information, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/invoice.html">Viewing your monthly charges</a> in the <i>Amazon Web Services Billing User Guide</i>.</p> </note>

    Args:
        username: <p>The user name from the identity provider.</p>
        instance_id: <p>The ID of the EC2 instance that provides the user-based subscription.</p>
        identity_provider: <p>The identity provider for the user.</p>
        domain: <p>The domain name of the Active Directory that contains information for the user to associate.</p>
        tags: <p>The tags that apply for the user association.</p>

    Raises:
        capo_license_manager_user_subscriptions.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_license_manager_user_subscriptions.errors.conflict_exception.ConflictException: <p>The request couldn't be completed because it conflicted with the current state of the resource.</p>
        capo_license_manager_user_subscriptions.errors.internal_server_exception.InternalServerException: <p>An exception occurred with the service.</p>
        capo_license_manager_user_subscriptions.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource couldn't be found.</p>
        capo_license_manager_user_subscriptions.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request failed because a service quota is exceeded.</p>
        capo_license_manager_user_subscriptions.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Retry the request.</p>
        capo_license_manager_user_subscriptions.errors.validation_exception.ValidationException: <p>A parameter is not valid.</p>
        capo_license_manager_user_subscriptions.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_license_manager_user_subscriptions.types.associate_user_request.AssociateUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_license_manager_user_subscriptions.types.associate_user_response.AssociateUserResponse"
    ]:
        import capo_license_manager_user_subscriptions._operations.license_manager_user_subscriptions.associate_user

        (
            output,
            http_response,
        ) = await capo_license_manager_user_subscriptions._operations.license_manager_user_subscriptions.associate_user.async_associate_user(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_license_manager_user_subscriptions.types.associate_user_request.AssociateUserRequest",
    ) -> dict[str, Any]:
        import capo_license_manager_user_subscriptions.types.associate_user_request

        return capo_license_manager_user_subscriptions.types.associate_user_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("AssociateUser", redact_input=_redact_input),
    )
    input_: capo_license_manager_user_subscriptions.types.associate_user_request.AssociateUserRequest = {
        "username": username,
        "instance_id": instance_id,
        "identity_provider": identity_provider,
    }
    if domain is not None:
        input_["domain"] = domain
    if tags is not None:
        input_["tags"] = tags

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