Skip to content

create_grant async

create_grant(
    client_token: ClientToken,
    grant_name: String,
    license_arn: Arn,
    principals: PrincipalArnList,
    home_region: String,
    allowed_operations: AllowedOperationList,
    *,
    config_overrides: Optional[AsyncLicenseManagerClientConfig] = None,
    tags: Optional[TagList] = None,
) -> CreateGrantResponse

Creates a grant for the specified license. A grant shares the use of license entitlements with a specific Amazon Web Services account, an organization, or an organizational unit (OU). For more information, see Granted licenses in License Manager in the License Manager User Guide.

Parameters:

  • client_token (ClientToken) –

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

  • grant_name (String) –

    Grant name.

  • license_arn (Arn) –

    Amazon Resource Name (ARN) of the license.

  • principals (PrincipalArnList) –

    The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):

    • An Amazon Web Services account, which includes only the account specified.

    • An organizational unit (OU), which includes all accounts in the OU.

    • An organization, which will include all accounts across your organization.

  • home_region (String) –

    Home Region of the grant.

  • allowed_operations (AllowedOperationList) –

    Allowed operations for the grant.

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

    Tags to add to the grant. For more information about tagging support in License Manager, see the TagResource operation.

Raises:

Source code in docs_src/capo_license_manager/_services/async_license_manager.py
async def create_grant(
    self,
    client_token: "capo_license_manager.types.client_token.ClientToken",
    grant_name: "capo_license_manager.types.string.String",
    license_arn: "capo_license_manager.types.arn.Arn",
    principals: "capo_license_manager.types.principal_arn_list.PrincipalArnList",
    home_region: "capo_license_manager.types.string.String",
    allowed_operations: "capo_license_manager.types.allowed_operation_list.AllowedOperationList",
    *,
    config_overrides: Optional[AsyncLicenseManagerClientConfig] = None,
    tags: Optional["capo_license_manager.types.tag_list.TagList"] = None,
) -> "capo_license_manager.types.create_grant_response.CreateGrantResponse":
    """<p>Creates a grant for the specified license. A grant shares the use of license entitlements with a specific Amazon Web Services account, an organization, or an organizational unit (OU). For more information, see <a href="https://docs.aws.amazon.com/license-manager/latest/userguide/granted-licenses.html">Granted licenses in License Manager</a> in the <i>License Manager User Guide</i>.</p>

    Args:
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
        grant_name: <p>Grant name.</p>
        license_arn: <p>Amazon Resource Name (ARN) of the license.</p>
        principals: <p>The grant principals. You can specify one of the following as an Amazon Resource Name (ARN):</p> <ul> <li> <p>An Amazon Web Services account, which includes only the account specified.</p> </li> </ul> <ul> <li> <p>An organizational unit (OU), which includes all accounts in the OU.</p> </li> </ul> <ul> <li> <p>An organization, which will include all accounts across your organization.</p> </li> </ul>
        home_region: <p>Home Region of the grant.</p>
        allowed_operations: <p>Allowed operations for the grant.</p>
        tags: <p>Tags to add to the grant. For more information about tagging support in License Manager, see the <a href="https://docs.aws.amazon.com/license-manager/latest/APIReference/API_TagResource.html">TagResource</a> operation.</p>

    Raises:
        capo_license_manager.errors.access_denied_exception.AccessDeniedException: <p>Access to resource denied.</p>
        capo_license_manager.errors.authorization_exception.AuthorizationException: <p>The Amazon Web Services user account does not have permission to perform the action. Check the IAM policy associated with this account.</p>
        capo_license_manager.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more parameter values are not valid.</p>
        capo_license_manager.errors.rate_limit_exceeded_exception.RateLimitExceededException: <p>Too many requests have been submitted. Try again after a brief wait.</p>
        capo_license_manager.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>Your resource limits have been exceeded.</p>
        capo_license_manager.errors.server_internal_exception.ServerInternalException: <p>The server experienced an internal error. Try again.</p>
        capo_license_manager.errors.validation_exception.ValidationException: <p>The provided input is not valid. Try your request again.</p>
        capo_license_manager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_license_manager.types.create_grant_request.CreateGrantRequest]",
    ) -> AsyncOperationResponse[
        "capo_license_manager.types.create_grant_response.CreateGrantResponse"
    ]:
        import capo_license_manager._operations.aws_license_manager.create_grant

        (
            output,
            http_response,
        ) = await capo_license_manager._operations.aws_license_manager.create_grant.async_create_grant(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGrant")
    )
    input_: capo_license_manager.types.create_grant_request.CreateGrantRequest = {
        "client_token": client_token,
        "grant_name": grant_name,
        "license_arn": license_arn,
        "principals": principals,
        "home_region": home_region,
        "allowed_operations": allowed_operations,
    }
    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