Skip to content

Commit

Permalink
feat(client-ec2): This release adds new capabilities to manage On-Dem…
Browse files Browse the repository at this point in the history
…and Capacity Reservations including the ability to split your reservation, move capacity between reservations, and modify the instance eligibility of your reservation.
  • Loading branch information
awstools committed Aug 12, 2024
1 parent 54703e4 commit 6e0db43
Show file tree
Hide file tree
Showing 24 changed files with 1,751 additions and 771 deletions.
16 changes: 16 additions & 0 deletions clients/client-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,14 @@ CreateCapacityReservation

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/CreateCapacityReservationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/CreateCapacityReservationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/CreateCapacityReservationCommandOutput/)

</details>
<details>
<summary>
CreateCapacityReservationBySplitting
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/CreateCapacityReservationBySplittingCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/CreateCapacityReservationBySplittingCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/CreateCapacityReservationBySplittingCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -4669,6 +4677,14 @@ MoveByoipCidrToIpam

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/MoveByoipCidrToIpamCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/MoveByoipCidrToIpamCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/MoveByoipCidrToIpamCommandOutput/)

</details>
<details>
<summary>
MoveCapacityReservationInstances
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2/command/MoveCapacityReservationInstancesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/MoveCapacityReservationInstancesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2/Interface/MoveCapacityReservationInstancesCommandOutput/)

</details>
<details>
<summary>
Expand Down
46 changes: 46 additions & 0 deletions clients/client-ec2/src/EC2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ import {
CopySnapshotCommandInput,
CopySnapshotCommandOutput,
} from "./commands/CopySnapshotCommand";
import {
CreateCapacityReservationBySplittingCommand,
CreateCapacityReservationBySplittingCommandInput,
CreateCapacityReservationBySplittingCommandOutput,
} from "./commands/CreateCapacityReservationBySplittingCommand";
import {
CreateCapacityReservationCommand,
CreateCapacityReservationCommandInput,
Expand Down Expand Up @@ -2724,6 +2729,11 @@ import {
MoveByoipCidrToIpamCommandInput,
MoveByoipCidrToIpamCommandOutput,
} from "./commands/MoveByoipCidrToIpamCommand";
import {
MoveCapacityReservationInstancesCommand,
MoveCapacityReservationInstancesCommandInput,
MoveCapacityReservationInstancesCommandOutput,
} from "./commands/MoveCapacityReservationInstancesCommand";
import {
ProvisionByoipCidrCommand,
ProvisionByoipCidrCommandInput,
Expand Down Expand Up @@ -3118,6 +3128,7 @@ const commands = {
CopyImageCommand,
CopySnapshotCommand,
CreateCapacityReservationCommand,
CreateCapacityReservationBySplittingCommand,
CreateCapacityReservationFleetCommand,
CreateCarrierGatewayCommand,
CreateClientVpnEndpointCommand,
Expand Down Expand Up @@ -3620,6 +3631,7 @@ const commands = {
MonitorInstancesCommand,
MoveAddressToVpcCommand,
MoveByoipCidrToIpamCommand,
MoveCapacityReservationInstancesCommand,
ProvisionByoipCidrCommand,
ProvisionIpamByoasnCommand,
ProvisionIpamPoolCidrCommand,
Expand Down Expand Up @@ -4611,6 +4623,23 @@ export interface EC2 {
cb: (err: any, data?: CreateCapacityReservationCommandOutput) => void
): void;

/**
* @see {@link CreateCapacityReservationBySplittingCommand}
*/
createCapacityReservationBySplitting(
args: CreateCapacityReservationBySplittingCommandInput,
options?: __HttpHandlerOptions
): Promise<CreateCapacityReservationBySplittingCommandOutput>;
createCapacityReservationBySplitting(
args: CreateCapacityReservationBySplittingCommandInput,
cb: (err: any, data?: CreateCapacityReservationBySplittingCommandOutput) => void
): void;
createCapacityReservationBySplitting(
args: CreateCapacityReservationBySplittingCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: CreateCapacityReservationBySplittingCommandOutput) => void
): void;

/**
* @see {@link CreateCapacityReservationFleetCommand}
*/
Expand Down Expand Up @@ -13038,6 +13067,23 @@ export interface EC2 {
cb: (err: any, data?: MoveByoipCidrToIpamCommandOutput) => void
): void;

/**
* @see {@link MoveCapacityReservationInstancesCommand}
*/
moveCapacityReservationInstances(
args: MoveCapacityReservationInstancesCommandInput,
options?: __HttpHandlerOptions
): Promise<MoveCapacityReservationInstancesCommandOutput>;
moveCapacityReservationInstances(
args: MoveCapacityReservationInstancesCommandInput,
cb: (err: any, data?: MoveCapacityReservationInstancesCommandOutput) => void
): void;
moveCapacityReservationInstances(
args: MoveCapacityReservationInstancesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: MoveCapacityReservationInstancesCommandOutput) => void
): void;

/**
* @see {@link ProvisionByoipCidrCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-ec2/src/EC2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ import {
import { CopyFpgaImageCommandInput, CopyFpgaImageCommandOutput } from "./commands/CopyFpgaImageCommand";
import { CopyImageCommandInput, CopyImageCommandOutput } from "./commands/CopyImageCommand";
import { CopySnapshotCommandInput, CopySnapshotCommandOutput } from "./commands/CopySnapshotCommand";
import {
CreateCapacityReservationBySplittingCommandInput,
CreateCapacityReservationBySplittingCommandOutput,
} from "./commands/CreateCapacityReservationBySplittingCommand";
import {
CreateCapacityReservationCommandInput,
CreateCapacityReservationCommandOutput,
Expand Down Expand Up @@ -1946,6 +1950,10 @@ import {
MoveByoipCidrToIpamCommandInput,
MoveByoipCidrToIpamCommandOutput,
} from "./commands/MoveByoipCidrToIpamCommand";
import {
MoveCapacityReservationInstancesCommandInput,
MoveCapacityReservationInstancesCommandOutput,
} from "./commands/MoveCapacityReservationInstancesCommand";
import { ProvisionByoipCidrCommandInput, ProvisionByoipCidrCommandOutput } from "./commands/ProvisionByoipCidrCommand";
import {
ProvisionIpamByoasnCommandInput,
Expand Down Expand Up @@ -2239,6 +2247,7 @@ export type ServiceInputTypes =
| CopyFpgaImageCommandInput
| CopyImageCommandInput
| CopySnapshotCommandInput
| CreateCapacityReservationBySplittingCommandInput
| CreateCapacityReservationCommandInput
| CreateCapacityReservationFleetCommandInput
| CreateCarrierGatewayCommandInput
Expand Down Expand Up @@ -2742,6 +2751,7 @@ export type ServiceInputTypes =
| MonitorInstancesCommandInput
| MoveAddressToVpcCommandInput
| MoveByoipCidrToIpamCommandInput
| MoveCapacityReservationInstancesCommandInput
| ProvisionByoipCidrCommandInput
| ProvisionIpamByoasnCommandInput
| ProvisionIpamPoolCidrCommandInput
Expand Down Expand Up @@ -2869,6 +2879,7 @@ export type ServiceOutputTypes =
| CopyFpgaImageCommandOutput
| CopyImageCommandOutput
| CopySnapshotCommandOutput
| CreateCapacityReservationBySplittingCommandOutput
| CreateCapacityReservationCommandOutput
| CreateCapacityReservationFleetCommandOutput
| CreateCarrierGatewayCommandOutput
Expand Down Expand Up @@ -3372,6 +3383,7 @@ export type ServiceOutputTypes =
| MonitorInstancesCommandOutput
| MoveAddressToVpcCommandOutput
| MoveByoipCidrToIpamCommandOutput
| MoveCapacityReservationInstancesCommandOutput
| ProvisionByoipCidrCommandOutput
| ProvisionIpamByoasnCommandOutput
| ProvisionIpamPoolCidrCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { commonParams } from "../endpoint/EndpointParameters";
import {
CreateCapacityReservationBySplittingRequest,
CreateCapacityReservationBySplittingResult,
} from "../models/models_0";
import {
de_CreateCapacityReservationBySplittingCommand,
se_CreateCapacityReservationBySplittingCommand,
} from "../protocols/Aws_ec2";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link CreateCapacityReservationBySplittingCommand}.
*/
export interface CreateCapacityReservationBySplittingCommandInput extends CreateCapacityReservationBySplittingRequest {}
/**
* @public
*
* The output of {@link CreateCapacityReservationBySplittingCommand}.
*/
export interface CreateCapacityReservationBySplittingCommandOutput
extends CreateCapacityReservationBySplittingResult,
__MetadataBearer {}

/**
* <p>
* Create a new Capacity Reservation by splitting the available capacity of the source Capacity Reservation. The new Capacity Reservation will have the same attributes as the source Capacity Reservation except for tags. The source Capacity Reservation must be <code>active</code> and owned by your Amazon Web Services account.
* </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { EC2Client, CreateCapacityReservationBySplittingCommand } from "@aws-sdk/client-ec2"; // ES Modules import
* // const { EC2Client, CreateCapacityReservationBySplittingCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
* const client = new EC2Client(config);
* const input = { // CreateCapacityReservationBySplittingRequest
* DryRun: true || false,
* ClientToken: "STRING_VALUE",
* SourceCapacityReservationId: "STRING_VALUE", // required
* InstanceCount: Number("int"), // required
* TagSpecifications: [ // TagSpecificationList
* { // TagSpecification
* ResourceType: "capacity-reservation" || "client-vpn-endpoint" || "customer-gateway" || "carrier-gateway" || "coip-pool" || "dedicated-host" || "dhcp-options" || "egress-only-internet-gateway" || "elastic-ip" || "elastic-gpu" || "export-image-task" || "export-instance-task" || "fleet" || "fpga-image" || "host-reservation" || "image" || "import-image-task" || "import-snapshot-task" || "instance" || "instance-event-window" || "internet-gateway" || "ipam" || "ipam-pool" || "ipam-scope" || "ipv4pool-ec2" || "ipv6pool-ec2" || "key-pair" || "launch-template" || "local-gateway" || "local-gateway-route-table" || "local-gateway-virtual-interface" || "local-gateway-virtual-interface-group" || "local-gateway-route-table-vpc-association" || "local-gateway-route-table-virtual-interface-group-association" || "natgateway" || "network-acl" || "network-interface" || "network-insights-analysis" || "network-insights-path" || "network-insights-access-scope" || "network-insights-access-scope-analysis" || "placement-group" || "prefix-list" || "replace-root-volume-task" || "reserved-instances" || "route-table" || "security-group" || "security-group-rule" || "snapshot" || "spot-fleet-request" || "spot-instances-request" || "subnet" || "subnet-cidr-reservation" || "traffic-mirror-filter" || "traffic-mirror-session" || "traffic-mirror-target" || "transit-gateway" || "transit-gateway-attachment" || "transit-gateway-connect-peer" || "transit-gateway-multicast-domain" || "transit-gateway-policy-table" || "transit-gateway-route-table" || "transit-gateway-route-table-announcement" || "volume" || "vpc" || "vpc-endpoint" || "vpc-endpoint-connection" || "vpc-endpoint-service" || "vpc-endpoint-service-permission" || "vpc-peering-connection" || "vpn-connection" || "vpn-gateway" || "vpc-flow-log" || "capacity-reservation-fleet" || "traffic-mirror-filter-rule" || "vpc-endpoint-connection-device-type" || "verified-access-instance" || "verified-access-group" || "verified-access-endpoint" || "verified-access-policy" || "verified-access-trust-provider" || "vpn-connection-device-type" || "vpc-block-public-access-exclusion" || "ipam-resource-discovery" || "ipam-resource-discovery-association" || "instance-connect-endpoint" || "ipam-external-resource-verification-token",
* Tags: [ // TagList
* { // Tag
* Key: "STRING_VALUE",
* Value: "STRING_VALUE",
* },
* ],
* },
* ],
* };
* const command = new CreateCapacityReservationBySplittingCommand(input);
* const response = await client.send(command);
* // { // CreateCapacityReservationBySplittingResult
* // SourceCapacityReservation: { // CapacityReservation
* // CapacityReservationId: "STRING_VALUE",
* // OwnerId: "STRING_VALUE",
* // CapacityReservationArn: "STRING_VALUE",
* // AvailabilityZoneId: "STRING_VALUE",
* // InstanceType: "STRING_VALUE",
* // InstancePlatform: "Linux/UNIX" || "Red Hat Enterprise Linux" || "SUSE Linux" || "Windows" || "Windows with SQL Server" || "Windows with SQL Server Enterprise" || "Windows with SQL Server Standard" || "Windows with SQL Server Web" || "Linux with SQL Server Standard" || "Linux with SQL Server Web" || "Linux with SQL Server Enterprise" || "RHEL with SQL Server Standard" || "RHEL with SQL Server Enterprise" || "RHEL with SQL Server Web" || "RHEL with HA" || "RHEL with HA and SQL Server Standard" || "RHEL with HA and SQL Server Enterprise" || "Ubuntu Pro",
* // AvailabilityZone: "STRING_VALUE",
* // Tenancy: "default" || "dedicated",
* // TotalInstanceCount: Number("int"),
* // AvailableInstanceCount: Number("int"),
* // EbsOptimized: true || false,
* // EphemeralStorage: true || false,
* // State: "active" || "expired" || "cancelled" || "pending" || "failed" || "scheduled" || "payment-pending" || "payment-failed",
* // StartDate: new Date("TIMESTAMP"),
* // EndDate: new Date("TIMESTAMP"),
* // EndDateType: "unlimited" || "limited",
* // InstanceMatchCriteria: "open" || "targeted",
* // CreateDate: new Date("TIMESTAMP"),
* // Tags: [ // TagList
* // { // Tag
* // Key: "STRING_VALUE",
* // Value: "STRING_VALUE",
* // },
* // ],
* // OutpostArn: "STRING_VALUE",
* // CapacityReservationFleetId: "STRING_VALUE",
* // PlacementGroupArn: "STRING_VALUE",
* // CapacityAllocations: [ // CapacityAllocations
* // { // CapacityAllocation
* // AllocationType: "used",
* // Count: Number("int"),
* // },
* // ],
* // ReservationType: "default" || "capacity-block",
* // },
* // DestinationCapacityReservation: {
* // CapacityReservationId: "STRING_VALUE",
* // OwnerId: "STRING_VALUE",
* // CapacityReservationArn: "STRING_VALUE",
* // AvailabilityZoneId: "STRING_VALUE",
* // InstanceType: "STRING_VALUE",
* // InstancePlatform: "Linux/UNIX" || "Red Hat Enterprise Linux" || "SUSE Linux" || "Windows" || "Windows with SQL Server" || "Windows with SQL Server Enterprise" || "Windows with SQL Server Standard" || "Windows with SQL Server Web" || "Linux with SQL Server Standard" || "Linux with SQL Server Web" || "Linux with SQL Server Enterprise" || "RHEL with SQL Server Standard" || "RHEL with SQL Server Enterprise" || "RHEL with SQL Server Web" || "RHEL with HA" || "RHEL with HA and SQL Server Standard" || "RHEL with HA and SQL Server Enterprise" || "Ubuntu Pro",
* // AvailabilityZone: "STRING_VALUE",
* // Tenancy: "default" || "dedicated",
* // TotalInstanceCount: Number("int"),
* // AvailableInstanceCount: Number("int"),
* // EbsOptimized: true || false,
* // EphemeralStorage: true || false,
* // State: "active" || "expired" || "cancelled" || "pending" || "failed" || "scheduled" || "payment-pending" || "payment-failed",
* // StartDate: new Date("TIMESTAMP"),
* // EndDate: new Date("TIMESTAMP"),
* // EndDateType: "unlimited" || "limited",
* // InstanceMatchCriteria: "open" || "targeted",
* // CreateDate: new Date("TIMESTAMP"),
* // Tags: [
* // {
* // Key: "STRING_VALUE",
* // Value: "STRING_VALUE",
* // },
* // ],
* // OutpostArn: "STRING_VALUE",
* // CapacityReservationFleetId: "STRING_VALUE",
* // PlacementGroupArn: "STRING_VALUE",
* // CapacityAllocations: [
* // {
* // AllocationType: "used",
* // Count: Number("int"),
* // },
* // ],
* // ReservationType: "default" || "capacity-block",
* // },
* // InstanceCount: Number("int"),
* // };
*
* ```
*
* @param CreateCapacityReservationBySplittingCommandInput - {@link CreateCapacityReservationBySplittingCommandInput}
* @returns {@link CreateCapacityReservationBySplittingCommandOutput}
* @see {@link CreateCapacityReservationBySplittingCommandInput} for command's `input` shape.
* @see {@link CreateCapacityReservationBySplittingCommandOutput} for command's `response` shape.
* @see {@link EC2ClientResolvedConfig | config} for EC2Client's `config` shape.
*
* @throws {@link EC2ServiceException}
* <p>Base exception class for all service exceptions from EC2 service.</p>
*
* @public
*/
export class CreateCapacityReservationBySplittingCommand extends $Command
.classBuilder<
CreateCapacityReservationBySplittingCommandInput,
CreateCapacityReservationBySplittingCommandOutput,
EC2ClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: EC2ClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AmazonEC2", "CreateCapacityReservationBySplitting", {})
.n("EC2Client", "CreateCapacityReservationBySplittingCommand")
.f(void 0, void 0)
.ser(se_CreateCapacityReservationBySplittingCommand)
.de(de_CreateCapacityReservationBySplittingCommand)
.build() {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { commonParams } from "../endpoint/EndpointParameters";
import { CreateCapacityReservationFleetRequest } from "../models/models_0";
import { CreateCapacityReservationFleetResult } from "../models/models_1";
import { CreateCapacityReservationFleetRequest, CreateCapacityReservationFleetResult } from "../models/models_1";
import {
de_CreateCapacityReservationFleetCommand,
se_CreateCapacityReservationFleetCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { commonParams } from "../endpoint/EndpointParameters";
import { CreateNetworkInterfaceRequest } from "../models/models_1";
import { CreateNetworkInterfaceResult } from "../models/models_2";
import { CreateNetworkInterfaceRequest, CreateNetworkInterfaceResult } from "../models/models_2";
import { de_CreateNetworkInterfaceCommand, se_CreateNetworkInterfaceCommand } from "../protocols/Aws_ec2";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { EC2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2Client";
import { commonParams } from "../endpoint/EndpointParameters";
import { DeleteLaunchTemplateVersionsRequest, DeleteLaunchTemplateVersionsResult } from "../models/models_2";
import { DeleteLaunchTemplateVersionsRequest } from "../models/models_2";
import { DeleteLaunchTemplateVersionsResult } from "../models/models_3";
import { de_DeleteLaunchTemplateVersionsCommand, se_DeleteLaunchTemplateVersionsCommand } from "../protocols/Aws_ec2";

/**
Expand Down
Loading

0 comments on commit 6e0db43

Please sign in to comment.