create_policy_store
¶
create_policy_store(
validation_settings: ValidationSettings,
*,
config_overrides: Optional[VerifiedPermissionsClientConfig] = None,
client_token: Optional[IdempotencyToken] = None,
description: Optional[PolicyStoreDescription] = None,
deletion_protection: Optional[DeletionProtection] = None,
encryption_settings: Optional[EncryptionSettings] = None,
tags: Optional[TagMap] = None,
) -> CreatePolicyStoreOutput
Creates a policy store. A policy store is a container for policy resources.
As of May 2026, Verified Permissions has aligned with Cedar and now supports multiple namespaces.
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:
-
client_token(Optional[IdempotencyToken], default:None) –Specifies a unique, case-sensitive ID that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a UUID type of value..
If you don't provide this value, then Amazon Web Services generates a random one for you.
If you retry the operation with the same
ClientToken, but with different parameters, the retry fails with anConflictExceptionerror.Verified Permissions recognizes a
ClientTokenfor eight hours. After eight hours, the next request with the same parameters performs the operation again regardless of the value ofClientToken. -
validation_settings(ValidationSettings) –Specifies the validation setting for this policy store.
Currently, the only valid and required value is
Mode.We recommend that you turn on
STRICTmode only after you define a schema. If a schema doesn't exist, thenSTRICTmode causes any policy to fail validation, and Verified Permissions rejects the policy. You can turn off validation by using the UpdatePolicyStore. Then, when you have a schema defined, use UpdatePolicyStore again to turn validation back on. -
description(Optional[PolicyStoreDescription], default:None) –Descriptive text that you can provide to help with identification of the current 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.
The default state is
DISABLED. -
encryption_settings(Optional[EncryptionSettings], default:None) –Specifies the encryption settings used to encrypt the policy store and their child resources. Allows for the ability to use a customer owned KMS key for encryption of data.
This is an optional field to be used when providing a customer-managed KMS key for encryption.
-
tags(Optional[TagMap], default:None) –The list of key-value pairs to associate with the 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 anif...then...elseclause 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.
-
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:
To create policy store The following example creates a new policy store with strict validation turned on.
>>> client.create_policy_store(validation_settings={'mode': 'STRICT'}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
To create an encrypted policy store
The following example creates a new policy store with encryption settings based on a provided KMS key.
>>> client.create_policy_store(validation_settings={'mode': 'STRICT'}, encryption_settings={'kmsEncryptionSettings': {'key': 'arn:aws:kms:us-east-1:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456', 'encryptionContext': {'policy_store_owner': 'Tim'}}}, client_token='a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111')
Source code in docs_src/capo_verifiedpermissions/_services/verified_permissions.py
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |