Skip to content
v2.278.0

PolicyDefinitionProperty Struct ​

A 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 Static or a TemplateLinked element.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_verifiedpermissions as verifiedpermissions } from 'aws-cdk-lib';
const policyDefinitionProperty: verifiedpermissions.CfnPolicy.PolicyDefinitionProperty = {
  static: {
    statement: 'statement',

    // the properties below are optional
    description: 'description',
  },
  templateLinked: {
    policyTemplateId: 'policyTemplateId',

    // the properties below are optional
    principal: {
      entityId: 'entityId',
      entityType: 'entityType',
    },
    resource: {
      entityId: 'entityId',
      entityType: 'entityType',
    },
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_verifiedpermissions as verifiedpermissions

policy_definition_property = verifiedpermissions.CfnPolicy.PolicyDefinitionProperty(
    static=verifiedpermissions.CfnPolicy.StaticPolicyDefinitionProperty(
        statement="statement",

        # the properties below are optional
        description="description"
    ),
    template_linked=verifiedpermissions.CfnPolicy.TemplateLinkedPolicyDefinitionProperty(
        policy_template_id="policyTemplateId",

        # the properties below are optional
        principal=verifiedpermissions.CfnPolicy.EntityIdentifierProperty(
            entity_id="entityId",
            entity_type="entityType"
        ),
        resource=verifiedpermissions.CfnPolicy.EntityIdentifierProperty(
            entity_id="entityId",
            entity_type="entityType"
        )
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.verifiedpermissions.*;

PolicyDefinitionProperty policyDefinitionProperty = PolicyDefinitionProperty.builder()
        .static(StaticPolicyDefinitionProperty.builder()
                .statement("statement")

                // the properties below are optional
                .description("description")
                .build())
        .templateLinked(TemplateLinkedPolicyDefinitionProperty.builder()
                .policyTemplateId("policyTemplateId")

                // the properties below are optional
                .principal(EntityIdentifierProperty.builder()
                        .entityId("entityId")
                        .entityType("entityType")
                        .build())
                .resource(EntityIdentifierProperty.builder()
                        .entityId("entityId")
                        .entityType("entityType")
                        .build())
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.VerifiedPermissions;

var policyDefinitionProperty = new PolicyDefinitionProperty {
    Static = new StaticPolicyDefinitionProperty {
        Statement = "statement",

        // the properties below are optional
        Description = "description"
    },
    TemplateLinked = new TemplateLinkedPolicyDefinitionProperty {
        PolicyTemplateId = "policyTemplateId",

        // the properties below are optional
        Principal = new EntityIdentifierProperty {
            EntityId = "entityId",
            EntityType = "entityType"
        },
        Resource = new EntityIdentifierProperty {
            EntityId = "entityId",
            EntityType = "entityType"
        }
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

policyDefinitionProperty := &PolicyDefinitionProperty{
	Static: &StaticPolicyDefinitionProperty{
		Statement: jsii.String("statement"),

		// the properties below are optional
		Description: jsii.String("description"),
	},
	TemplateLinked: &TemplateLinkedPolicyDefinitionProperty{
		PolicyTemplateId: jsii.String("policyTemplateId"),

		// the properties below are optional
		Principal: &EntityIdentifierProperty{
			EntityId: jsii.String("entityId"),
			EntityType: jsii.String("entityType"),
		},
		Resource: &EntityIdentifierProperty{
			EntityId: jsii.String("entityId"),
			EntityType: jsii.String("entityType"),
		},
	},
}

Properties ​

staticoptionalIResolvable | CfnPolicy.StaticPolicyDefinitionPropertystaticoptionaltyping.Union[IResolvable, StaticPolicyDefinitionProperty]staticoptionalIResolvableStaticoptionalIResolvableStaticoptionalinterface{} #
A structure that describes a static policy.

An static policy doesn't use a template or allow placeholders for entities.

templateLinkedoptionalIResolvable | CfnPolicy.TemplateLinkedPolicyDefinitionPropertytemplate_linkedoptionaltyping.Union[IResolvable, TemplateLinkedPolicyDefinitionProperty]templateLinkedoptionalIResolvableTemplateLinkedoptionalIResolvableTemplateLinkedoptionalinterface{} #
A structure that describes a policy that was instantiated from a template.
notes

The template can specify placeholders for principal and resource . When you use CreatePolicy to create a policy from a template, you specify the exact principal and resource to use for the instantiated policy.