Skip to content

Commit 21029cc

Browse files
author
awstools
committed
feat(client-verifiedpermissions): Adds deletion protection support to policy stores. Deletion protection is disabled by default, can be enabled via the CreatePolicyStore or UpdatePolicyStore APIs, and is visible in GetPolicyStore.
1 parent 239ccb6 commit 21029cc

File tree

7 files changed

+141
-0
lines changed

7 files changed

+141
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface CreatePolicyStoreCommandOutput extends CreatePolicyStoreOutput,
5959
* mode: "OFF" || "STRICT", // required
6060
* },
6161
* description: "STRING_VALUE",
62+
* deletionProtection: "ENABLED" || "DISABLED",
6263
* };
6364
* const command = new CreatePolicyStoreCommand(input);
6465
* const response = await client.send(command);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export interface DeletePolicyStoreCommandOutput extends DeletePolicyStoreOutput,
5656
* @see {@link DeletePolicyStoreCommandOutput} for command's `response` shape.
5757
* @see {@link VerifiedPermissionsClientResolvedConfig | config} for VerifiedPermissionsClient's `config` shape.
5858
*
59+
* @throws {@link InvalidStateException} (client fault)
60+
* <p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>
61+
*
5962
* @throws {@link AccessDeniedException} (client fault)
6063
* <p>You don't have sufficient access to perform this action.</p>
6164
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface GetPolicyStoreCommandOutput extends GetPolicyStoreOutput, __Met
5353
* // createdDate: new Date("TIMESTAMP"), // required
5454
* // lastUpdatedDate: new Date("TIMESTAMP"), // required
5555
* // description: "STRING_VALUE",
56+
* // deletionProtection: "ENABLED" || "DISABLED",
5657
* // };
5758
*
5859
* ```

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface UpdatePolicyStoreCommandOutput extends UpdatePolicyStoreOutput,
5454
* validationSettings: { // ValidationSettings
5555
* mode: "OFF" || "STRICT", // required
5656
* },
57+
* deletionProtection: "ENABLED" || "DISABLED",
5758
* description: "STRING_VALUE",
5859
* };
5960
* const command = new UpdatePolicyStoreCommand(input);

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

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,20 @@ export interface CreatePolicyOutput {
19581958
effect?: PolicyEffect | undefined;
19591959
}
19601960

1961+
/**
1962+
* @public
1963+
* @enum
1964+
*/
1965+
export const DeletionProtection = {
1966+
DISABLED: "DISABLED",
1967+
ENABLED: "ENABLED",
1968+
} as const;
1969+
1970+
/**
1971+
* @public
1972+
*/
1973+
export type DeletionProtection = (typeof DeletionProtection)[keyof typeof DeletionProtection];
1974+
19611975
/**
19621976
* @public
19631977
* @enum
@@ -2049,6 +2063,13 @@ export interface CreatePolicyStoreInput {
20492063
* @public
20502064
*/
20512065
description?: string | undefined;
2066+
2067+
/**
2068+
* <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
2069+
* <p>The default state is <code>DISABLED</code>.</p>
2070+
* @public
2071+
*/
2072+
deletionProtection?: DeletionProtection | undefined;
20522073
}
20532074

20542075
/**
@@ -2212,6 +2233,26 @@ export interface DeletePolicyStoreInput {
22122233
*/
22132234
export interface DeletePolicyStoreOutput {}
22142235

2236+
/**
2237+
* <p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>
2238+
* @public
2239+
*/
2240+
export class InvalidStateException extends __BaseException {
2241+
readonly name: "InvalidStateException" = "InvalidStateException";
2242+
readonly $fault: "client" = "client";
2243+
/**
2244+
* @internal
2245+
*/
2246+
constructor(opts: __ExceptionOptionType<InvalidStateException, __BaseException>) {
2247+
super({
2248+
name: "InvalidStateException",
2249+
$fault: "client",
2250+
...opts,
2251+
});
2252+
Object.setPrototypeOf(this, InvalidStateException.prototype);
2253+
}
2254+
}
2255+
22152256
/**
22162257
* @public
22172258
*/
@@ -2565,6 +2606,13 @@ export interface GetPolicyStoreOutput {
25652606
* @public
25662607
*/
25672608
description?: string | undefined;
2609+
2610+
/**
2611+
* <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
2612+
* <p>The default state is <code>DISABLED</code>.</p>
2613+
* @public
2614+
*/
2615+
deletionProtection?: DeletionProtection | undefined;
25682616
}
25692617

25702618
/**
@@ -4117,6 +4165,13 @@ export interface UpdatePolicyStoreInput {
41174165
*/
41184166
validationSettings: ValidationSettings | undefined;
41194167

4168+
/**
4169+
* <p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>
4170+
* <p>When you call <code>UpdatePolicyStore</code>, this parameter is unchanged unless explicitly included in the call.</p>
4171+
* @public
4172+
*/
4173+
deletionProtection?: DeletionProtection | undefined;
4174+
41204175
/**
41214176
* <p>Descriptive text that you can provide to help with identification
41224177
* of the current policy store.</p>

clients/client-verifiedpermissions/src/protocols/Aws_json1_0.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ import {
133133
IdentitySourceFilter,
134134
IdentitySourceItem,
135135
InternalServerException,
136+
InvalidStateException,
136137
IsAuthorizedInput,
137138
IsAuthorizedWithTokenInput,
138139
ListIdentitySourcesInput,
@@ -1106,6 +1107,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
11061107
case "ServiceQuotaExceededException":
11071108
case "com.amazonaws.verifiedpermissions#ServiceQuotaExceededException":
11081109
throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
1110+
case "InvalidStateException":
1111+
case "com.amazonaws.verifiedpermissions#InvalidStateException":
1112+
throw await de_InvalidStateExceptionRes(parsedOutput, context);
11091113
default:
11101114
const parsedBody = parsedOutput.body;
11111115
return throwDefaultError({
@@ -1161,6 +1165,22 @@ const de_InternalServerExceptionRes = async (
11611165
return __decorateServiceException(exception, body);
11621166
};
11631167

1168+
/**
1169+
* deserializeAws_json1_0InvalidStateExceptionRes
1170+
*/
1171+
const de_InvalidStateExceptionRes = async (
1172+
parsedOutput: any,
1173+
context: __SerdeContext
1174+
): Promise<InvalidStateException> => {
1175+
const body = parsedOutput.body;
1176+
const deserialized: any = _json(body);
1177+
const exception = new InvalidStateException({
1178+
$metadata: deserializeMetadata(parsedOutput),
1179+
...deserialized,
1180+
});
1181+
return __decorateServiceException(exception, body);
1182+
};
1183+
11641184
/**
11651185
* deserializeAws_json1_0ResourceNotFoundExceptionRes
11661186
*/
@@ -1382,6 +1402,7 @@ const se_CreatePolicyInput = (input: CreatePolicyInput, context: __SerdeContext)
13821402
const se_CreatePolicyStoreInput = (input: CreatePolicyStoreInput, context: __SerdeContext): any => {
13831403
return take(input, {
13841404
clientToken: [true, (_) => _ ?? generateIdempotencyToken()],
1405+
deletionProtection: [],
13851406
description: [],
13861407
validationSettings: _json,
13871408
});
@@ -1928,6 +1949,7 @@ const de_GetPolicyStoreOutput = (output: any, context: __SerdeContext): GetPolic
19281949
return take(output, {
19291950
arn: __expectString,
19301951
createdDate: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
1952+
deletionProtection: __expectString,
19311953
description: __expectString,
19321954
lastUpdatedDate: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)),
19331955
policyStoreId: __expectString,
@@ -1995,6 +2017,8 @@ const de_IdentitySources = (output: any, context: __SerdeContext): IdentitySourc
19952017

19962018
// de_InternalServerException omitted.
19972019

2020+
// de_InvalidStateException omitted.
2021+
19982022
// de_IsAuthorizedOutput omitted.
19992023

20002024
// de_IsAuthorizedWithTokenOutput omitted.

codegen/sdk-codegen/aws-models/verifiedpermissions.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,12 @@
17201720
"traits": {
17211721
"smithy.api#documentation": "<p>Descriptive text that you can provide to help with identification \n of the current policy store.</p>"
17221722
}
1723+
},
1724+
"deletionProtection": {
1725+
"target": "com.amazonaws.verifiedpermissions#DeletionProtection",
1726+
"traits": {
1727+
"smithy.api#documentation": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>\n <p>The default state is <code>DISABLED</code>.</p>"
1728+
}
17231729
}
17241730
},
17251731
"traits": {
@@ -2042,6 +2048,11 @@
20422048
"output": {
20432049
"target": "com.amazonaws.verifiedpermissions#DeletePolicyStoreOutput"
20442050
},
2051+
"errors": [
2052+
{
2053+
"target": "com.amazonaws.verifiedpermissions#InvalidStateException"
2054+
}
2055+
],
20452056
"traits": {
20462057
"aws.iam#iamAction": {
20472058
"documentation": "Grants permission to delete the specified policy store"
@@ -2146,6 +2157,23 @@
21462157
"smithy.api#output": {}
21472158
}
21482159
},
2160+
"com.amazonaws.verifiedpermissions#DeletionProtection": {
2161+
"type": "enum",
2162+
"members": {
2163+
"ENABLED": {
2164+
"target": "smithy.api#Unit",
2165+
"traits": {
2166+
"smithy.api#enumValue": "ENABLED"
2167+
}
2168+
},
2169+
"DISABLED": {
2170+
"target": "smithy.api#Unit",
2171+
"traits": {
2172+
"smithy.api#enumValue": "DISABLED"
2173+
}
2174+
}
2175+
}
2176+
},
21492177
"com.amazonaws.verifiedpermissions#DeterminingPolicyItem": {
21502178
"type": "structure",
21512179
"members": {
@@ -2718,6 +2746,12 @@
27182746
"traits": {
27192747
"smithy.api#documentation": "<p>Descriptive text that you can provide to help with identification \n of the current policy store.</p>"
27202748
}
2749+
},
2750+
"deletionProtection": {
2751+
"target": "com.amazonaws.verifiedpermissions#DeletionProtection",
2752+
"traits": {
2753+
"smithy.api#documentation": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>\n <p>The default state is <code>DISABLED</code>.</p>"
2754+
}
27212755
}
27222756
},
27232757
"traits": {
@@ -3192,6 +3226,22 @@
31923226
"smithy.api#retryable": {}
31933227
}
31943228
},
3229+
"com.amazonaws.verifiedpermissions#InvalidStateException": {
3230+
"type": "structure",
3231+
"members": {
3232+
"message": {
3233+
"target": "smithy.api#String",
3234+
"traits": {
3235+
"smithy.api#required": {}
3236+
}
3237+
}
3238+
},
3239+
"traits": {
3240+
"smithy.api#documentation": "<p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>",
3241+
"smithy.api#error": "client",
3242+
"smithy.api#httpError": 406
3243+
}
3244+
},
31953245
"com.amazonaws.verifiedpermissions#IpAddr": {
31963246
"type": "string",
31973247
"traits": {
@@ -5949,6 +5999,12 @@
59495999
"smithy.api#required": {}
59506000
}
59516001
},
6002+
"deletionProtection": {
6003+
"target": "com.amazonaws.verifiedpermissions#DeletionProtection",
6004+
"traits": {
6005+
"smithy.api#documentation": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p>\n <p>When you call <code>UpdatePolicyStore</code>, this parameter is unchanged unless explicitly included in the call.</p>"
6006+
}
6007+
},
59526008
"description": {
59536009
"target": "com.amazonaws.verifiedpermissions#PolicyStoreDescription",
59546010
"traits": {

0 commit comments

Comments
 (0)