Skip to content

delete_policy_store_alias

delete_policy_store_alias(
    alias_name: Alias,
    *,
    config_overrides: Optional[VerifiedPermissionsClientConfig] = None,
    deletion_mode: Optional[DeletionMode] = None,
) -> DeletePolicyStoreAliasOutput

Deletes the specified policy store alias.

This operation is idempotent. If you specify a policy store alias that does not exist, the request response will still return a successful HTTP 200 status code.

By default, when a policy store alias is deleted, it enters the PendingDeletion state. When a policy store alias is in the PendingDeletion state, new policy store aliases cannot be created with the same name. If the policy store alias is used in an API that has a policyStoreId field, the operation will fail with a ResourceNotFound exception.

To immediately delete a policy store alias and bypass the PendingDeletion state, set the deletionMode parameter to HardDelete.

Verified Permissions is eventually consistent. If you hard delete a policy store alias and then immediately recreate it to be associated with a different policy store, requests that reference this alias may continue to be evaluated against the previously associated policy store for a short period of time.

Parameters:

  • alias_name (Alias) –

    Specifies the name of the policy store alias that you want to delete.

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

  • deletion_mode (Optional[DeletionMode], default: None ) –

    Specifies the deletion mode for the policy store alias. The valid values are:

    • SoftDelete – The policy store alias enters the PendingDeletion state. This is the default behavior when no deletionMode is specified.

    • HardDelete – The policy store alias is immediately deleted, bypassing the PendingDeletion state.

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.

  • InvalidStateException –

    The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.

  • UnknownServiceError –

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

Examples:

Soft delete a policy store alias The following example soft deletes the policy store alias with name example-policy-store. The alias enters the PendingDeletion state.

>>> client.delete_policy_store_alias(alias_name='policy-store-alias/example-policy-store')
Hard delete a policy store alias
The following example hard deletes the policy store alias with name example-policy-store. The alias is immediately deleted, bypassing the PendingDeletion state.
>>> client.delete_policy_store_alias(alias_name='policy-store-alias/example-policy-store', deletion_mode='HardDelete')
Source code in docs_src/capo_verifiedpermissions/_services/verified_permissions.py
def delete_policy_store_alias(
    self,
    alias_name: "capo_verifiedpermissions.types.alias.Alias",
    *,
    config_overrides: Optional[VerifiedPermissionsClientConfig] = None,
    deletion_mode: Optional[
        "capo_verifiedpermissions.types.deletion_mode.DeletionMode"
    ] = None,
) -> "capo_verifiedpermissions.types.delete_policy_store_alias_output.DeletePolicyStoreAliasOutput":
    """<p>Deletes the specified policy store alias.</p> <p>This operation is idempotent. If you specify a policy store alias that does not exist, the request response will still return a successful HTTP 200 status code.</p> <p>By default, when a policy store alias is deleted, it enters the <code>PendingDeletion</code> state. When a policy store alias is in the <code>PendingDeletion</code> state, new policy store aliases cannot be created with the same name. If the policy store alias is used in an API that has a <code>policyStoreId</code> field, the operation will fail with a <code>ResourceNotFound</code> exception.</p> <p>To immediately delete a policy store alias and bypass the <code>PendingDeletion</code> state, set the <code>deletionMode</code> parameter to <code>HardDelete</code>.</p> <important> <p>Verified Permissions is eventually consistent. If you hard delete a policy store alias and then immediately recreate it to be associated with a different policy store, requests that reference this alias may continue to be evaluated against the previously associated policy store for a short period of time.</p> </important>

    Args:
        alias_name: <p>Specifies the name of the policy store alias that you want to delete.</p> <note> <p>The alias name must always be prefixed with <code>policy-store-alias/</code>.</p> </note>
        deletion_mode: <p>Specifies the deletion mode for the policy store alias. The valid values are:</p> <ul> <li> <p> <b>SoftDelete</b> – The policy store alias enters the <code>PendingDeletion</code> state. This is the default behavior when no <code>deletionMode</code> is specified.</p> </li> <li> <p> <b>HardDelete</b> – The policy store alias is immediately deleted, bypassing the <code>PendingDeletion</code> state.</p> </li> </ul>

    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.invalid_state_exception.InvalidStateException: <p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>
        capo_verifiedpermissions.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Soft delete a policy store alias
        The following example soft deletes the policy store alias with name example-policy-store. The alias enters the PendingDeletion state.

        >>> client.delete_policy_store_alias(alias_name='policy-store-alias/example-policy-store')
        Hard delete a policy store alias
        The following example hard deletes the policy store alias with name example-policy-store. The alias is immediately deleted, bypassing the PendingDeletion state.

        >>> client.delete_policy_store_alias(alias_name='policy-store-alias/example-policy-store', deletion_mode='HardDelete')
    """

    def _handler(
        req: "OperationRequest[capo_verifiedpermissions.types.delete_policy_store_alias_input.DeletePolicyStoreAliasInput]",
    ) -> OperationResponse[
        "capo_verifiedpermissions.types.delete_policy_store_alias_output.DeletePolicyStoreAliasOutput"
    ]:
        import capo_verifiedpermissions._operations.verified_permissions.delete_policy_store_alias

        output, http_response = (
            capo_verifiedpermissions._operations.verified_permissions.delete_policy_store_alias.delete_policy_store_alias(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeletePolicyStoreAlias")
    )
    input_: capo_verifiedpermissions.types.delete_policy_store_alias_input.DeletePolicyStoreAliasInput = {
        "alias_name": alias_name
    }
    if deletion_mode is not None:
        input_["deletion_mode"] = deletion_mode

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output