cdklabs.cdk-verified-permissions


Namecdklabs.cdk-verified-permissions JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://github.com/cdklabs/cdk-verified-permissions.git
SummaryL2 AWS CDK Constructs for Amazon Verified Permissions
upload_time2024-10-11 10:48:17
maintainerNone
docs_urlNone
authorAmazon Web Services<aws-cdk-dev@amazon.com>
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Amazon Verified Permissions L2 CDK Construct

This repo contains the implementation of an L2 CDK Construct for Amazon Verified Permissions

# Project Stability

This construct is still versioned with alpha/v0 major version and we could introduce breaking changes even without a major version bump. Our goal is to keep the API stable & backwards compatible as much as possible but we currently cannot guarantee that. Once we'll publish v1.0.0 the breaking changes will be introduced via major version bumps.

# Getting Started

## Policy Store

Define a Policy Store with defaults (No description, No schema & Validation Settings Mode set to OFF):

```python
test = PolicyStore(scope, "PolicyStore")
```

Define a Policy Store without Schema definition (Validation Settings Mode must be set to OFF):

```python
validation_settings_off = {
    "mode": ValidationSettingsMode.OFF
}
test = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_off
)
```

Define a Policy Store with Description and Schema definition (a STRICT Validation Settings Mode is strongly suggested for Policy Stores with schemas):

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = {
    "PhotoApp": {
        "entity_types": {
            "User": {},
            "Photo": {}
        },
        "actions": {
            "view_photo": {
                "applies_to": {
                    "principal_types": ["User"],
                    "resource_types": ["Photo"]
                }
            }
        }
    }
}
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict,
    description="PolicyStore description"
)
```

## Schemas

If you want to have type safety when defining a schema, you can accomplish this **<ins>only</ins>** in typescript. Simply use the `Schema` type exported by the `@cedar-policy/cedar-wasm`.

You can also generate simple schemas using the static functions `schemaFromOpenApiSpec` or `schemaFromRestApi` in the PolicyStore construct. This functionality replicates what you can find in the AWS Verified Permissions console.

Generate a schema from an OpenAPI spec:

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = PolicyStore.schema_from_open_api_spec("path/to/swaggerfile.json", "UserGroup")
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict,
    description="Policy store with schema generated from API Gateway"
)
```

Generate a schema from a RestApi construct:

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = PolicyStore.schema_from_rest_api(
    RestApi(scope, "RestApi"), "UserGroup")
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict,
    description="Policy store with schema generated from RestApi construct"
)
```

## Identity Source

Define Identity Source with Cognito Configuration and required properties:

```python
user_pool = UserPool(scope, "UserPool") # Creating a new Cognito UserPool
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = {
    "PhotoApp": {
        "entity_types": {
            "User": {},
            "Photo": {}
        },
        "actions": {
            "view_photo": {
                "applies_to": {
                    "principal_types": ["User"],
                    "resource_types": ["Photo"]
                }
            }
        }
    }
}
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict
)
IdentitySource(scope, "IdentitySource",
    configuration=IdentitySourceConfiguration(
        cognito_user_pool_configuration=CognitoUserPoolConfiguration(
            user_pool=user_pool
        )
    ),
    policy_store=policy_store
)
```

Define Identity Source with Cognito Configuration and all properties:

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = {
    "PhotoApp": {
        "entity_types": {
            "User": {},
            "Photo": {}
        },
        "actions": {
            "view_photo": {
                "applies_to": {
                    "principal_types": ["User"],
                    "resource_types": ["Photo"]
                }
            }
        }
    }
}
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict
)
cognito_group_entity_type = "test"
user_pool = UserPool(scope, "UserPool") # Creating a new Cognito UserPool
IdentitySource(scope, "IdentitySource",
    configuration=IdentitySourceConfiguration(
        cognito_user_pool_configuration=CognitoUserPoolConfiguration(
            client_ids=["&ExampleCogClientId;"],
            user_pool=user_pool,
            group_configuration=CognitoGroupConfiguration(
                group_entity_type=cognito_group_entity_type
            )
        )
    ),
    policy_store=policy_store,
    principal_entity_type="PETEXAMPLEabcdefg111111"
)
```

Define Identity Source with OIDC Configuration and Access Token selection config:

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = {
    "PhotoApp": {
        "entity_types": {
            "User": {},
            "Photo": {}
        },
        "actions": {
            "view_photo": {
                "applies_to": {
                    "principal_types": ["User"],
                    "resource_types": ["Photo"]
                }
            }
        }
    }
}
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict
)
issuer = "https://iamanidp.com"
principal_id_claim = "sub"
entity_id_prefix = "prefix"
group_claim = "group"
group_entity_type = "GroupType"
IdentitySource(scope, "IdentitySource",
    configuration=IdentitySourceConfiguration(
        open_id_connect_configuration=OpenIdConnectConfiguration(
            issuer=issuer,
            entity_id_prefix=entity_id_prefix,
            group_configuration=OpenIdConnectGroupConfiguration(
                group_claim=group_claim,
                group_entity_type=group_entity_type
            ),
            access_token_only=OpenIdConnectAccessTokenConfiguration(
                audiences=["testAudience"],
                principal_id_claim=principal_id_claim
            )
        )
    ),
    policy_store=policy_store,
    principal_entity_type="TestType"
)
```

Define Identity Source with OIDC Configuration and Identity Token selection config:

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
cedar_json_schema = {
    "PhotoApp": {
        "entity_types": {
            "User": {},
            "Photo": {}
        },
        "actions": {
            "view_photo": {
                "applies_to": {
                    "principal_types": ["User"],
                    "resource_types": ["Photo"]
                }
            }
        }
    }
}
cedar_schema = {
    "cedar_json": JSON.stringify(cedar_json_schema)
}
policy_store = PolicyStore(scope, "PolicyStore",
    schema=cedar_schema,
    validation_settings=validation_settings_strict
)
issuer = "https://iamanidp.com"
entity_id_prefix = "prefix"
group_claim = "group"
group_entity_type = "UserGroup"
principal_id_claim = "sub"
IdentitySource(scope, "IdentitySource",
    configuration=IdentitySourceConfiguration(
        open_id_connect_configuration=OpenIdConnectConfiguration(
            issuer=issuer,
            entity_id_prefix=entity_id_prefix,
            group_configuration=OpenIdConnectGroupConfiguration(
                group_claim=group_claim,
                group_entity_type=group_entity_type
            ),
            identity_token_only=OpenIdConnectIdentityTokenConfiguration(
                client_ids=[],
                principal_id_claim=principal_id_claim
            )
        )
    ),
    policy_store=policy_store
)
```

## Policy

Load all the `.cedar` files in a given folder and define Policy objects for each of them. All policies will be associated with the same policy store.

```python
validation_settings_strict = {
    "mode": ValidationSettingsMode.STRICT
}
policy_store = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_strict
)
policy_store.add_policies_from_path("/path/to/my-policies")
```

Define a Policy and add it to a specific Policy Store:

```python
statement = """permit(
    principal,
    action in [MyFirstApp::Action::"Read"],
    resource
) when {
    true
};"""

description = "Test policy assigned to the test store"
validation_settings_off = {
    "mode": ValidationSettingsMode.OFF
}
policy_store = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_off
)

# Create a policy and add it to the policy store
policy = Policy(scope, "MyTestPolicy",
    definition=PolicyDefinitionProperty(
        static=StaticPolicyDefinitionProperty(
            statement=statement,
            description=description
        )
    ),
    policy_store=policy_store
)
```

Define a policy with a template linked definition:

```python
validation_settings_off = {
    "mode": ValidationSettingsMode.OFF
}
policy_store = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_off
)
policy_template_statement = """
permit (
  principal == ?principal,
  action in [TinyTodo::Action::"ReadList", TinyTodo::Action::"ListTasks"],
  resource == ?resource
);"""
template = PolicyTemplate(scope, "PolicyTemplate",
    statement=policy_template_statement,
    policy_store=policy_store
)

policy = Policy(scope, "MyTestPolicy",
    definition=PolicyDefinitionProperty(
        template_linked=TemplateLinkedPolicyDefinitionProperty(
            policy_template=template,
            principal=EntityIdentifierProperty(
                entity_id="exampleId",
                entity_type="exampleType"
            ),
            resource=EntityIdentifierProperty(
                entity_id="exampleId",
                entity_type="exampleType"
            )
        )
    ),
    policy_store=policy_store
)
```

Define a Policy with a statement from file:
**PLEASE NOTE:** You can specify the description of the policy directly inside the Policy file, using the annotation `@cdkDescription`

```python
description = "Test policy assigned to the test store"
validation_settings_off = {
    "mode": ValidationSettingsMode.OFF
}
policy_store = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_off
)

# Create a policy and add it to the policy store
policy_from_file_props = {
    "policy_store": policy_store,
    "path": "/path/to/policy-statement.cedar",
    "description": "the policy description"
}
policy = Policy.from_file(scope, "MyTestPolicy", policy_from_file_props)
```

## Policy Template

Define a Policy Template referring to a Cedar Statement in local file:

```python
validation_settings_off = {
    "mode": ValidationSettingsMode.OFF
}
policy_store = PolicyStore(scope, "PolicyStore",
    validation_settings=validation_settings_off
)
template_from_file_props = {
    "policy_store": policy_store,
    "path": "/path/to/template-statement.cedar",
    "description": "Allows sharing photos in full access mode"
}
template = PolicyTemplate.from_file(scope, "PolicyTemplate", template_from_file_props)
```

# Notes

* This project is following the AWS CDK Official Design Guidelines (see https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) and the AWS CDK New Constructs Creation Guide (see here https://github.com/aws/aws-cdk/blob/main/docs/NEW_CONSTRUCTS_GUIDE.md).
* Feedback is a gift: if you find something wrong or you've ideas to improve please open an issue or a pull request

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cdklabs/cdk-verified-permissions.git",
    "name": "cdklabs.cdk-verified-permissions",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Amazon Web Services<aws-cdk-dev@amazon.com>",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/83/03/62fe0d0bdc8094e5861616a279b06d14b5308b14762829650ee2a9233394/cdklabs_cdk_verified_permissions-0.1.4.tar.gz",
    "platform": null,
    "description": "# Amazon Verified Permissions L2 CDK Construct\n\nThis repo contains the implementation of an L2 CDK Construct for Amazon Verified Permissions\n\n# Project Stability\n\nThis construct is still versioned with alpha/v0 major version and we could introduce breaking changes even without a major version bump. Our goal is to keep the API stable & backwards compatible as much as possible but we currently cannot guarantee that. Once we'll publish v1.0.0 the breaking changes will be introduced via major version bumps.\n\n# Getting Started\n\n## Policy Store\n\nDefine a Policy Store with defaults (No description, No schema & Validation Settings Mode set to OFF):\n\n```python\ntest = PolicyStore(scope, \"PolicyStore\")\n```\n\nDefine a Policy Store without Schema definition (Validation Settings Mode must be set to OFF):\n\n```python\nvalidation_settings_off = {\n    \"mode\": ValidationSettingsMode.OFF\n}\ntest = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_off\n)\n```\n\nDefine a Policy Store with Description and Schema definition (a STRICT Validation Settings Mode is strongly suggested for Policy Stores with schemas):\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = {\n    \"PhotoApp\": {\n        \"entity_types\": {\n            \"User\": {},\n            \"Photo\": {}\n        },\n        \"actions\": {\n            \"view_photo\": {\n                \"applies_to\": {\n                    \"principal_types\": [\"User\"],\n                    \"resource_types\": [\"Photo\"]\n                }\n            }\n        }\n    }\n}\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict,\n    description=\"PolicyStore description\"\n)\n```\n\n## Schemas\n\nIf you want to have type safety when defining a schema, you can accomplish this **<ins>only</ins>** in typescript. Simply use the `Schema` type exported by the `@cedar-policy/cedar-wasm`.\n\nYou can also generate simple schemas using the static functions `schemaFromOpenApiSpec` or `schemaFromRestApi` in the PolicyStore construct. This functionality replicates what you can find in the AWS Verified Permissions console.\n\nGenerate a schema from an OpenAPI spec:\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = PolicyStore.schema_from_open_api_spec(\"path/to/swaggerfile.json\", \"UserGroup\")\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict,\n    description=\"Policy store with schema generated from API Gateway\"\n)\n```\n\nGenerate a schema from a RestApi construct:\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = PolicyStore.schema_from_rest_api(\n    RestApi(scope, \"RestApi\"), \"UserGroup\")\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict,\n    description=\"Policy store with schema generated from RestApi construct\"\n)\n```\n\n## Identity Source\n\nDefine Identity Source with Cognito Configuration and required properties:\n\n```python\nuser_pool = UserPool(scope, \"UserPool\") # Creating a new Cognito UserPool\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = {\n    \"PhotoApp\": {\n        \"entity_types\": {\n            \"User\": {},\n            \"Photo\": {}\n        },\n        \"actions\": {\n            \"view_photo\": {\n                \"applies_to\": {\n                    \"principal_types\": [\"User\"],\n                    \"resource_types\": [\"Photo\"]\n                }\n            }\n        }\n    }\n}\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict\n)\nIdentitySource(scope, \"IdentitySource\",\n    configuration=IdentitySourceConfiguration(\n        cognito_user_pool_configuration=CognitoUserPoolConfiguration(\n            user_pool=user_pool\n        )\n    ),\n    policy_store=policy_store\n)\n```\n\nDefine Identity Source with Cognito Configuration and all properties:\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = {\n    \"PhotoApp\": {\n        \"entity_types\": {\n            \"User\": {},\n            \"Photo\": {}\n        },\n        \"actions\": {\n            \"view_photo\": {\n                \"applies_to\": {\n                    \"principal_types\": [\"User\"],\n                    \"resource_types\": [\"Photo\"]\n                }\n            }\n        }\n    }\n}\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict\n)\ncognito_group_entity_type = \"test\"\nuser_pool = UserPool(scope, \"UserPool\") # Creating a new Cognito UserPool\nIdentitySource(scope, \"IdentitySource\",\n    configuration=IdentitySourceConfiguration(\n        cognito_user_pool_configuration=CognitoUserPoolConfiguration(\n            client_ids=[\"&ExampleCogClientId;\"],\n            user_pool=user_pool,\n            group_configuration=CognitoGroupConfiguration(\n                group_entity_type=cognito_group_entity_type\n            )\n        )\n    ),\n    policy_store=policy_store,\n    principal_entity_type=\"PETEXAMPLEabcdefg111111\"\n)\n```\n\nDefine Identity Source with OIDC Configuration and Access Token selection config:\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = {\n    \"PhotoApp\": {\n        \"entity_types\": {\n            \"User\": {},\n            \"Photo\": {}\n        },\n        \"actions\": {\n            \"view_photo\": {\n                \"applies_to\": {\n                    \"principal_types\": [\"User\"],\n                    \"resource_types\": [\"Photo\"]\n                }\n            }\n        }\n    }\n}\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict\n)\nissuer = \"https://iamanidp.com\"\nprincipal_id_claim = \"sub\"\nentity_id_prefix = \"prefix\"\ngroup_claim = \"group\"\ngroup_entity_type = \"GroupType\"\nIdentitySource(scope, \"IdentitySource\",\n    configuration=IdentitySourceConfiguration(\n        open_id_connect_configuration=OpenIdConnectConfiguration(\n            issuer=issuer,\n            entity_id_prefix=entity_id_prefix,\n            group_configuration=OpenIdConnectGroupConfiguration(\n                group_claim=group_claim,\n                group_entity_type=group_entity_type\n            ),\n            access_token_only=OpenIdConnectAccessTokenConfiguration(\n                audiences=[\"testAudience\"],\n                principal_id_claim=principal_id_claim\n            )\n        )\n    ),\n    policy_store=policy_store,\n    principal_entity_type=\"TestType\"\n)\n```\n\nDefine Identity Source with OIDC Configuration and Identity Token selection config:\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\ncedar_json_schema = {\n    \"PhotoApp\": {\n        \"entity_types\": {\n            \"User\": {},\n            \"Photo\": {}\n        },\n        \"actions\": {\n            \"view_photo\": {\n                \"applies_to\": {\n                    \"principal_types\": [\"User\"],\n                    \"resource_types\": [\"Photo\"]\n                }\n            }\n        }\n    }\n}\ncedar_schema = {\n    \"cedar_json\": JSON.stringify(cedar_json_schema)\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    schema=cedar_schema,\n    validation_settings=validation_settings_strict\n)\nissuer = \"https://iamanidp.com\"\nentity_id_prefix = \"prefix\"\ngroup_claim = \"group\"\ngroup_entity_type = \"UserGroup\"\nprincipal_id_claim = \"sub\"\nIdentitySource(scope, \"IdentitySource\",\n    configuration=IdentitySourceConfiguration(\n        open_id_connect_configuration=OpenIdConnectConfiguration(\n            issuer=issuer,\n            entity_id_prefix=entity_id_prefix,\n            group_configuration=OpenIdConnectGroupConfiguration(\n                group_claim=group_claim,\n                group_entity_type=group_entity_type\n            ),\n            identity_token_only=OpenIdConnectIdentityTokenConfiguration(\n                client_ids=[],\n                principal_id_claim=principal_id_claim\n            )\n        )\n    ),\n    policy_store=policy_store\n)\n```\n\n## Policy\n\nLoad all the `.cedar` files in a given folder and define Policy objects for each of them. All policies will be associated with the same policy store.\n\n```python\nvalidation_settings_strict = {\n    \"mode\": ValidationSettingsMode.STRICT\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_strict\n)\npolicy_store.add_policies_from_path(\"/path/to/my-policies\")\n```\n\nDefine a Policy and add it to a specific Policy Store:\n\n```python\nstatement = \"\"\"permit(\n    principal,\n    action in [MyFirstApp::Action::\"Read\"],\n    resource\n) when {\n    true\n};\"\"\"\n\ndescription = \"Test policy assigned to the test store\"\nvalidation_settings_off = {\n    \"mode\": ValidationSettingsMode.OFF\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_off\n)\n\n# Create a policy and add it to the policy store\npolicy = Policy(scope, \"MyTestPolicy\",\n    definition=PolicyDefinitionProperty(\n        static=StaticPolicyDefinitionProperty(\n            statement=statement,\n            description=description\n        )\n    ),\n    policy_store=policy_store\n)\n```\n\nDefine a policy with a template linked definition:\n\n```python\nvalidation_settings_off = {\n    \"mode\": ValidationSettingsMode.OFF\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_off\n)\npolicy_template_statement = \"\"\"\npermit (\n  principal == ?principal,\n  action in [TinyTodo::Action::\"ReadList\", TinyTodo::Action::\"ListTasks\"],\n  resource == ?resource\n);\"\"\"\ntemplate = PolicyTemplate(scope, \"PolicyTemplate\",\n    statement=policy_template_statement,\n    policy_store=policy_store\n)\n\npolicy = Policy(scope, \"MyTestPolicy\",\n    definition=PolicyDefinitionProperty(\n        template_linked=TemplateLinkedPolicyDefinitionProperty(\n            policy_template=template,\n            principal=EntityIdentifierProperty(\n                entity_id=\"exampleId\",\n                entity_type=\"exampleType\"\n            ),\n            resource=EntityIdentifierProperty(\n                entity_id=\"exampleId\",\n                entity_type=\"exampleType\"\n            )\n        )\n    ),\n    policy_store=policy_store\n)\n```\n\nDefine a Policy with a statement from file:\n**PLEASE NOTE:** You can specify the description of the policy directly inside the Policy file, using the annotation `@cdkDescription`\n\n```python\ndescription = \"Test policy assigned to the test store\"\nvalidation_settings_off = {\n    \"mode\": ValidationSettingsMode.OFF\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_off\n)\n\n# Create a policy and add it to the policy store\npolicy_from_file_props = {\n    \"policy_store\": policy_store,\n    \"path\": \"/path/to/policy-statement.cedar\",\n    \"description\": \"the policy description\"\n}\npolicy = Policy.from_file(scope, \"MyTestPolicy\", policy_from_file_props)\n```\n\n## Policy Template\n\nDefine a Policy Template referring to a Cedar Statement in local file:\n\n```python\nvalidation_settings_off = {\n    \"mode\": ValidationSettingsMode.OFF\n}\npolicy_store = PolicyStore(scope, \"PolicyStore\",\n    validation_settings=validation_settings_off\n)\ntemplate_from_file_props = {\n    \"policy_store\": policy_store,\n    \"path\": \"/path/to/template-statement.cedar\",\n    \"description\": \"Allows sharing photos in full access mode\"\n}\ntemplate = PolicyTemplate.from_file(scope, \"PolicyTemplate\", template_from_file_props)\n```\n\n# Notes\n\n* This project is following the AWS CDK Official Design Guidelines (see https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) and the AWS CDK New Constructs Creation Guide (see here https://github.com/aws/aws-cdk/blob/main/docs/NEW_CONSTRUCTS_GUIDE.md).\n* Feedback is a gift: if you find something wrong or you've ideas to improve please open an issue or a pull request\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "L2 AWS CDK Constructs for Amazon Verified Permissions",
    "version": "0.1.4",
    "project_urls": {
        "Homepage": "https://github.com/cdklabs/cdk-verified-permissions.git",
        "Source": "https://github.com/cdklabs/cdk-verified-permissions.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "667c7e247ff481820d0df01887108c83e23077963bb4c6e8ca37d3d5cdfaae2e",
                "md5": "10e64cda1cb246643f3d52b7bb765737",
                "sha256": "2fc9fc7d6e1a851fa4f7735a642bdf7f0eaddfca7250ff2525ef944ca7035e8a"
            },
            "downloads": -1,
            "filename": "cdklabs.cdk_verified_permissions-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "10e64cda1cb246643f3d52b7bb765737",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 3940923,
            "upload_time": "2024-10-11T10:48:15",
            "upload_time_iso_8601": "2024-10-11T10:48:15.184183Z",
            "url": "https://files.pythonhosted.org/packages/66/7c/7e247ff481820d0df01887108c83e23077963bb4c6e8ca37d3d5cdfaae2e/cdklabs.cdk_verified_permissions-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "830362fe0d0bdc8094e5861616a279b06d14b5308b14762829650ee2a9233394",
                "md5": "dd985836903c1fbf24f024c2cdd90a4f",
                "sha256": "d4bc0af58e861d763759e718aed059e69fd13d073b0463e431b147285304ebc6"
            },
            "downloads": -1,
            "filename": "cdklabs_cdk_verified_permissions-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "dd985836903c1fbf24f024c2cdd90a4f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 3941862,
            "upload_time": "2024-10-11T10:48:17",
            "upload_time_iso_8601": "2024-10-11T10:48:17.673234Z",
            "url": "https://files.pythonhosted.org/packages/83/03/62fe0d0bdc8094e5861616a279b06d14b5308b14762829650ee2a9233394/cdklabs_cdk_verified_permissions-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 10:48:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cdklabs",
    "github_project": "cdk-verified-permissions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cdklabs.cdk-verified-permissions"
}
        
Elapsed time: 0.86710s