Skip to content

Commit fa8c029

Browse files
author
awstools
committed
feat(client-ec2): Adds complete AMI ancestry tracing from immediate parent through each preceding generation back to the root AMI
1 parent 46928a7 commit fa8c029

File tree

10 files changed

+491
-90
lines changed

10 files changed

+491
-90
lines changed

clients/client-ec2/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4317,6 +4317,14 @@ GetHostReservationPurchasePreview
43174317

43184318
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/GetHostReservationPurchasePreviewCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/GetHostReservationPurchasePreviewCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/GetHostReservationPurchasePreviewCommandOutput/)
43194319

4320+
</details>
4321+
<details>
4322+
<summary>
4323+
GetImageAncestry
4324+
</summary>
4325+
4326+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/GetImageAncestryCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/GetImageAncestryCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/GetImageAncestryCommandOutput/)
4327+
43204328
</details>
43214329
<details>
43224330
<summary>

clients/client-ec2/src/EC2.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,11 @@ import {
25162516
GetHostReservationPurchasePreviewCommandInput,
25172517
GetHostReservationPurchasePreviewCommandOutput,
25182518
} from "./commands/GetHostReservationPurchasePreviewCommand";
2519+
import {
2520+
GetImageAncestryCommand,
2521+
GetImageAncestryCommandInput,
2522+
GetImageAncestryCommandOutput,
2523+
} from "./commands/GetImageAncestryCommand";
25192524
import {
25202525
GetImageBlockPublicAccessStateCommand,
25212526
GetImageBlockPublicAccessStateCommandInput,
@@ -4027,6 +4032,7 @@ const commands = {
40274032
GetFlowLogsIntegrationTemplateCommand,
40284033
GetGroupsForCapacityReservationCommand,
40294034
GetHostReservationPurchasePreviewCommand,
4035+
GetImageAncestryCommand,
40304036
GetImageBlockPublicAccessStateCommand,
40314037
GetInstanceMetadataDefaultsCommand,
40324038
GetInstanceTpmEkPubCommand,
@@ -12910,6 +12916,23 @@ export interface EC2 {
1291012916
cb: (err: any, data?: GetHostReservationPurchasePreviewCommandOutput) => void
1291112917
): void;
1291212918

12919+
/**
12920+
* @see {@link GetImageAncestryCommand}
12921+
*/
12922+
getImageAncestry(
12923+
args: GetImageAncestryCommandInput,
12924+
options?: __HttpHandlerOptions
12925+
): Promise<GetImageAncestryCommandOutput>;
12926+
getImageAncestry(
12927+
args: GetImageAncestryCommandInput,
12928+
cb: (err: any, data?: GetImageAncestryCommandOutput) => void
12929+
): void;
12930+
getImageAncestry(
12931+
args: GetImageAncestryCommandInput,
12932+
options: __HttpHandlerOptions,
12933+
cb: (err: any, data?: GetImageAncestryCommandOutput) => void
12934+
): void;
12935+
1291312936
/**
1291412937
* @see {@link GetImageBlockPublicAccessStateCommand}
1291512938
*/

clients/client-ec2/src/EC2Client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,7 @@ import {
18281828
GetHostReservationPurchasePreviewCommandInput,
18291829
GetHostReservationPurchasePreviewCommandOutput,
18301830
} from "./commands/GetHostReservationPurchasePreviewCommand";
1831+
import { GetImageAncestryCommandInput, GetImageAncestryCommandOutput } from "./commands/GetImageAncestryCommand";
18311832
import {
18321833
GetImageBlockPublicAccessStateCommandInput,
18331834
GetImageBlockPublicAccessStateCommandOutput,
@@ -3054,6 +3055,7 @@ export type ServiceInputTypes =
30543055
| GetFlowLogsIntegrationTemplateCommandInput
30553056
| GetGroupsForCapacityReservationCommandInput
30563057
| GetHostReservationPurchasePreviewCommandInput
3058+
| GetImageAncestryCommandInput
30573059
| GetImageBlockPublicAccessStateCommandInput
30583060
| GetInstanceMetadataDefaultsCommandInput
30593061
| GetInstanceTpmEkPubCommandInput
@@ -3775,6 +3777,7 @@ export type ServiceOutputTypes =
37753777
| GetFlowLogsIntegrationTemplateCommandOutput
37763778
| GetGroupsForCapacityReservationCommandOutput
37773779
| GetHostReservationPurchasePreviewCommandOutput
3780+
| GetImageAncestryCommandOutput
37783781
| GetImageBlockPublicAccessStateCommandOutput
37793782
| GetInstanceMetadataDefaultsCommandOutput
37803783
| GetInstanceTpmEkPubCommandOutput
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { Command as $Command } from "@smithy/smithy-client";
4+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
5+
6+
import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { GetImageAncestryRequest, GetImageAncestryResult } from "../models/models_7";
9+
import { GetImageAncestry } from "../schemas/schemas_0";
10+
11+
/**
12+
* @public
13+
*/
14+
export type { __MetadataBearer };
15+
export { $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link GetImageAncestryCommand}.
20+
*/
21+
export interface GetImageAncestryCommandInput extends GetImageAncestryRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link GetImageAncestryCommand}.
26+
*/
27+
export interface GetImageAncestryCommandOutput extends GetImageAncestryResult, __MetadataBearer {}
28+
29+
/**
30+
* <p>Retrieves the ancestry chain of the specified AMI, tracing its lineage back to the root
31+
* AMI. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-ancestry.html">AMI ancestry</a> in
32+
* <i>Amazon EC2 User Guide</i>.</p>
33+
* @example
34+
* Use a bare-bones client and the command you need to make an API call.
35+
* ```javascript
36+
* import { EC2Client, GetImageAncestryCommand } from "@aws-sdk/client-ec2"; // ES Modules import
37+
* // const { EC2Client, GetImageAncestryCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
38+
* // import type { EC2ClientConfig } from "@aws-sdk/client-ec2";
39+
* const config = {}; // type is EC2ClientConfig
40+
* const client = new EC2Client(config);
41+
* const input = { // GetImageAncestryRequest
42+
* ImageId: "STRING_VALUE", // required
43+
* DryRun: true || false,
44+
* };
45+
* const command = new GetImageAncestryCommand(input);
46+
* const response = await client.send(command);
47+
* // { // GetImageAncestryResult
48+
* // ImageAncestryEntries: [ // ImageAncestryEntryList
49+
* // { // ImageAncestryEntry
50+
* // CreationDate: new Date("TIMESTAMP"),
51+
* // ImageId: "STRING_VALUE",
52+
* // ImageOwnerAlias: "STRING_VALUE",
53+
* // SourceImageId: "STRING_VALUE",
54+
* // SourceImageRegion: "STRING_VALUE",
55+
* // },
56+
* // ],
57+
* // };
58+
*
59+
* ```
60+
*
61+
* @param GetImageAncestryCommandInput - {@link GetImageAncestryCommandInput}
62+
* @returns {@link GetImageAncestryCommandOutput}
63+
* @see {@link GetImageAncestryCommandInput} for command's `input` shape.
64+
* @see {@link GetImageAncestryCommandOutput} for command's `response` shape.
65+
* @see {@link EC2ClientResolvedConfig | config} for EC2Client's `config` shape.
66+
*
67+
* @throws {@link EC2ServiceException}
68+
* <p>Base exception class for all service exceptions from EC2 service.</p>
69+
*
70+
*
71+
* @public
72+
*/
73+
export class GetImageAncestryCommand extends $Command
74+
.classBuilder<
75+
GetImageAncestryCommandInput,
76+
GetImageAncestryCommandOutput,
77+
EC2ClientResolvedConfig,
78+
ServiceInputTypes,
79+
ServiceOutputTypes
80+
>()
81+
.ep(commonParams)
82+
.m(function (this: any, Command: any, cs: any, config: EC2ClientResolvedConfig, o: any) {
83+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
84+
})
85+
.s("AmazonEC2", "GetImageAncestry", {})
86+
.n("EC2Client", "GetImageAncestryCommand")
87+
.sc(GetImageAncestry)
88+
.build() {
89+
/** @internal type navigation helper, not in runtime. */
90+
protected declare static __types: {
91+
api: {
92+
input: GetImageAncestryRequest;
93+
output: GetImageAncestryResult;
94+
};
95+
sdk: {
96+
input: GetImageAncestryCommandInput;
97+
output: GetImageAncestryCommandOutput;
98+
};
99+
};
100+
}

clients/client-ec2/src/commands/ModifyTransitGatewayPrefixListReferenceCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { commonParams } from "../endpoint/EndpointParameters";
88
import {
99
ModifyTransitGatewayPrefixListReferenceRequest,
1010
ModifyTransitGatewayPrefixListReferenceResult,
11-
} from "../models/models_7";
11+
} from "../models/models_8";
1212
import { ModifyTransitGatewayPrefixListReference } from "../schemas/schemas_0";
1313

1414
/**

clients/client-ec2/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ export * from "./GetEbsEncryptionByDefaultCommand";
513513
export * from "./GetFlowLogsIntegrationTemplateCommand";
514514
export * from "./GetGroupsForCapacityReservationCommand";
515515
export * from "./GetHostReservationPurchasePreviewCommand";
516+
export * from "./GetImageAncestryCommand";
516517
export * from "./GetImageBlockPublicAccessStateCommand";
517518
export * from "./GetInstanceMetadataDefaultsCommand";
518519
export * from "./GetInstanceTpmEkPubCommand";

clients/client-ec2/src/models/models_7.ts

Lines changed: 69 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
AddPrefixListEntry,
77
AddressAttribute,
88
Affinity,
9-
ApplianceModeSupportValue,
109
AutoPlacement,
1110
CurrencyCodeValues,
1211
DnsSupportValue,
@@ -15,7 +14,6 @@ import {
1514
HostRecovery,
1615
InstanceEventWindow,
1716
IpamPoolAllocation,
18-
Ipv6SupportValue,
1917
RouteServerAssociation,
2018
SecurityGroupReferencingSupportValue,
2119
SubnetAssociation,
@@ -359,6 +357,75 @@ export interface GetHostReservationPurchasePreviewResult {
359357
TotalUpfrontPrice?: string | undefined;
360358
}
361359

360+
/**
361+
* @public
362+
*/
363+
export interface GetImageAncestryRequest {
364+
/**
365+
* <p>The ID of the AMI whose ancestry you want to trace.</p>
366+
* @public
367+
*/
368+
ImageId: string | undefined;
369+
370+
/**
371+
* <p>Checks whether you have the required permissions for the action, without actually making the request,
372+
* and provides an error response. If you have the required permissions, the error response is
373+
* <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
374+
* @public
375+
*/
376+
DryRun?: boolean | undefined;
377+
}
378+
379+
/**
380+
* <p>Information about a single AMI in the ancestry chain and its source (parent) AMI.</p>
381+
* @public
382+
*/
383+
export interface ImageAncestryEntry {
384+
/**
385+
* <p>The date and time when this AMI was created.</p>
386+
* @public
387+
*/
388+
CreationDate?: Date | undefined;
389+
390+
/**
391+
* <p>The ID of this AMI.</p>
392+
* @public
393+
*/
394+
ImageId?: string | undefined;
395+
396+
/**
397+
* <p>The owner alias (<code>amazon</code> | <code>aws-backup-vault</code> |
398+
* <code>aws-marketplace</code> ) of this AMI, if one is assigned. Otherwise, the value is
399+
* <code>null</code>.</p>
400+
* @public
401+
*/
402+
ImageOwnerAlias?: string | undefined;
403+
404+
/**
405+
* <p>The ID of the parent AMI.</p>
406+
* @public
407+
*/
408+
SourceImageId?: string | undefined;
409+
410+
/**
411+
* <p>The Amazon Web Services Region of the parent AMI.</p>
412+
* @public
413+
*/
414+
SourceImageRegion?: string | undefined;
415+
}
416+
417+
/**
418+
* @public
419+
*/
420+
export interface GetImageAncestryResult {
421+
/**
422+
* <p>A list of entries in the AMI ancestry chain, from the specified AMI to the root
423+
* AMI.</p>
424+
* @public
425+
*/
426+
ImageAncestryEntries?: ImageAncestryEntry[] | undefined;
427+
}
428+
362429
/**
363430
* @public
364431
*/
@@ -9700,85 +9767,3 @@ export interface ModifyTransitGatewayResult {
97009767
*/
97019768
TransitGateway?: TransitGateway | undefined;
97029769
}
9703-
9704-
/**
9705-
* @public
9706-
*/
9707-
export interface ModifyTransitGatewayPrefixListReferenceRequest {
9708-
/**
9709-
* <p>The ID of the transit gateway route table.</p>
9710-
* @public
9711-
*/
9712-
TransitGatewayRouteTableId: string | undefined;
9713-
9714-
/**
9715-
* <p>The ID of the prefix list.</p>
9716-
* @public
9717-
*/
9718-
PrefixListId: string | undefined;
9719-
9720-
/**
9721-
* <p>The ID of the attachment to which traffic is routed.</p>
9722-
* @public
9723-
*/
9724-
TransitGatewayAttachmentId?: string | undefined;
9725-
9726-
/**
9727-
* <p>Indicates whether to drop traffic that matches this route.</p>
9728-
* @public
9729-
*/
9730-
Blackhole?: boolean | undefined;
9731-
9732-
/**
9733-
* <p>Checks whether you have the required permissions for the action, without actually making the request,
9734-
* and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>.
9735-
* Otherwise, it is <code>UnauthorizedOperation</code>.</p>
9736-
* @public
9737-
*/
9738-
DryRun?: boolean | undefined;
9739-
}
9740-
9741-
/**
9742-
* @public
9743-
*/
9744-
export interface ModifyTransitGatewayPrefixListReferenceResult {
9745-
/**
9746-
* <p>Information about the prefix list reference.</p>
9747-
* @public
9748-
*/
9749-
TransitGatewayPrefixListReference?: TransitGatewayPrefixListReference | undefined;
9750-
}
9751-
9752-
/**
9753-
* <p>Describes the options for a VPC attachment.</p>
9754-
* @public
9755-
*/
9756-
export interface ModifyTransitGatewayVpcAttachmentRequestOptions {
9757-
/**
9758-
* <p>Enable or disable DNS support. The default is <code>enable</code>.</p>
9759-
* @public
9760-
*/
9761-
DnsSupport?: DnsSupportValue | undefined;
9762-
9763-
/**
9764-
* <p>Enables you to reference a security group across VPCs attached to a transit gateway to simplify security group management.
9765-
*
9766-
* </p>
9767-
* <p>This option is disabled by default.</p>
9768-
* <p>For more information about security group referencing, see <a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-vpc-attachments.html#vpc-attachment-security">Security group referencing</a> in the <i>Amazon Web Services Transit Gateways Guide</i>.</p>
9769-
* @public
9770-
*/
9771-
SecurityGroupReferencingSupport?: SecurityGroupReferencingSupportValue | undefined;
9772-
9773-
/**
9774-
* <p>Enable or disable IPv6 support. The default is <code>enable</code>.</p>
9775-
* @public
9776-
*/
9777-
Ipv6Support?: Ipv6SupportValue | undefined;
9778-
9779-
/**
9780-
* <p>Enable or disable support for appliance mode. If enabled, a traffic flow between a source and destination uses the same Availability Zone for the VPC attachment for the lifetime of that flow. The default is <code>disable</code>.</p>
9781-
* @public
9782-
*/
9783-
ApplianceModeSupport?: ApplianceModeSupportValue | undefined;
9784-
}

0 commit comments

Comments
 (0)