Skip to content

update_policy_store

update_policy_store(
    policy_store_id: PolicyStoreId,
    validation_settings: ValidationSettings,
    *,
    config_overrides: Optional[VerifiedPermissionsClientConfig] = None,
    deletion_protection: Optional[DeletionProtection] = None,
    description: Optional[PolicyStoreDescription] = None,
) -> UpdatePolicyStoreOutput

Modifies the validation setting for a policy store.

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:

  • policy_store_id (PolicyStoreId) –

    Specifies the ID of the policy store that you want to update

    To specify a policy store, use its ID or alias name. When using an alias name, prefix it with policy-store-alias/. For example:

    • ID: PSEXAMPLEabcdefg111111

    • Alias name: policy-store-alias/example-policy-store

    To view aliases, use ListPolicyStoreAliases.

  • validation_settings (ValidationSettings) –

    A structure that defines the validation settings that want to enable for the policy store.

  • deletion_protection (Optional[DeletionProtection], default: None ) –

    Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.

    When you call UpdatePolicyStore, this parameter is unchanged unless explicitly included in the call.

  • description (Optional[PolicyStoreDescription], default: None ) –

    Descriptive text that you can provide to help with identification of the current policy store.

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.

  • UnknownServiceError –

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

Examples:

UpdatePolicyStore The following example turns off the validation settings for a policy store.

>>> client.update_policy_store(policy_store_id='C7v5xMplfFH3i3e4Jrzb1a', validation_settings={'mode': 'OFF'})
Source code in docs_src/capo_verifiedpermissions/_services/verified_permissions.py
def update_policy_store(
    self,
    policy_store_id: "capo_verifiedpermissions.types.policy_store_id.PolicyStoreId",
    validation_settings: "capo_verifiedpermissions.types.validation_settings.ValidationSettings",
    *,
    config_overrides: Optional[VerifiedPermissionsClientConfig] = None,
    deletion_protection: Optional[
        "capo_verifiedpermissions.types.deletion_protection.DeletionProtection"
    ] = None,
    description: Optional[
        "capo_verifiedpermissions.types.policy_store_description.PolicyStoreDescription"
    ] = None,
) -> "capo_verifiedpermissions.types.update_policy_store_output.UpdatePolicyStoreOutput":
    """<p>Modifies the validation setting for a policy store.</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:
        policy_store_id: <p>Specifies the ID of the policy store that you want to update</p> <p>To specify a policy store, use its ID or alias name. When using an alias name, prefix it with <code>policy-store-alias/</code>. For example:</p> <ul> <li> <p>ID: <code>PSEXAMPLEabcdefg111111</code> </p> </li> <li> <p>Alias name: <code>policy-store-alias/example-policy-store</code> </p> </li> </ul> <p>To view aliases, use <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicyStoreAliases.html">ListPolicyStoreAliases</a>.</p>
        validation_settings: <p>A structure that defines the validation settings that want to enable for the policy store.</p>
        deletion_protection: <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>When you call <code>UpdatePolicyStore</code>, this parameter is unchanged unless explicitly included in the call.</p>
        description: <p>Descriptive text that you can provide to help with identification of the current policy store.</p>

    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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        UpdatePolicyStore
        The following example turns off the validation settings for a policy store.

        >>> client.update_policy_store(policy_store_id='C7v5xMplfFH3i3e4Jrzb1a', validation_settings={'mode': 'OFF'})
    """

    def _handler(
        req: "OperationRequest[capo_verifiedpermissions.types.update_policy_store_input.UpdatePolicyStoreInput]",
    ) -> OperationResponse[
        "capo_verifiedpermissions.types.update_policy_store_output.UpdatePolicyStoreOutput"
    ]:
        import capo_verifiedpermissions._operations.verified_permissions.update_policy_store

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

    def _redact_input(
        input_: "capo_verifiedpermissions.types.update_policy_store_input.UpdatePolicyStoreInput",
    ) -> dict[str, Any]:
        import capo_verifiedpermissions.types.update_policy_store_input

        return capo_verifiedpermissions.types.update_policy_store_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdatePolicyStore", redact_input=_redact_input),
    )
    input_: capo_verifiedpermissions.types.update_policy_store_input.UpdatePolicyStoreInput = {
        "policy_store_id": policy_store_id,
        "validation_settings": validation_settings,
    }
    if deletion_protection is not None:
        input_["deletion_protection"] = deletion_protection
    if description is not None:
        input_["description"] = description

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