Skip to content

Commit 5d96b68

Browse files
author
awstools
committed
feat(client-auto-scaling): This release adds the new LaunchInstances API, which can launch instances synchronously in an AutoScaling group. The API also returns instances info and launch error back immediately.
1 parent 114920c commit 5d96b68

File tree

8 files changed

+812
-3
lines changed

8 files changed

+812
-3
lines changed

clients/client-auto-scaling/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,14 @@ GetPredictiveScalingForecast
608608

609609
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/auto-scaling/command/GetPredictiveScalingForecastCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-auto-scaling/Interface/GetPredictiveScalingForecastCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-auto-scaling/Interface/GetPredictiveScalingForecastCommandOutput/)
610610

611+
</details>
612+
<details>
613+
<summary>
614+
LaunchInstances
615+
</summary>
616+
617+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/auto-scaling/command/LaunchInstancesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-auto-scaling/Interface/LaunchInstancesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-auto-scaling/Interface/LaunchInstancesCommandOutput/)
618+
611619
</details>
612620
<details>
613621
<summary>

clients/client-auto-scaling/src/AutoScaling.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ import {
245245
GetPredictiveScalingForecastCommandInput,
246246
GetPredictiveScalingForecastCommandOutput,
247247
} from "./commands/GetPredictiveScalingForecastCommand";
248+
import {
249+
LaunchInstancesCommand,
250+
LaunchInstancesCommandInput,
251+
LaunchInstancesCommandOutput,
252+
} from "./commands/LaunchInstancesCommand";
248253
import {
249254
PutLifecycleHookCommand,
250255
PutLifecycleHookCommandInput,
@@ -368,6 +373,7 @@ const commands = {
368373
ExecutePolicyCommand,
369374
ExitStandbyCommand,
370375
GetPredictiveScalingForecastCommand,
376+
LaunchInstancesCommand,
371377
PutLifecycleHookCommand,
372378
PutNotificationConfigurationCommand,
373379
PutScalingPolicyCommand,
@@ -1206,6 +1212,20 @@ export interface AutoScaling {
12061212
cb: (err: any, data?: GetPredictiveScalingForecastCommandOutput) => void
12071213
): void;
12081214

1215+
/**
1216+
* @see {@link LaunchInstancesCommand}
1217+
*/
1218+
launchInstances(
1219+
args: LaunchInstancesCommandInput,
1220+
options?: __HttpHandlerOptions
1221+
): Promise<LaunchInstancesCommandOutput>;
1222+
launchInstances(args: LaunchInstancesCommandInput, cb: (err: any, data?: LaunchInstancesCommandOutput) => void): void;
1223+
launchInstances(
1224+
args: LaunchInstancesCommandInput,
1225+
options: __HttpHandlerOptions,
1226+
cb: (err: any, data?: LaunchInstancesCommandOutput) => void
1227+
): void;
1228+
12091229
/**
12101230
* @see {@link PutLifecycleHookCommand}
12111231
*/

clients/client-auto-scaling/src/AutoScalingClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ import {
221221
GetPredictiveScalingForecastCommandInput,
222222
GetPredictiveScalingForecastCommandOutput,
223223
} from "./commands/GetPredictiveScalingForecastCommand";
224+
import { LaunchInstancesCommandInput, LaunchInstancesCommandOutput } from "./commands/LaunchInstancesCommand";
224225
import { PutLifecycleHookCommandInput, PutLifecycleHookCommandOutput } from "./commands/PutLifecycleHookCommand";
225226
import {
226227
PutNotificationConfigurationCommandInput,
@@ -325,6 +326,7 @@ export type ServiceInputTypes =
325326
| ExecutePolicyCommandInput
326327
| ExitStandbyCommandInput
327328
| GetPredictiveScalingForecastCommandInput
329+
| LaunchInstancesCommandInput
328330
| PutLifecycleHookCommandInput
329331
| PutNotificationConfigurationCommandInput
330332
| PutScalingPolicyCommandInput
@@ -395,6 +397,7 @@ export type ServiceOutputTypes =
395397
| ExecutePolicyCommandOutput
396398
| ExitStandbyCommandOutput
397399
| GetPredictiveScalingForecastCommandOutput
400+
| LaunchInstancesCommandOutput
398401
| PutLifecycleHookCommandOutput
399402
| PutNotificationConfigurationCommandOutput
400403
| PutScalingPolicyCommandOutput
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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 { AutoScalingClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../AutoScalingClient";
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { LaunchInstancesRequest, LaunchInstancesResult } from "../models/models_0";
9+
import { LaunchInstances } 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 LaunchInstancesCommand}.
20+
*/
21+
export interface LaunchInstancesCommandInput extends LaunchInstancesRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link LaunchInstancesCommand}.
26+
*/
27+
export interface LaunchInstancesCommandOutput extends LaunchInstancesResult, __MetadataBearer {}
28+
29+
/**
30+
* <p> Launches a specified number of instances in an Auto Scaling group. Returns instance IDs and
31+
* other details if launch is successful or error details if launch is unsuccessful. </p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { AutoScalingClient, LaunchInstancesCommand } from "@aws-sdk/client-auto-scaling"; // ES Modules import
36+
* // const { AutoScalingClient, LaunchInstancesCommand } = require("@aws-sdk/client-auto-scaling"); // CommonJS import
37+
* // import type { AutoScalingClientConfig } from "@aws-sdk/client-auto-scaling";
38+
* const config = {}; // type is AutoScalingClientConfig
39+
* const client = new AutoScalingClient(config);
40+
* const input = { // LaunchInstancesRequest
41+
* AutoScalingGroupName: "STRING_VALUE", // required
42+
* RequestedCapacity: Number("int"), // required
43+
* ClientToken: "STRING_VALUE", // required
44+
* AvailabilityZones: [ // AvailabilityZonesLimit1
45+
* "STRING_VALUE",
46+
* ],
47+
* AvailabilityZoneIds: [ // AvailabilityZoneIdsLimit1
48+
* "STRING_VALUE",
49+
* ],
50+
* SubnetIds: [ // SubnetIdsLimit1
51+
* "STRING_VALUE",
52+
* ],
53+
* RetryStrategy: "retry-with-group-configuration" || "none",
54+
* };
55+
* const command = new LaunchInstancesCommand(input);
56+
* const response = await client.send(command);
57+
* // { // LaunchInstancesResult
58+
* // AutoScalingGroupName: "STRING_VALUE",
59+
* // ClientToken: "STRING_VALUE",
60+
* // Instances: [ // InstanceCollections
61+
* // { // InstanceCollection
62+
* // InstanceType: "STRING_VALUE",
63+
* // MarketType: "STRING_VALUE",
64+
* // SubnetId: "STRING_VALUE",
65+
* // AvailabilityZone: "STRING_VALUE",
66+
* // AvailabilityZoneId: "STRING_VALUE",
67+
* // InstanceIds: [ // InstanceIds
68+
* // "STRING_VALUE",
69+
* // ],
70+
* // },
71+
* // ],
72+
* // Errors: [ // LaunchInstancesErrors
73+
* // { // LaunchInstancesError
74+
* // InstanceType: "STRING_VALUE",
75+
* // MarketType: "STRING_VALUE",
76+
* // SubnetId: "STRING_VALUE",
77+
* // AvailabilityZone: "STRING_VALUE",
78+
* // AvailabilityZoneId: "STRING_VALUE",
79+
* // ErrorCode: "STRING_VALUE",
80+
* // ErrorMessage: "STRING_VALUE",
81+
* // },
82+
* // ],
83+
* // };
84+
*
85+
* ```
86+
*
87+
* @param LaunchInstancesCommandInput - {@link LaunchInstancesCommandInput}
88+
* @returns {@link LaunchInstancesCommandOutput}
89+
* @see {@link LaunchInstancesCommandInput} for command's `input` shape.
90+
* @see {@link LaunchInstancesCommandOutput} for command's `response` shape.
91+
* @see {@link AutoScalingClientResolvedConfig | config} for AutoScalingClient's `config` shape.
92+
*
93+
* @throws {@link IdempotentParameterMismatchError} (client fault)
94+
* <p>
95+
* Indicates that the parameters in the current request do not match the parameters from a previous request with the same client token within the idempotency window.
96+
* </p>
97+
*
98+
* @throws {@link ResourceContentionFault} (server fault)
99+
* <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group,
100+
* instance, or load balancer).</p>
101+
*
102+
* @throws {@link AutoScalingServiceException}
103+
* <p>Base exception class for all service exceptions from AutoScaling service.</p>
104+
*
105+
*
106+
* @public
107+
*/
108+
export class LaunchInstancesCommand extends $Command
109+
.classBuilder<
110+
LaunchInstancesCommandInput,
111+
LaunchInstancesCommandOutput,
112+
AutoScalingClientResolvedConfig,
113+
ServiceInputTypes,
114+
ServiceOutputTypes
115+
>()
116+
.ep(commonParams)
117+
.m(function (this: any, Command: any, cs: any, config: AutoScalingClientResolvedConfig, o: any) {
118+
return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
119+
})
120+
.s("AutoScaling_2011_01_01", "LaunchInstances", {})
121+
.n("AutoScalingClient", "LaunchInstancesCommand")
122+
.sc(LaunchInstances)
123+
.build() {
124+
/** @internal type navigation helper, not in runtime. */
125+
protected declare static __types: {
126+
api: {
127+
input: LaunchInstancesRequest;
128+
output: LaunchInstancesResult;
129+
};
130+
sdk: {
131+
input: LaunchInstancesCommandInput;
132+
output: LaunchInstancesCommandOutput;
133+
};
134+
};
135+
}

clients/client-auto-scaling/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export * from "./EnterStandbyCommand";
4949
export * from "./ExecutePolicyCommand";
5050
export * from "./ExitStandbyCommand";
5151
export * from "./GetPredictiveScalingForecastCommand";
52+
export * from "./LaunchInstancesCommand";
5253
export * from "./PutLifecycleHookCommand";
5354
export * from "./PutNotificationConfigurationCommand";
5455
export * from "./PutScalingPolicyCommand";

0 commit comments

Comments
 (0)