Skip to content

Commit 3fe5ed9

Browse files
author
awstools
committed
feat(client-verifiedpermissions): Amazon Verified Permissions now supports encryption of resources by a customer managed KMS key. Customers can now create new encrypted policy stores by passing in their customer managed key during policy store creation.
1 parent e0b484f commit 3fe5ed9

7 files changed

Lines changed: 477 additions & 12 deletions

File tree

clients/client-verifiedpermissions/src/commands/CreatePolicyStoreCommand.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ export interface CreatePolicyStoreCommandOutput extends CreatePolicyStoreOutput,
4747
* },
4848
* description: "STRING_VALUE",
4949
* deletionProtection: "ENABLED" || "DISABLED",
50+
* encryptionSettings: { // EncryptionSettings Union: only one key present
51+
* kmsEncryptionSettings: { // KmsEncryptionSettings
52+
* key: "STRING_VALUE", // required
53+
* encryptionContext: { // EncryptionContext
54+
* "<keys>": "STRING_VALUE",
55+
* },
56+
* },
57+
* default: {},
58+
* },
5059
* tags: { // TagMap
5160
* "<keys>": "STRING_VALUE",
5261
* },
@@ -111,6 +120,35 @@ export interface CreatePolicyStoreCommandOutput extends CreatePolicyStoreOutput,
111120
* *\/
112121
* ```
113122
*
123+
* @example To create an encrypted policy store
124+
* ```javascript
125+
* // The following example creates a new policy store with encryption settings based on a provided KMS key.
126+
* const input = {
127+
* clientToken: "a1b2c3d4-e5f6-a1b2-c3d4-TOKEN1111111",
128+
* encryptionSettings: {
129+
* kmsEncryptionSettings: {
130+
* encryptionContext: {
131+
* policy_store_owner: "Tim"
132+
* },
133+
* key: "arn:aws:kms:us-east-1:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456"
134+
* }
135+
* },
136+
* validationSettings: {
137+
* mode: "STRICT"
138+
* }
139+
* };
140+
* const command = new CreatePolicyStoreCommand(input);
141+
* const response = await client.send(command);
142+
* /* response is
143+
* {
144+
* arn: "arn:aws:verifiedpermissions::123456789012:policy-store/C7v5xMplfFH3i3e4Jrzb1a",
145+
* createdDate: "2024-08-12T18:20:50.99Z",
146+
* lastUpdatedDate: "2024-08-12T18:20:50.99Z",
147+
* policyStoreId: "C7v5xMplfFH3i3e4Jrzb1a"
148+
* }
149+
* *\/
150+
* ```
151+
*
114152
* @public
115153
*/
116154
export class CreatePolicyStoreCommand extends $Command

clients/client-verifiedpermissions/src/commands/GetPolicyStoreCommand.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ export interface GetPolicyStoreCommandOutput extends GetPolicyStoreOutput, __Met
5656
* // lastUpdatedDate: new Date("TIMESTAMP"), // required
5757
* // description: "STRING_VALUE",
5858
* // deletionProtection: "ENABLED" || "DISABLED",
59+
* // encryptionState: { // EncryptionState Union: only one key present
60+
* // kmsEncryptionState: { // KmsEncryptionState
61+
* // key: "STRING_VALUE", // required
62+
* // encryptionContext: { // EncryptionContext // required
63+
* // "<keys>": "STRING_VALUE",
64+
* // },
65+
* // },
66+
* // default: {},
67+
* // },
5968
* // cedarVersion: "CEDAR_2" || "CEDAR_4",
6069
* // tags: { // TagMap
6170
* // "<keys>": "STRING_VALUE",
@@ -101,6 +110,38 @@ export interface GetPolicyStoreCommandOutput extends GetPolicyStoreOutput, __Met
101110
* {
102111
* arn: "arn:aws:verifiedpermissions::123456789012:policy-store/C7v5xMplfFH3i3e4Jrzb1a",
103112
* createdDate: "2024-08-12T18:20:50.99Z",
113+
* encryptionState: {
114+
* default: { /* empty *\/ }
115+
* },
116+
* lastUpdatedDate: "2024-08-12T18:20:50.99Z",
117+
* policyStoreId: "C7v5xMplfFH3i3e4Jrzb1a",
118+
* validationSettings: {
119+
* mode: "STRICT"
120+
* }
121+
* }
122+
* *\/
123+
* ```
124+
*
125+
* @example GetPolicyStore that is encrypted
126+
* ```javascript
127+
* // The following example retrieves details about the specified encrypted policy store.
128+
* const input = {
129+
* policyStoreId: "C7v5xMplfFH3i3e4Jrzb1a"
130+
* };
131+
* const command = new GetPolicyStoreCommand(input);
132+
* const response = await client.send(command);
133+
* /* response is
134+
* {
135+
* arn: "arn:aws:verifiedpermissions::123456789012:policy-store/C7v5xMplfFH3i3e4Jrzb1a",
136+
* createdDate: "2024-08-12T18:20:50.99Z",
137+
* encryptionState: {
138+
* kmsEncryptionState: {
139+
* encryptionContext: {
140+
* policy_store_owner: "Tim"
141+
* },
142+
* key: "arn:aws:kms:us-east-1:123456789012:key/abcdefgh-ijkl-mnop-qrst-uvwxyz123456"
143+
* }
144+
* },
104145
* lastUpdatedDate: "2024-08-12T18:20:50.99Z",
105146
* policyStoreId: "C7v5xMplfFH3i3e4Jrzb1a",
106147
* validationSettings: {

clients/client-verifiedpermissions/src/models/models_0.ts

Lines changed: 160 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,82 @@ export interface CreatePolicyOutput {
12451245
effect?: PolicyEffect | undefined;
12461246
}
12471247

1248+
/**
1249+
* @public
1250+
*/
1251+
export interface Unit {}
1252+
1253+
/**
1254+
* <p>A structure that contains the KMS encryption configuration for the policy store. The encryption settings determine what customer-managed KMS key will be used to encrypt all resources within the policy store, and any user-defined context key-value pairs to append during encryption processes.</p> <p>This data type is used as a field that is part of the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_EncryptionSettings.html">EncryptionSettings</a> type.</p>
1255+
* @public
1256+
*/
1257+
export interface KmsEncryptionSettings {
1258+
/**
1259+
* <p>The customer-managed KMS key <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a>, alias or ID to be used for encryption processes. </p> <p>Users can provide the full KMS key ARN, a KMS key alias, or a KMS key ID, but it will be mapped to the full KMS key ARN after policy store creation, and referenced when encrypting child resources. </p>
1260+
* @public
1261+
*/
1262+
key: string | undefined;
1263+
1264+
/**
1265+
* <p>User-defined, additional context to be added to encryption processes. </p>
1266+
* @public
1267+
*/
1268+
encryptionContext?: Record<string, string> | undefined;
1269+
}
1270+
1271+
/**
1272+
* <p>A structure that contains the encryption configuration for the policy store and child resources. </p> <p>This data type is used as a request parameter in the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_CreatePolicyStore.html">CreatePolicyStore</a> operation.</p>
1273+
* @public
1274+
*/
1275+
export type EncryptionSettings =
1276+
| EncryptionSettings.DefaultMember
1277+
| EncryptionSettings.KmsEncryptionSettingsMember
1278+
| EncryptionSettings.$UnknownMember;
1279+
1280+
/**
1281+
* @public
1282+
*/
1283+
export namespace EncryptionSettings {
1284+
/**
1285+
* <p>The KMS encryption settings for this policy store to encrypt data with. It will contain the customer-managed KMS key, and a user-defined encryption context. </p>
1286+
* @public
1287+
*/
1288+
export interface KmsEncryptionSettingsMember {
1289+
kmsEncryptionSettings: KmsEncryptionSettings;
1290+
default?: never;
1291+
$unknown?: never;
1292+
}
1293+
1294+
/**
1295+
* Use AWS owned encryption keys for encrypting policy store data.
1296+
* @public
1297+
*/
1298+
export interface DefaultMember {
1299+
kmsEncryptionSettings?: never;
1300+
default: Unit;
1301+
$unknown?: never;
1302+
}
1303+
1304+
/**
1305+
* @public
1306+
*/
1307+
export interface $UnknownMember {
1308+
kmsEncryptionSettings?: never;
1309+
default?: never;
1310+
$unknown: [string, any];
1311+
}
1312+
1313+
/**
1314+
* @deprecated unused in schema-serde mode.
1315+
*
1316+
*/
1317+
export interface Visitor<T> {
1318+
kmsEncryptionSettings: (value: KmsEncryptionSettings) => T;
1319+
default: (value: Unit) => T;
1320+
_: (name: string, value: any) => T;
1321+
}
1322+
}
1323+
12481324
/**
12491325
* <p>A structure that contains Cedar policy validation settings for the policy store. The validation mode determines which validation failures that Cedar considers serious enough to block acceptance of a new or edited static policy or policy template. </p> <p>This data type is used as a request parameter in the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_CreatePolicyStore.html">CreatePolicyStore</a> and <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_UpdatePolicyStore.html">UpdatePolicyStore</a> operations.</p>
12501326
* @public
@@ -1285,6 +1361,12 @@ export interface CreatePolicyStoreInput {
12851361
*/
12861362
deletionProtection?: DeletionProtection | undefined;
12871363

1364+
/**
1365+
* <p>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.</p> <p>This is an optional field to be used when providing a customer-managed KMS key for encryption.</p>
1366+
* @public
1367+
*/
1368+
encryptionSettings?: EncryptionSettings | undefined;
1369+
12881370
/**
12891371
* <p>The list of key-value pairs to associate with the policy store.</p>
12901372
* @public
@@ -1461,6 +1543,77 @@ export interface DeletePolicyTemplateInput {
14611543
*/
14621544
export interface DeletePolicyTemplateOutput {}
14631545

1546+
/**
1547+
* <p>A structure that contains the KMS encryption configuration for the policy store. The encryption state shows what customer-managed KMS key is being used to encrypt all resources within the policy store, and any user-defined context key-value pairs added during encryption processes.</p> <p>This data type is used as a field that is part of the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_EncryptionState.html">EncryptionState</a> type.</p>
1548+
* @public
1549+
*/
1550+
export interface KmsEncryptionState {
1551+
/**
1552+
* <p>The customer-managed KMS key <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> being used for encryption processes. </p>
1553+
* @public
1554+
*/
1555+
key: string | undefined;
1556+
1557+
/**
1558+
* <p>User-defined, additional context added to encryption processes. </p>
1559+
* @public
1560+
*/
1561+
encryptionContext: Record<string, string> | undefined;
1562+
}
1563+
1564+
/**
1565+
* <p>A structure that contains the encryption configuration for the policy store and child resources.</p> <p>This data type is used as a response parameter field for the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_GetPolicyStore.html">GetPolicyStore</a> operation.</p>
1566+
* @public
1567+
*/
1568+
export type EncryptionState =
1569+
| EncryptionState.DefaultMember
1570+
| EncryptionState.KmsEncryptionStateMember
1571+
| EncryptionState.$UnknownMember;
1572+
1573+
/**
1574+
* @public
1575+
*/
1576+
export namespace EncryptionState {
1577+
/**
1578+
* <p>The KMS encryption settings currently configured for this policy store to encrypt data with. It contains the customer-managed KMS key, and a user-defined encryption context. </p>
1579+
* @public
1580+
*/
1581+
export interface KmsEncryptionStateMember {
1582+
kmsEncryptionState: KmsEncryptionState;
1583+
default?: never;
1584+
$unknown?: never;
1585+
}
1586+
1587+
/**
1588+
* Policy store data is encrypted using AWS owned encryption keys.
1589+
* @public
1590+
*/
1591+
export interface DefaultMember {
1592+
kmsEncryptionState?: never;
1593+
default: Unit;
1594+
$unknown?: never;
1595+
}
1596+
1597+
/**
1598+
* @public
1599+
*/
1600+
export interface $UnknownMember {
1601+
kmsEncryptionState?: never;
1602+
default?: never;
1603+
$unknown: [string, any];
1604+
}
1605+
1606+
/**
1607+
* @deprecated unused in schema-serde mode.
1608+
*
1609+
*/
1610+
export interface Visitor<T> {
1611+
kmsEncryptionState: (value: KmsEncryptionState) => T;
1612+
default: (value: Unit) => T;
1613+
_: (name: string, value: any) => T;
1614+
}
1615+
}
1616+
14641617
/**
14651618
* <p>Contains information about a principal or resource that can be referenced in a Cedar policy.</p> <p>This data type is used as part of the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_PolicyFilter.html">PolicyFilter</a> structure that is used as a request parameter for the <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_ListPolicies.html">ListPolicies</a> operation..</p>
14661619
* @public
@@ -1765,6 +1918,12 @@ export interface GetPolicyStoreOutput {
17651918
*/
17661919
deletionProtection?: DeletionProtection | undefined;
17671920

1921+
/**
1922+
* <p>A structure that contains the encryption configuration for the policy store.</p>
1923+
* @public
1924+
*/
1925+
encryptionState?: EncryptionState | undefined;
1926+
17681927
/**
17691928
* <p>The version of the Cedar language used with policies, policy templates, and schemas in this policy store. For more information, see <a href="https://docs.aws.amazon.com/verifiedpermissions/latest/userguide/cedar4-faq.html">Amazon Verified Permissions upgrade to Cedar v4 FAQ</a>.</p>
17701929
* @public
@@ -2842,7 +3001,7 @@ export interface UpdatePolicyInput {
28423001
* <p>Specifies the updated policy content that you want to replace on the specified policy. The content must be valid Cedar policy language text.</p> <p>You can change only the following elements from the policy definition:</p> <ul> <li> <p>The <code>action</code> referenced by the policy.</p> </li> <li> <p>Any conditional clauses, such as <code>when</code> or <code>unless</code> clauses.</p> </li> </ul> <p>You <b>can't</b> change the following elements:</p> <ul> <li> <p>Changing from <code>static</code> to <code>templateLinked</code>.</p> </li> <li> <p>Changing the effect of the policy from <code>permit</code> or <code>forbid</code>.</p> </li> <li> <p>The <code>principal</code> referenced by the policy.</p> </li> <li> <p>The <code>resource</code> referenced by the policy.</p> </li> </ul>
28433002
* @public
28443003
*/
2845-
definition: UpdatePolicyDefinition | undefined;
3004+
definition?: UpdatePolicyDefinition | undefined;
28463005
}
28473006

28483007
/**

0 commit comments

Comments
 (0)