Skip to content

Commit 2af3aa9

Browse files
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 c7432ce commit 2af3aa9

19 files changed

+453
-2
lines changed

generator/ServiceModels/verifiedpermissions/verifiedpermissions-2021-12-01.api.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"output":{"shape":"DeletePolicyStoreOutput"},
184184
"errors":[
185185
{"shape":"ValidationException"},
186+
{"shape":"InvalidStateException"},
186187
{"shape":"AccessDeniedException"},
187188
{"shape":"ThrottlingException"},
188189
{"shape":"InternalServerException"}
@@ -941,7 +942,8 @@
941942
"idempotencyToken":true
942943
},
943944
"validationSettings":{"shape":"ValidationSettings"},
944-
"description":{"shape":"PolicyStoreDescription"}
945+
"description":{"shape":"PolicyStoreDescription"},
946+
"deletionProtection":{"shape":"DeletionProtection"}
945947
}
946948
},
947949
"CreatePolicyStoreOutput":{
@@ -1064,6 +1066,13 @@
10641066
"members":{
10651067
}
10661068
},
1069+
"DeletionProtection":{
1070+
"type":"string",
1071+
"enum":[
1072+
"ENABLED",
1073+
"DISABLED"
1074+
]
1075+
},
10671076
"DeterminingPolicyItem":{
10681077
"type":"structure",
10691078
"required":["policyId"],
@@ -1248,7 +1257,8 @@
12481257
"validationSettings":{"shape":"ValidationSettings"},
12491258
"createdDate":{"shape":"TimestampFormat"},
12501259
"lastUpdatedDate":{"shape":"TimestampFormat"},
1251-
"description":{"shape":"PolicyStoreDescription"}
1260+
"description":{"shape":"PolicyStoreDescription"},
1261+
"deletionProtection":{"shape":"DeletionProtection"}
12521262
}
12531263
},
12541264
"GetPolicyTemplateInput":{
@@ -1425,6 +1435,14 @@
14251435
"fault":true,
14261436
"retryable":{"throttling":false}
14271437
},
1438+
"InvalidStateException":{
1439+
"type":"structure",
1440+
"required":["message"],
1441+
"members":{
1442+
"message":{"shape":"String"}
1443+
},
1444+
"exception":true
1445+
},
14281446
"IpAddr":{
14291447
"type":"string",
14301448
"max":44,
@@ -2230,6 +2248,7 @@
22302248
"members":{
22312249
"policyStoreId":{"shape":"PolicyStoreId"},
22322250
"validationSettings":{"shape":"ValidationSettings"},
2251+
"deletionProtection":{"shape":"DeletionProtection"},
22332252
"description":{"shape":"PolicyStoreDescription"}
22342253
}
22352254
},

generator/ServiceModels/verifiedpermissions/verifiedpermissions-2021-12-01.docs.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,14 @@
439439
"refs": {
440440
}
441441
},
442+
"DeletionProtection": {
443+
"base": null,
444+
"refs": {
445+
"CreatePolicyStoreInput$deletionProtection": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>The default state is <code>DISABLED</code>.</p>",
446+
"GetPolicyStoreOutput$deletionProtection": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>The default state is <code>DISABLED</code>.</p>",
447+
"UpdatePolicyStoreInput$deletionProtection": "<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>When you call <code>UpdatePolicyStore</code>, this parameter is unchanged unless explicitly included in the call.</p>"
448+
}
449+
},
442450
"DeterminingPolicyItem": {
443451
"base": "<p>Contains information about one of the policies that determined an authorization decision.</p> <p>This data type is used as an element in a response parameter for the <a href=\"https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_IsAuthorized.html\">IsAuthorized</a>, <a href=\"https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_BatchIsAuthorized.html\">BatchIsAuthorized</a>, and <a href=\"https://docs.aws.amazon.com/verifiedpermissions/latest/apireference/API_IsAuthorizedWithToken.html\">IsAuthorizedWithToken</a> operations.</p> <p>Example: <code>\"determiningPolicies\":[{\"policyId\":\"SPEXAMPLEabcdefg111111\"}]</code> </p>",
444452
"refs": {
@@ -687,6 +695,11 @@
687695
"refs": {
688696
}
689697
},
698+
"InvalidStateException": {
699+
"base": "<p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>",
700+
"refs": {
701+
}
702+
},
690703
"IpAddr": {
691704
"base": null,
692705
"refs": {
@@ -1226,6 +1239,7 @@
12261239
"EntityAttributes$key": null,
12271240
"EvaluationErrorItem$errorDescription": "<p>The error description.</p>",
12281241
"InternalServerException$message": null,
1242+
"InvalidStateException$message": null,
12291243
"RecordAttribute$key": null,
12301244
"ResourceConflict$resourceId": "<p>The unique identifier of the resource involved in a conflict.</p>",
12311245
"ResourceNotFoundException$message": null,

generator/ServiceModels/verifiedpermissions/verifiedpermissions-2021-12-01.normal.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
"output":{"shape":"DeletePolicyStoreOutput"},
193193
"errors":[
194194
{"shape":"ValidationException"},
195+
{"shape":"InvalidStateException"},
195196
{"shape":"AccessDeniedException"},
196197
{"shape":"ThrottlingException"},
197198
{"shape":"InternalServerException"}
@@ -1274,6 +1275,10 @@
12741275
"description":{
12751276
"shape":"PolicyStoreDescription",
12761277
"documentation":"<p>Descriptive text that you can provide to help with identification of the current policy store.</p>"
1278+
},
1279+
"deletionProtection":{
1280+
"shape":"DeletionProtection",
1281+
"documentation":"<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>The default state is <code>DISABLED</code>.</p>"
12771282
}
12781283
}
12791284
},
@@ -1452,6 +1457,13 @@
14521457
"members":{
14531458
}
14541459
},
1460+
"DeletionProtection":{
1461+
"type":"string",
1462+
"enum":[
1463+
"ENABLED",
1464+
"DISABLED"
1465+
]
1466+
},
14551467
"DeterminingPolicyItem":{
14561468
"type":"structure",
14571469
"required":["policyId"],
@@ -1757,6 +1769,10 @@
17571769
"description":{
17581770
"shape":"PolicyStoreDescription",
17591771
"documentation":"<p>Descriptive text that you can provide to help with identification of the current policy store.</p>"
1772+
},
1773+
"deletionProtection":{
1774+
"shape":"DeletionProtection",
1775+
"documentation":"<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>The default state is <code>DISABLED</code>.</p>"
17601776
}
17611777
}
17621778
},
@@ -2011,6 +2027,15 @@
20112027
"fault":true,
20122028
"retryable":{"throttling":false}
20132029
},
2030+
"InvalidStateException":{
2031+
"type":"structure",
2032+
"required":["message"],
2033+
"members":{
2034+
"message":{"shape":"String"}
2035+
},
2036+
"documentation":"<p>The policy store can't be deleted because deletion protection is enabled. To delete this policy store, disable deletion protection.</p>",
2037+
"exception":true
2038+
},
20142039
"IpAddr":{
20152040
"type":"string",
20162041
"max":44,
@@ -3395,6 +3420,10 @@
33953420
"shape":"ValidationSettings",
33963421
"documentation":"<p>A structure that defines the validation settings that want to enable for the policy store.</p>"
33973422
},
3423+
"deletionProtection":{
3424+
"shape":"DeletionProtection",
3425+
"documentation":"<p>Specifies whether the policy store can be deleted. If enabled, the policy store can't be deleted.</p> <p>When you call <code>UpdatePolicyStore</code>, this parameter is unchanged unless explicitly included in the call.</p>"
3426+
},
33983427
"description":{
33993428
"shape":"PolicyStoreDescription",
34003429
"documentation":"<p>Descriptive text that you can provide to help with identification of the current policy store.</p>"

sdk/src/Services/VerifiedPermissions/Generated/Model/CreatePolicyStoreRequest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ namespace Amazon.VerifiedPermissions.Model
5050
public partial class CreatePolicyStoreRequest : AmazonVerifiedPermissionsRequest
5151
{
5252
private string _clientToken;
53+
private DeletionProtection _deletionProtection;
5354
private string _description;
5455
private ValidationSettings _validationSettings;
5556

@@ -93,6 +94,29 @@ internal bool IsSetClientToken()
9394
return this._clientToken != null;
9495
}
9596

97+
/// <summary>
98+
/// Gets and sets the property DeletionProtection.
99+
/// <para>
100+
/// Specifies whether the policy store can be deleted. If enabled, the policy store can't
101+
/// be deleted.
102+
/// </para>
103+
///
104+
/// <para>
105+
/// The default state is <c>DISABLED</c>.
106+
/// </para>
107+
/// </summary>
108+
public DeletionProtection DeletionProtection
109+
{
110+
get { return this._deletionProtection; }
111+
set { this._deletionProtection = value; }
112+
}
113+
114+
// Check to see if DeletionProtection property is set
115+
internal bool IsSetDeletionProtection()
116+
{
117+
return this._deletionProtection != null;
118+
}
119+
96120
/// <summary>
97121
/// Gets and sets the property Description.
98122
/// <para>

sdk/src/Services/VerifiedPermissions/Generated/Model/GetPolicyStoreResponse.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public partial class GetPolicyStoreResponse : AmazonWebServiceResponse
3636
{
3737
private string _arn;
3838
private DateTime? _createdDate;
39+
private DeletionProtection _deletionProtection;
3940
private string _description;
4041
private DateTime? _lastUpdatedDate;
4142
private string _policyStoreId;
@@ -79,6 +80,29 @@ internal bool IsSetCreatedDate()
7980
return this._createdDate.HasValue;
8081
}
8182

83+
/// <summary>
84+
/// Gets and sets the property DeletionProtection.
85+
/// <para>
86+
/// Specifies whether the policy store can be deleted. If enabled, the policy store can't
87+
/// be deleted.
88+
/// </para>
89+
///
90+
/// <para>
91+
/// The default state is <c>DISABLED</c>.
92+
/// </para>
93+
/// </summary>
94+
public DeletionProtection DeletionProtection
95+
{
96+
get { return this._deletionProtection; }
97+
set { this._deletionProtection = value; }
98+
}
99+
100+
// Check to see if DeletionProtection property is set
101+
internal bool IsSetDeletionProtection()
102+
{
103+
return this._deletionProtection != null;
104+
}
105+
82106
/// <summary>
83107
/// Gets and sets the property Description.
84108
/// <para>

sdk/src/Services/VerifiedPermissions/Generated/Model/Internal/MarshallTransformations/CreatePolicyStoreRequestMarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public IRequest Marshall(CreatePolicyStoreRequest publicRequest)
8080
context.Writer.WritePropertyName("clientToken");
8181
context.Writer.Write(Guid.NewGuid().ToString());
8282
}
83+
if(publicRequest.IsSetDeletionProtection())
84+
{
85+
context.Writer.WritePropertyName("deletionProtection");
86+
context.Writer.Write(publicRequest.DeletionProtection);
87+
}
88+
8389
if(publicRequest.IsSetDescription())
8490
{
8591
context.Writer.WritePropertyName("description");

sdk/src/Services/VerifiedPermissions/Generated/Model/Internal/MarshallTransformations/DeletePolicyStoreResponseUnmarshaller.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public override AmazonServiceException UnmarshallException(JsonUnmarshallerConte
7878
{
7979
return InternalServerExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
8080
}
81+
if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidStateException"))
82+
{
83+
return InvalidStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);
84+
}
8185
if (errorResponse.Code != null && errorResponse.Code.Equals("ThrottlingException"))
8286
{
8387
return ThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse);

sdk/src/Services/VerifiedPermissions/Generated/Model/Internal/MarshallTransformations/GetPolicyStoreResponseUnmarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext cont
6464
response.CreatedDate = unmarshaller.Unmarshall(context);
6565
continue;
6666
}
67+
if (context.TestExpression("deletionProtection", targetDepth))
68+
{
69+
var unmarshaller = StringUnmarshaller.Instance;
70+
response.DeletionProtection = unmarshaller.Unmarshall(context);
71+
continue;
72+
}
6773
if (context.TestExpression("description", targetDepth))
6874
{
6975
var unmarshaller = StringUnmarshaller.Instance;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
/*
17+
* Do not modify this file. This file is generated from the verifiedpermissions-2021-12-01.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Globalization;
22+
using System.IO;
23+
using System.Net;
24+
using System.Text;
25+
using System.Xml.Serialization;
26+
27+
using Amazon.VerifiedPermissions.Model;
28+
using Amazon.Runtime;
29+
using Amazon.Runtime.Internal;
30+
using Amazon.Runtime.Internal.Transform;
31+
using Amazon.Runtime.Internal.Util;
32+
using ThirdParty.Json.LitJson;
33+
34+
#pragma warning disable CS0612,CS0618
35+
namespace Amazon.VerifiedPermissions.Model.Internal.MarshallTransformations
36+
{
37+
/// <summary>
38+
/// Response Unmarshaller for InvalidStateException Object
39+
/// </summary>
40+
public class InvalidStateExceptionUnmarshaller : IErrorResponseUnmarshaller<InvalidStateException, JsonUnmarshallerContext>
41+
{
42+
/// <summary>
43+
/// Unmarshaller the response from the service to the response class.
44+
/// </summary>
45+
/// <param name="context"></param>
46+
/// <returns></returns>
47+
public InvalidStateException Unmarshall(JsonUnmarshallerContext context)
48+
{
49+
return this.Unmarshall(context, new Amazon.Runtime.Internal.ErrorResponse());
50+
}
51+
52+
/// <summary>
53+
/// Unmarshaller the response from the service to the response class.
54+
/// </summary>
55+
/// <param name="context"></param>
56+
/// <param name="errorResponse"></param>
57+
/// <returns></returns>
58+
public InvalidStateException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
59+
{
60+
context.Read();
61+
62+
InvalidStateException unmarshalledObject = new InvalidStateException(errorResponse.Message, errorResponse.InnerException,
63+
errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
64+
65+
int targetDepth = context.CurrentDepth;
66+
while (context.ReadAtDepth(targetDepth))
67+
{
68+
}
69+
70+
return unmarshalledObject;
71+
}
72+
73+
private static InvalidStateExceptionUnmarshaller _instance = new InvalidStateExceptionUnmarshaller();
74+
75+
/// <summary>
76+
/// Gets the singleton.
77+
/// </summary>
78+
public static InvalidStateExceptionUnmarshaller Instance
79+
{
80+
get
81+
{
82+
return _instance;
83+
}
84+
}
85+
}
86+
}

sdk/src/Services/VerifiedPermissions/Generated/Model/Internal/MarshallTransformations/UpdatePolicyStoreRequestMarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ public IRequest Marshall(UpdatePolicyStoreRequest publicRequest)
6969
writer.Validate = false;
7070
writer.WriteObjectStart();
7171
var context = new JsonMarshallerContext(request, writer);
72+
if(publicRequest.IsSetDeletionProtection())
73+
{
74+
context.Writer.WritePropertyName("deletionProtection");
75+
context.Writer.Write(publicRequest.DeletionProtection);
76+
}
77+
7278
if(publicRequest.IsSetDescription())
7379
{
7480
context.Writer.WritePropertyName("description");

0 commit comments

Comments
 (0)