Skip to content

create_policy_store_alias async

create_policy_store_alias(
    alias_name: Alias,
    policy_store_id: PolicyStoreId,
    *,
    config_overrides: Optional[AsyncVerifiedPermissionsClientConfig] = None,
) -> CreatePolicyStoreAliasOutput

Creates a policy store alias for the specified policy store. A policy store alias is an alternative identifier that you can use to reference a policy store in API operations.

This operation is idempotent. If multiple CreatePolicyStoreAlias requests are made where the aliasName and policyStoreId fields are the same between the requests, subsequent requests will be ignored. For each duplicate CreatePolicyStoreAlias request, a Success response will be returned and a new policy store alias will not be created.

Verified Permissions is eventually consistent . It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.

Parameters:

  • alias_name (Alias) –

    Specifies the name of the policy store alias to create. The name must be unique within your Amazon Web Services account and Amazon Web Services Region.

    The alias name must always be prefixed with policy-store-alias/.

  • policy_store_id (PolicyStoreId) –

    Specifies the ID of the policy store to associate with the alias.

    The associated policy store must be specified using its ID. The alias name cannot be used.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action.

  • InternalServerException –

    The request failed because of an internal error. Try your request again later

  • ThrottlingException –

    The request failed because it exceeded a throttling quota.

  • ValidationException –

    The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.

    The possible reasons include the following:

    • UnrecognizedEntityType

      The policy includes an entity type that isn't found in the schema.

    • UnrecognizedActionId

      The policy includes an action id that isn't found in the schema.

    • InvalidActionApplication

      The policy includes an action that, according to the schema, doesn't support the specified principal and resource.

    • UnexpectedType

      The policy included an operand that isn't a valid type for the specified operation.

    • IncompatibleTypes

      The types of elements included in a set, or the types of expressions used in an if...then...else clause aren't compatible in this context.

    • MissingAttribute

      The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

    • UnsafeOptionalAttributeAccess

      The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

    • ImpossiblePolicy

      Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.

    • WrongNumberArguments

      The policy references an extension type with the wrong number of arguments.

    • FunctionArgumentValidationError

      Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.

  • ConflictException –

    The request failed because another request to modify a resource occurred at the same time.

  • ResourceNotFoundException –

    The request failed because it references a resource that doesn't exist.

  • ServiceQuotaExceededException –

    The request failed because it would cause a service quota to be exceeded.

  • UnknownServiceError –

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

Examples:

CreatePolicyStoreAlias The following example creates a new policy store alias.

>>> await client.create_policy_store_alias(alias_name='policy-store-alias/example-policy-store', policy_store_id='C7v5xMplfFH3i3e4Jrzb1a')
Source code in docs_src/capo_verifiedpermissions/_services/async_verified_permissions.py
async def create_policy_store_alias(
    self,
    alias_name: "capo_verifiedpermissions.types.alias.Alias",
    policy_store_id: "capo_verifiedpermissions.types.policy_store_id.PolicyStoreId",
    *,
    config_overrides: Optional[AsyncVerifiedPermissionsClientConfig] = None,
) -> "capo_verifiedpermissions.types.create_policy_store_alias_output.CreatePolicyStoreAliasOutput":
    """<p>Creates a policy store alias for the specified policy store. A policy store alias is an alternative identifier that you can use to reference a policy store in API operations.</p> <p>This operation is idempotent. If multiple CreatePolicyStoreAlias requests are made where the <code>aliasName</code> and <code>policyStoreId</code> fields are the same between the requests, subsequent requests will be ignored. For each duplicate CreatePolicyStoreAlias request, a Success response will be returned and a new policy store alias will not be created.</p> <note> <p>Verified Permissions is <i> <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a> </i>. It can take a few seconds for a new or changed element to propagate through the service and be visible in the results of other Verified Permissions operations.</p> </note>

    Args:
        alias_name: <p>Specifies the name of the policy store alias to create. The name must be unique within your Amazon Web Services account and Amazon Web Services Region.</p> <note> <p>The alias name must always be prefixed with <code>policy-store-alias/</code>.</p> </note>
        policy_store_id: <p>Specifies the ID of the policy store to associate with the alias.</p> <note> <p>The associated policy store must be specified using its ID. The alias name cannot be used.</p> </note>

    Raises:
        capo_verifiedpermissions.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action.</p>
        capo_verifiedpermissions.errors.internal_server_exception.InternalServerException: <p>The request failed because of an internal error. Try your request again later</p>
        capo_verifiedpermissions.errors.throttling_exception.ThrottlingException: <p>The request failed because it exceeded a throttling quota.</p>
        capo_verifiedpermissions.errors.validation_exception.ValidationException: <p>The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.</p> <p>The possible reasons include the following:</p> <ul> <li> <p> <b>UnrecognizedEntityType</b> </p> <p>The policy includes an entity type that isn't found in the schema.</p> </li> <li> <p> <b>UnrecognizedActionId</b> </p> <p>The policy includes an action id that isn't found in the schema.</p> </li> <li> <p> <b>InvalidActionApplication</b> </p> <p>The policy includes an action that, according to the schema, doesn't support the specified principal and resource.</p> </li> <li> <p> <b>UnexpectedType</b> </p> <p>The policy included an operand that isn't a valid type for the specified operation.</p> </li> <li> <p> <b>IncompatibleTypes</b> </p> <p>The types of elements included in a <code>set</code>, or the types of expressions used in an <code>if...then...else</code> clause aren't compatible in this context.</p> </li> <li> <p> <b>MissingAttribute</b> </p> <p>The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the <i>Cedar Policy Language Guide</i>.</p> </li> <li> <p> <b>UnsafeOptionalAttributeAccess</b> </p> <p>The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the <i>Cedar Policy Language Guide</i>.</p> </li> <li> <p> <b>ImpossiblePolicy</b> </p> <p>Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.</p> </li> <li> <p> <b>WrongNumberArguments</b> </p> <p>The policy references an extension type with the wrong number of arguments.</p> </li> <li> <p> <b>FunctionArgumentValidationError</b> </p> <p>Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.</p> </li> </ul>
        capo_verifiedpermissions.errors.conflict_exception.ConflictException: <p>The request failed because another request to modify a resource occurred at the same time.</p>
        capo_verifiedpermissions.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request failed because it references a resource that doesn't exist.</p>
        capo_verifiedpermissions.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request failed because it would cause a service quota to be exceeded.</p>
        capo_verifiedpermissions.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreatePolicyStoreAlias
        The following example creates a new policy store alias.

        >>> await client.create_policy_store_alias(alias_name='policy-store-alias/example-policy-store', policy_store_id='C7v5xMplfFH3i3e4Jrzb1a')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_verifiedpermissions.types.create_policy_store_alias_input.CreatePolicyStoreAliasInput]",
    ) -> AsyncOperationResponse[
        "capo_verifiedpermissions.types.create_policy_store_alias_output.CreatePolicyStoreAliasOutput"
    ]:
        import capo_verifiedpermissions._operations.verified_permissions.create_policy_store_alias

        (
            output,
            http_response,
        ) = await capo_verifiedpermissions._operations.verified_permissions.create_policy_store_alias.async_create_policy_store_alias(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePolicyStoreAlias")
    )
    input_: capo_verifiedpermissions.types.create_policy_store_alias_input.CreatePolicyStoreAliasInput = {
        "alias_name": alias_name,
        "policy_store_id": policy_store_id,
    }

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