# PolicyDefinitionProperty

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](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_CreatePolicy.html) operation. This structure must always have either an `Static` or a `TemplateLinked` element.

- Source: Generated at build time
- Type last changed: v2.93.0 · 23 Aug 2023

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
        }
    }
};
```

Golang:

```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

- `static`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnPolicy.StaticPolicyDefinitionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_verifiedpermissions.CfnPolicy.StaticPolicyDefinitionProperty.html) — A structure that describes a static policy.

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

- `templateLinked`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnPolicy.TemplateLinkedPolicyDefinitionProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_verifiedpermissions.CfnPolicy.TemplateLinkedPolicyDefinitionProperty.html) — A structure that describes a policy that was instantiated from a template.

  The template can specify placeholders for `principal` and `resource` . When you use [CreatePolicy](https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_CreatePolicy.html) to create a policy from a template, you specify the exact principal and resource to use for the instantiated policy.
