CfnPolicyPropsMixin
- class aws_cdk.mixins_preview.aws_verifiedpermissions.mixins.CfnPolicyPropsMixin(props, *, strategy=None)
Bases:
MixinCreates or updates a Cedar policy and saves it in the specified policy store.
You can create either a static policy or a policy linked to a policy template.
You can directly update only static policies. To update a template-linked policy, you must update its linked policy template instead.
To create a static policy, in the
Definitioninclude aStaticelement that includes the Cedar policy text in theStatementelement.To create a policy that is dynamically linked to a policy template, in the
Definitioninclude aTemplatelinkedelement that specifies the policy template ID and the principal and resource to associate with this policy. If the policy template is ever updated, any policies linked to the policy template automatically use the updated template.
If policy validation is enabled in the policy store, then updating a static policy causes Verified Permissions to validate the policy against the schema in the policy store. If the updated static policy doesn’t pass validation, the operation fails and the update isn’t stored.
When you edit a static policy, You can change only certain elements of a static policy:
The action referenced by the policy.
A condition clause, such as when and unless.
You can’t change these elements of a static policy:
Changing a policy from a static policy to a template-linked policy.
Changing the effect of a static policy from permit or forbid.
The principal referenced by a static policy.
The resource referenced by a static policy.
To update a template-linked policy, you must update the template instead.
- See:
- CloudformationResource:
AWS::VerifiedPermissions::Policy
- Mixin:
true
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview import mixins from aws_cdk.mixins_preview.aws_verifiedpermissions import mixins as verifiedpermissions_mixins cfn_policy_props_mixin = verifiedpermissions_mixins.CfnPolicyPropsMixin(verifiedpermissions_mixins.CfnPolicyMixinProps( definition=verifiedpermissions_mixins.CfnPolicyPropsMixin.PolicyDefinitionProperty( static=verifiedpermissions_mixins.CfnPolicyPropsMixin.StaticPolicyDefinitionProperty( description="description", statement="statement" ), template_linked=verifiedpermissions_mixins.CfnPolicyPropsMixin.TemplateLinkedPolicyDefinitionProperty( policy_template_id="policyTemplateId", principal=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ), resource=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ) ) ), policy_store_id="policyStoreId" ), strategy=mixins.PropertyMergeStrategy.OVERRIDE )
Create a mixin to apply properties to
AWS::VerifiedPermissions::Policy.- Parameters:
props (
Union[CfnPolicyMixinProps,Dict[str,Any]]) – L1 properties to apply.strategy (
Optional[PropertyMergeStrategy]) – (experimental) Strategy for merging nested properties. Default: - PropertyMergeStrategy.MERGE
Methods
- apply_to(construct)
Apply the mixin properties to the construct.
- Parameters:
construct (
IConstruct)- Return type:
- supports(construct)
Check if this mixin supports the given construct.
- Parameters:
construct (
IConstruct)- Return type:
bool
Attributes
- CFN_PROPERTY_KEYS = ['definition', 'policyStoreId']
Static Methods
- classmethod is_mixin(x)
(experimental) Checks if
xis a Mixin.- Parameters:
x (
Any) – Any object.- Return type:
bool- Returns:
true if
xis an object created from a class which extendsMixin.- Stability:
experimental
EntityIdentifierProperty
- class CfnPolicyPropsMixin.EntityIdentifierProperty(*, entity_id=None, entity_type=None)
Bases:
objectContains the identifier of an entity in a policy, including its ID and type.
- Parameters:
entity_id (
Optional[str]) – The identifier of an entity."entityId":" *identifier* "entity_type (
Optional[str]) – The type of an entity. Example:"entityType":" *typeName* "
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_verifiedpermissions import mixins as verifiedpermissions_mixins entity_identifier_property = verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" )
Attributes
- entity_id
The identifier of an entity.
"entityId":" *identifier* "
- entity_type
The type of an entity.
Example:
"entityType":" *typeName* "
PolicyDefinitionProperty
- class CfnPolicyPropsMixin.PolicyDefinitionProperty(*, static=None, template_linked=None)
Bases:
objectA structure that defines a Cedar policy.
It includes the policy type, a description, and a policy body. This is a top level data type used to create a policy.
This data type is used as a request parameter for the CreatePolicy operation. This structure must always have either an
Staticor aTemplateLinkedelement.- Parameters:
static (
Union[IResolvable,StaticPolicyDefinitionProperty,Dict[str,Any],None]) – A structure that describes a static policy. An static policy doesn’t use a template or allow placeholders for entities.template_linked (
Union[IResolvable,TemplateLinkedPolicyDefinitionProperty,Dict[str,Any],None]) –A structure that describes a policy that was instantiated from a template. The template can specify placeholders for
principalandresource. When you use CreatePolicy to create a policy from a template, you specify the exact principal and resource to use for the instantiated policy.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_verifiedpermissions import mixins as verifiedpermissions_mixins policy_definition_property = verifiedpermissions_mixins.CfnPolicyPropsMixin.PolicyDefinitionProperty( static=verifiedpermissions_mixins.CfnPolicyPropsMixin.StaticPolicyDefinitionProperty( description="description", statement="statement" ), template_linked=verifiedpermissions_mixins.CfnPolicyPropsMixin.TemplateLinkedPolicyDefinitionProperty( policy_template_id="policyTemplateId", principal=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ), resource=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ) ) )
Attributes
- static
A structure that describes a static policy.
An static policy doesn’t use a template or allow placeholders for entities.
- template_linked
A structure that describes a policy that was instantiated from a template.
The template can specify placeholders for
principalandresource. When you use CreatePolicy to create a policy from a template, you specify the exact principal and resource to use for the instantiated policy.
StaticPolicyDefinitionProperty
- class CfnPolicyPropsMixin.StaticPolicyDefinitionProperty(*, description=None, statement=None)
Bases:
objectA structure that defines a static policy.
- Parameters:
description (
Optional[str]) – The description of the static policy.statement (
Optional[str]) – The policy content of the static policy, written in the Cedar policy language.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_verifiedpermissions import mixins as verifiedpermissions_mixins static_policy_definition_property = verifiedpermissions_mixins.CfnPolicyPropsMixin.StaticPolicyDefinitionProperty( description="description", statement="statement" )
Attributes
- description
The description of the static policy.
- statement
The policy content of the static policy, written in the Cedar policy language.
TemplateLinkedPolicyDefinitionProperty
- class CfnPolicyPropsMixin.TemplateLinkedPolicyDefinitionProperty(*, policy_template_id=None, principal=None, resource=None)
Bases:
objectA structure that describes a policy created by instantiating a policy template.
You can’t directly update a template-linked policy. You must update the associated policy template instead.
- Parameters:
policy_template_id (
Optional[str]) – The unique identifier of the policy template used to create this policy.principal (
Union[IResolvable,EntityIdentifierProperty,Dict[str,Any],None]) – The principal associated with this template-linked policy. Verified Permissions substitutes this principal for the?principalplaceholder in the policy template when it evaluates an authorization request.resource (
Union[IResolvable,EntityIdentifierProperty,Dict[str,Any],None]) – The resource associated with this template-linked policy. Verified Permissions substitutes this resource for the?resourceplaceholder in the policy template when it evaluates an authorization request.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk.mixins_preview.aws_verifiedpermissions import mixins as verifiedpermissions_mixins template_linked_policy_definition_property = verifiedpermissions_mixins.CfnPolicyPropsMixin.TemplateLinkedPolicyDefinitionProperty( policy_template_id="policyTemplateId", principal=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ), resource=verifiedpermissions_mixins.CfnPolicyPropsMixin.EntityIdentifierProperty( entity_id="entityId", entity_type="entityType" ) )
Attributes
- policy_template_id
The unique identifier of the policy template used to create this policy.
- principal
The principal associated with this template-linked policy.
Verified Permissions substitutes this principal for the
?principalplaceholder in the policy template when it evaluates an authorization request.
- resource
The resource associated with this template-linked policy.
Verified Permissions substitutes this resource for the
?resourceplaceholder in the policy template when it evaluates an authorization request.