Skip to content

Commit c8e47f1

Browse files
Enable the option to automatically delete underlying Amazon EBS snapshots when deregistering Amazon Machine Images (AMIs)
1 parent b9209ce commit c8e47f1

31 files changed

+797
-283
lines changed

generator/ServiceModels/ec2/ec2-2016-11-15.api.json

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15786,6 +15786,26 @@
1578615786
}
1578715787
}
1578815788
},
15789+
"DeleteSnapshotResultSet":{
15790+
"type":"list",
15791+
"member":{
15792+
"shape":"DeleteSnapshotReturnCode",
15793+
"locationName":"item"
15794+
}
15795+
},
15796+
"DeleteSnapshotReturnCode":{
15797+
"type":"structure",
15798+
"members":{
15799+
"SnapshotId":{
15800+
"shape":"SnapshotId",
15801+
"locationName":"snapshotId"
15802+
},
15803+
"ReturnCode":{
15804+
"shape":"SnapshotReturnCodes",
15805+
"locationName":"returnCode"
15806+
}
15807+
}
15808+
},
1578915809
"DeleteSpotDatafeedSubscriptionRequest":{
1579015810
"type":"structure",
1579115811
"members":{
@@ -16436,6 +16456,7 @@
1643616456
"required":["ImageId"],
1643716457
"members":{
1643816458
"ImageId":{"shape":"ImageId"},
16459+
"DeleteAssociatedSnapshots":{"shape":"Boolean"},
1643916460
"DryRun":{
1644016461
"shape":"Boolean",
1644116462
"locationName":"dryRun"
@@ -16445,7 +16466,15 @@
1644516466
"DeregisterImageResult":{
1644616467
"type":"structure",
1644716468
"members":{
16448-
}
16469+
"Return":{
16470+
"shape":"Boolean",
16471+
"locationName":"return"
16472+
},
16473+
"DeleteSnapshotResults":{
16474+
"shape":"DeleteSnapshotResultSet",
16475+
"locationName":"deleteSnapshotResultSet"
16476+
}
16477+
}
1644916478
},
1645016479
"DeregisterInstanceEventNotificationAttributesRequest":{
1645116480
"type":"structure",
@@ -46097,6 +46126,16 @@
4609746126
"locationName":"item"
4609846127
}
4609946128
},
46129+
"SnapshotReturnCodes":{
46130+
"type":"string",
46131+
"enum":[
46132+
"success",
46133+
"skipped",
46134+
"missing-permissions",
46135+
"internal-error",
46136+
"client-error"
46137+
]
46138+
},
4610046139
"SnapshotSet":{
4610146140
"type":"list",
4610246141
"member":{

generator/ServiceModels/ec2/ec2-2016-11-15.docs.json

Lines changed: 48 additions & 27 deletions
Large diffs are not rendered by default.

generator/ServiceModels/ec2/ec2-2016-11-15.normal.json

Lines changed: 75 additions & 28 deletions
Large diffs are not rendered by default.

sdk/src/Services/EC2/Generated/Model/CancelImageLaunchPermissionRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ namespace Amazon.EC2.Model
3232
/// <summary>
3333
/// Container for the parameters to the CancelImageLaunchPermission operation.
3434
/// Removes your Amazon Web Services account from the launch permissions for the specified
35-
/// AMI. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cancel-sharing-an-AMI.html">
36-
/// Cancel having an AMI shared with your Amazon Web Services account</a> in the <i>Amazon
37-
/// EC2 User Guide</i>.
35+
/// AMI. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cancel-sharing-an-AMI.html">Cancel
36+
/// having an AMI shared with your Amazon Web Services account</a> in the <i>Amazon EC2
37+
/// User Guide</i>.
3838
/// </summary>
3939
public partial class CancelImageLaunchPermissionRequest : AmazonEC2Request
4040
{

sdk/src/Services/EC2/Generated/Model/CopyImageRequest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace Amazon.EC2.Model
5151
///
5252
/// <para>
5353
/// For information about the prerequisites when copying an AMI, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html">Copy
54-
/// an AMI</a> in the <i>Amazon EC2 User Guide</i>.
54+
/// an Amazon EC2 AMI</a> in the <i>Amazon EC2 User Guide</i>.
5555
/// </para>
5656
/// </summary>
5757
public partial class CopyImageRequest : AmazonEC2Request
@@ -74,7 +74,7 @@ public partial class CopyImageRequest : AmazonEC2Request
7474
/// <para>
7575
/// Unique, case-sensitive identifier you provide to ensure idempotency of the request.
7676
/// For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring
77-
/// idempotency</a> in the <i>Amazon EC2 API Reference</i>.
77+
/// idempotency in Amazon EC2 API requests</a> in the <i>Amazon EC2 API Reference</i>.
7878
/// </para>
7979
/// </summary>
8080
public string ClientToken
@@ -302,8 +302,8 @@ internal bool IsSetName()
302302
/// </para>
303303
///
304304
/// <para>
305-
/// For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html">
306-
/// Time-based copies</a>.
305+
/// For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.html">Time-based
306+
/// copies for Amazon EBS snapshots and EBS-backed AMIs</a>.
307307
/// </para>
308308
/// </summary>
309309
public long? SnapshotCopyCompletionDurationMinutes

sdk/src/Services/EC2/Generated/Model/CreateImageRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace Amazon.EC2.Model
4444
///
4545
/// <para>
4646
/// For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html">Create
47-
/// an Amazon EBS-backed Linux AMI</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
47+
/// an Amazon EBS-backed AMI</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.
4848
/// </para>
4949
/// </summary>
5050
public partial class CreateImageRequest : AmazonEC2Request

sdk/src/Services/EC2/Generated/Model/CreateRestoreImageTaskRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ namespace Amazon.EC2.Model
3737
///
3838
/// <para>
3939
/// To use this API, you must have the required permissions. For more information, see
40-
/// <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-store-restore.html#ami-s3-permissions">Permissions
41-
/// for storing and restoring AMIs using Amazon S3</a> in the <i>Amazon EC2 User Guide</i>.
40+
/// <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-ami-store-restore.html#ami-s3-permissions">Permissions
41+
/// for storing and restoring AMIs using S3</a> in the <i>Amazon EC2 User Guide</i>.
4242
/// </para>
4343
///
4444
/// <para>
4545
/// For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-store-restore.html">Store
46-
/// and restore an AMI using Amazon S3</a> in the <i>Amazon EC2 User Guide</i>.
46+
/// and restore an AMI using S3</a> in the <i>Amazon EC2 User Guide</i>.
4747
/// </para>
4848
/// </summary>
4949
public partial class CreateRestoreImageTaskRequest : AmazonEC2Request

sdk/src/Services/EC2/Generated/Model/CreateStoreImageTaskRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ namespace Amazon.EC2.Model
3636
///
3737
/// <para>
3838
/// To use this API, you must have the required permissions. For more information, see
39-
/// <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-store-restore.html#ami-s3-permissions">Permissions
40-
/// for storing and restoring AMIs using Amazon S3</a> in the <i>Amazon EC2 User Guide</i>.
39+
/// <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-ami-store-restore.html#ami-s3-permissions">Permissions
40+
/// for storing and restoring AMIs using S3</a> in the <i>Amazon EC2 User Guide</i>.
4141
/// </para>
4242
///
4343
/// <para>
4444
/// For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-store-restore.html">Store
45-
/// and restore an AMI using Amazon S3</a> in the <i>Amazon EC2 User Guide</i>.
45+
/// and restore an AMI using S3</a> in the <i>Amazon EC2 User Guide</i>.
4646
/// </para>
4747
/// </summary>
4848
public partial class CreateStoreImageTaskRequest : AmazonEC2Request
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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 ec2-2016-11-15.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Xml.Serialization;
22+
using System.Text;
23+
using System.IO;
24+
using System.Net;
25+
26+
using Amazon.Runtime;
27+
using Amazon.Runtime.Internal;
28+
29+
#pragma warning disable CS0612,CS0618,CS1570
30+
namespace Amazon.EC2.Model
31+
{
32+
/// <summary>
33+
/// The snapshot ID and its deletion result code.
34+
/// </summary>
35+
public partial class DeleteSnapshotReturnCode
36+
{
37+
private SnapshotReturnCodes _returnCode;
38+
private string _snapshotId;
39+
40+
/// <summary>
41+
/// Gets and sets the property ReturnCode.
42+
/// <para>
43+
/// The result code from the snapshot deletion attempt. Possible values:
44+
/// </para>
45+
/// <ul> <li>
46+
/// <para>
47+
/// <c>success</c> - The snapshot was successfully deleted.
48+
/// </para>
49+
/// </li> <li>
50+
/// <para>
51+
/// <c>skipped</c> - The snapshot was not deleted because it's associated with other
52+
/// AMIs.
53+
/// </para>
54+
/// </li> <li>
55+
/// <para>
56+
/// <c>missing-permissions</c> - The snapshot was not deleted because the role lacks
57+
/// <c>DeleteSnapshot</c> permissions. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/security_iam_service-with-iam.html">How
58+
/// Amazon EBS works with IAM</a>.
59+
/// </para>
60+
/// </li> <li>
61+
/// <para>
62+
/// <c>internal-error</c> - The snapshot was not deleted due to a server error.
63+
/// </para>
64+
/// </li> <li>
65+
/// <para>
66+
/// <c>client-error</c> - The snapshot was not deleted due to a client configuration
67+
/// error.
68+
/// </para>
69+
/// </li> </ul>
70+
/// <para>
71+
/// For details about an error, check the <c>DeleteSnapshot</c> event in the CloudTrail
72+
/// event history. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/tutorial-event-history.html">View
73+
/// event history</a> in the <i>Amazon Web Services CloudTrail User Guide</i>.
74+
/// </para>
75+
/// </summary>
76+
public SnapshotReturnCodes ReturnCode
77+
{
78+
get { return this._returnCode; }
79+
set { this._returnCode = value; }
80+
}
81+
82+
// Check to see if ReturnCode property is set
83+
internal bool IsSetReturnCode()
84+
{
85+
return this._returnCode != null;
86+
}
87+
88+
/// <summary>
89+
/// Gets and sets the property SnapshotId.
90+
/// <para>
91+
/// The ID of the snapshot.
92+
/// </para>
93+
/// </summary>
94+
public string SnapshotId
95+
{
96+
get { return this._snapshotId; }
97+
set { this._snapshotId = value; }
98+
}
99+
100+
// Check to see if SnapshotId property is set
101+
internal bool IsSetSnapshotId()
102+
{
103+
return this._snapshotId != null;
104+
}
105+
106+
}
107+
}

sdk/src/Services/EC2/Generated/Model/DeregisterImageRequest.cs

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,15 @@ namespace Amazon.EC2.Model
3939
/// the Recycle Bin for the specified retention period. It can be restored before its
4040
/// retention period expires, after which it is permanently deleted. If the deregistered
4141
/// AMI doesn't match a retention rule, it is permanently deleted immediately. For more
42-
/// information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin.html">Recycle
43-
/// Bin</a> in the <i>Amazon EBS User Guide</i>.
42+
/// information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin.html">Recover
43+
/// deleted Amazon EBS snapshots and EBS-backed AMIs with Recycle Bin</a> in the <i>Amazon
44+
/// EBS User Guide</i>.
45+
/// </para>
46+
///
47+
/// <para>
48+
/// When deregistering an EBS-backed AMI, you can optionally delete its associated snapshots
49+
/// at the same time. However, if a snapshot is associated with multiple AMIs, it won't
50+
/// be deleted even if specified for deletion, although the AMI will still be deregistered.
4451
/// </para>
4552
///
4653
/// <para>
@@ -53,8 +60,8 @@ namespace Amazon.EC2.Model
5360
/// </para>
5461
/// </li> <li>
5562
/// <para>
56-
/// For EBS-backed AMIs: The snapshots that were created of the root and data volumes
57-
/// of the instance during AMI creation. You'll continue to incur snapshot storage costs.
63+
/// For EBS-backed AMIs: Snapshots that are associated with multiple AMIs. You'll continue
64+
/// to incur snapshot storage costs.
5865
/// </para>
5966
/// </li> <li>
6067
/// <para>
@@ -69,6 +76,7 @@ namespace Amazon.EC2.Model
6976
/// </summary>
7077
public partial class DeregisterImageRequest : AmazonEC2Request
7178
{
79+
private bool? _deleteAssociatedSnapshots;
7280
private bool? _dryRun;
7381
private string _imageId;
7482

@@ -86,6 +94,33 @@ public DeregisterImageRequest(string imageId)
8694
_imageId = imageId;
8795
}
8896

97+
/// <summary>
98+
/// Gets and sets the property DeleteAssociatedSnapshots.
99+
/// <para>
100+
/// Specifies whether to delete the snapshots associated with the AMI during deregistration.
101+
/// </para>
102+
/// <note>
103+
/// <para>
104+
/// If a snapshot is associated with multiple AMIs, it is not deleted, regardless of this
105+
/// setting.
106+
/// </para>
107+
/// </note>
108+
/// <para>
109+
/// Default: The snapshots are not deleted.
110+
/// </para>
111+
/// </summary>
112+
public bool? DeleteAssociatedSnapshots
113+
{
114+
get { return this._deleteAssociatedSnapshots; }
115+
set { this._deleteAssociatedSnapshots = value; }
116+
}
117+
118+
// Check to see if DeleteAssociatedSnapshots property is set
119+
internal bool IsSetDeleteAssociatedSnapshots()
120+
{
121+
return this._deleteAssociatedSnapshots.HasValue;
122+
}
123+
89124
/// <summary>
90125
/// Gets and sets the property DryRun.
91126
/// <para>

0 commit comments

Comments
 (0)