Skip to content

Commit 7a3e95b

Browse files
author
awstools
committed
feat(client-emr): Add support for customers to modify cluster attribute auto-terminate post cluster launch
1 parent 08f6904 commit 7a3e95b

File tree

8 files changed

+256
-0
lines changed

8 files changed

+256
-0
lines changed

clients/client-emr/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,14 @@ RunJobFlow
580580

581581
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/emr/command/RunJobFlowCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/RunJobFlowCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/RunJobFlowCommandOutput/)
582582

583+
</details>
584+
<details>
585+
<summary>
586+
SetKeepJobFlowAliveWhenNoSteps
587+
</summary>
588+
589+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/emr/command/SetKeepJobFlowAliveWhenNoStepsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetKeepJobFlowAliveWhenNoStepsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-emr/Interface/SetKeepJobFlowAliveWhenNoStepsCommandOutput/)
590+
583591
</details>
584592
<details>
585593
<summary>

clients/client-emr/src/EMR.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,11 @@ import {
213213
} from "./commands/RemoveManagedScalingPolicyCommand";
214214
import { RemoveTagsCommand, RemoveTagsCommandInput, RemoveTagsCommandOutput } from "./commands/RemoveTagsCommand";
215215
import { RunJobFlowCommand, RunJobFlowCommandInput, RunJobFlowCommandOutput } from "./commands/RunJobFlowCommand";
216+
import {
217+
SetKeepJobFlowAliveWhenNoStepsCommand,
218+
SetKeepJobFlowAliveWhenNoStepsCommandInput,
219+
SetKeepJobFlowAliveWhenNoStepsCommandOutput,
220+
} from "./commands/SetKeepJobFlowAliveWhenNoStepsCommand";
216221
import {
217222
SetTerminationProtectionCommand,
218223
SetTerminationProtectionCommandInput,
@@ -298,6 +303,7 @@ const commands = {
298303
RemoveManagedScalingPolicyCommand,
299304
RemoveTagsCommand,
300305
RunJobFlowCommand,
306+
SetKeepJobFlowAliveWhenNoStepsCommand,
301307
SetTerminationProtectionCommand,
302308
SetVisibleToAllUsersCommand,
303309
StartNotebookExecutionCommand,
@@ -1026,6 +1032,23 @@ export interface EMR {
10261032
cb: (err: any, data?: RunJobFlowCommandOutput) => void
10271033
): void;
10281034

1035+
/**
1036+
* @see {@link SetKeepJobFlowAliveWhenNoStepsCommand}
1037+
*/
1038+
setKeepJobFlowAliveWhenNoSteps(
1039+
args: SetKeepJobFlowAliveWhenNoStepsCommandInput,
1040+
options?: __HttpHandlerOptions
1041+
): Promise<SetKeepJobFlowAliveWhenNoStepsCommandOutput>;
1042+
setKeepJobFlowAliveWhenNoSteps(
1043+
args: SetKeepJobFlowAliveWhenNoStepsCommandInput,
1044+
cb: (err: any, data?: SetKeepJobFlowAliveWhenNoStepsCommandOutput) => void
1045+
): void;
1046+
setKeepJobFlowAliveWhenNoSteps(
1047+
args: SetKeepJobFlowAliveWhenNoStepsCommandInput,
1048+
options: __HttpHandlerOptions,
1049+
cb: (err: any, data?: SetKeepJobFlowAliveWhenNoStepsCommandOutput) => void
1050+
): void;
1051+
10291052
/**
10301053
* @see {@link SetTerminationProtectionCommand}
10311054
*/

clients/client-emr/src/EMRClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ import {
173173
} from "./commands/RemoveManagedScalingPolicyCommand";
174174
import { RemoveTagsCommandInput, RemoveTagsCommandOutput } from "./commands/RemoveTagsCommand";
175175
import { RunJobFlowCommandInput, RunJobFlowCommandOutput } from "./commands/RunJobFlowCommand";
176+
import {
177+
SetKeepJobFlowAliveWhenNoStepsCommandInput,
178+
SetKeepJobFlowAliveWhenNoStepsCommandOutput,
179+
} from "./commands/SetKeepJobFlowAliveWhenNoStepsCommand";
176180
import {
177181
SetTerminationProtectionCommandInput,
178182
SetTerminationProtectionCommandOutput,
@@ -257,6 +261,7 @@ export type ServiceInputTypes =
257261
| RemoveManagedScalingPolicyCommandInput
258262
| RemoveTagsCommandInput
259263
| RunJobFlowCommandInput
264+
| SetKeepJobFlowAliveWhenNoStepsCommandInput
260265
| SetTerminationProtectionCommandInput
261266
| SetVisibleToAllUsersCommandInput
262267
| StartNotebookExecutionCommandInput
@@ -316,6 +321,7 @@ export type ServiceOutputTypes =
316321
| RemoveManagedScalingPolicyCommandOutput
317322
| RemoveTagsCommandOutput
318323
| RunJobFlowCommandOutput
324+
| SetKeepJobFlowAliveWhenNoStepsCommandOutput
319325
| SetTerminationProtectionCommandOutput
320326
| SetVisibleToAllUsersCommandOutput
321327
| StartNotebookExecutionCommandOutput
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { EMRClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EMRClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { SetKeepJobFlowAliveWhenNoStepsInput } from "../models/models_0";
10+
import {
11+
de_SetKeepJobFlowAliveWhenNoStepsCommand,
12+
se_SetKeepJobFlowAliveWhenNoStepsCommand,
13+
} from "../protocols/Aws_json1_1";
14+
15+
/**
16+
* @public
17+
*/
18+
export { __MetadataBearer, $Command };
19+
/**
20+
* @public
21+
*
22+
* The input for {@link SetKeepJobFlowAliveWhenNoStepsCommand}.
23+
*/
24+
export interface SetKeepJobFlowAliveWhenNoStepsCommandInput extends SetKeepJobFlowAliveWhenNoStepsInput {}
25+
/**
26+
* @public
27+
*
28+
* The output of {@link SetKeepJobFlowAliveWhenNoStepsCommand}.
29+
*/
30+
export interface SetKeepJobFlowAliveWhenNoStepsCommandOutput extends __MetadataBearer {}
31+
32+
/**
33+
* @public
34+
* <p>You can use the <code>SetKeepJobFlowAliveWhenNoSteps</code> to configure a cluster (job flow) to terminate after the step execution, i.e., all your
35+
* steps are executed. If you want a transient cluster that shuts down after the last of the current executing steps are completed,
36+
* you can configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to false. If you want a long running cluster, configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to true.</p>
37+
* <p>For more information, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html">Managing Cluster Termination</a> in the <i>Amazon EMR Management Guide</i>.</p>
38+
* @example
39+
* Use a bare-bones client and the command you need to make an API call.
40+
* ```javascript
41+
* import { EMRClient, SetKeepJobFlowAliveWhenNoStepsCommand } from "@aws-sdk/client-emr"; // ES Modules import
42+
* // const { EMRClient, SetKeepJobFlowAliveWhenNoStepsCommand } = require("@aws-sdk/client-emr"); // CommonJS import
43+
* const client = new EMRClient(config);
44+
* const input = { // SetKeepJobFlowAliveWhenNoStepsInput
45+
* JobFlowIds: [ // XmlStringList // required
46+
* "STRING_VALUE",
47+
* ],
48+
* KeepJobFlowAliveWhenNoSteps: true || false, // required
49+
* };
50+
* const command = new SetKeepJobFlowAliveWhenNoStepsCommand(input);
51+
* const response = await client.send(command);
52+
* // {};
53+
*
54+
* ```
55+
*
56+
* @param SetKeepJobFlowAliveWhenNoStepsCommandInput - {@link SetKeepJobFlowAliveWhenNoStepsCommandInput}
57+
* @returns {@link SetKeepJobFlowAliveWhenNoStepsCommandOutput}
58+
* @see {@link SetKeepJobFlowAliveWhenNoStepsCommandInput} for command's `input` shape.
59+
* @see {@link SetKeepJobFlowAliveWhenNoStepsCommandOutput} for command's `response` shape.
60+
* @see {@link EMRClientResolvedConfig | config} for EMRClient's `config` shape.
61+
*
62+
* @throws {@link InternalServerError} (server fault)
63+
* <p>Indicates that an error occurred while processing the request and that the request was
64+
* not completed.</p>
65+
*
66+
* @throws {@link EMRServiceException}
67+
* <p>Base exception class for all service exceptions from EMR service.</p>
68+
*
69+
*/
70+
export class SetKeepJobFlowAliveWhenNoStepsCommand extends $Command
71+
.classBuilder<
72+
SetKeepJobFlowAliveWhenNoStepsCommandInput,
73+
SetKeepJobFlowAliveWhenNoStepsCommandOutput,
74+
EMRClientResolvedConfig,
75+
ServiceInputTypes,
76+
ServiceOutputTypes
77+
>()
78+
.ep({
79+
...commonParams,
80+
})
81+
.m(function (this: any, Command: any, cs: any, config: EMRClientResolvedConfig, o: any) {
82+
return [
83+
getSerdePlugin(config, this.serialize, this.deserialize),
84+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
85+
];
86+
})
87+
.s("ElasticMapReduce", "SetKeepJobFlowAliveWhenNoSteps", {})
88+
.n("EMRClient", "SetKeepJobFlowAliveWhenNoStepsCommand")
89+
.f(void 0, void 0)
90+
.ser(se_SetKeepJobFlowAliveWhenNoStepsCommand)
91+
.de(de_SetKeepJobFlowAliveWhenNoStepsCommand)
92+
.build() {}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export * from "./RemoveAutoTerminationPolicyCommand";
4646
export * from "./RemoveManagedScalingPolicyCommand";
4747
export * from "./RemoveTagsCommand";
4848
export * from "./RunJobFlowCommand";
49+
export * from "./SetKeepJobFlowAliveWhenNoStepsCommand";
4950
export * from "./SetTerminationProtectionCommand";
5051
export * from "./SetVisibleToAllUsersCommand";
5152
export * from "./StartNotebookExecutionCommand";

clients/client-emr/src/models/models_0.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5726,6 +5726,25 @@ export interface RunJobFlowOutput {
57265726
ClusterArn?: string;
57275727
}
57285728

5729+
/**
5730+
* @public
5731+
*/
5732+
export interface SetKeepJobFlowAliveWhenNoStepsInput {
5733+
/**
5734+
* @public
5735+
* <p>A list of strings that uniquely identify the clusters to protect. This identifier is returned by
5736+
* <a href="https://docs.aws.amazon.com/emr/latest/APIReference/API_RunJobFlow.html">RunJobFlow</a> and can also
5737+
* be obtained from <a href="https://docs.aws.amazon.com/emr/latest/APIReference/API_DescribeJobFlows.html">DescribeJobFlows</a>.</p>
5738+
*/
5739+
JobFlowIds: string[] | undefined;
5740+
5741+
/**
5742+
* @public
5743+
* <p>A Boolean that indicates whether to terminate the cluster after all steps are executed.</p>
5744+
*/
5745+
KeepJobFlowAliveWhenNoSteps: boolean | undefined;
5746+
}
5747+
57295748
/**
57305749
* @public
57315750
* <p> The input argument to the <a>TerminationProtection</a> operation. </p>

clients/client-emr/src/protocols/Aws_json1_1.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ import {
150150
} from "../commands/RemoveManagedScalingPolicyCommand";
151151
import { RemoveTagsCommandInput, RemoveTagsCommandOutput } from "../commands/RemoveTagsCommand";
152152
import { RunJobFlowCommandInput, RunJobFlowCommandOutput } from "../commands/RunJobFlowCommand";
153+
import {
154+
SetKeepJobFlowAliveWhenNoStepsCommandInput,
155+
SetKeepJobFlowAliveWhenNoStepsCommandOutput,
156+
} from "../commands/SetKeepJobFlowAliveWhenNoStepsCommand";
153157
import {
154158
SetTerminationProtectionCommandInput,
155159
SetTerminationProtectionCommandOutput,
@@ -313,6 +317,7 @@ import {
313317
SecurityConfigurationSummary,
314318
SessionMappingDetail,
315319
SessionMappingSummary,
320+
SetKeepJobFlowAliveWhenNoStepsInput,
316321
SetTerminationProtectionInput,
317322
SetVisibleToAllUsersInput,
318323
ShrinkPolicy,
@@ -951,6 +956,19 @@ export const se_RunJobFlowCommand = async (
951956
return buildHttpRpcRequest(context, headers, "/", undefined, body);
952957
};
953958

959+
/**
960+
* serializeAws_json1_1SetKeepJobFlowAliveWhenNoStepsCommand
961+
*/
962+
export const se_SetKeepJobFlowAliveWhenNoStepsCommand = async (
963+
input: SetKeepJobFlowAliveWhenNoStepsCommandInput,
964+
context: __SerdeContext
965+
): Promise<__HttpRequest> => {
966+
const headers: __HeaderBag = sharedHeaders("SetKeepJobFlowAliveWhenNoSteps");
967+
let body: any;
968+
body = JSON.stringify(_json(input));
969+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
970+
};
971+
954972
/**
955973
* serializeAws_json1_1SetTerminationProtectionCommand
956974
*/
@@ -3243,6 +3261,49 @@ const de_RunJobFlowCommandError = async (
32433261
}
32443262
};
32453263

3264+
/**
3265+
* deserializeAws_json1_1SetKeepJobFlowAliveWhenNoStepsCommand
3266+
*/
3267+
export const de_SetKeepJobFlowAliveWhenNoStepsCommand = async (
3268+
output: __HttpResponse,
3269+
context: __SerdeContext
3270+
): Promise<SetKeepJobFlowAliveWhenNoStepsCommandOutput> => {
3271+
if (output.statusCode >= 300) {
3272+
return de_SetKeepJobFlowAliveWhenNoStepsCommandError(output, context);
3273+
}
3274+
await collectBody(output.body, context);
3275+
const response: SetKeepJobFlowAliveWhenNoStepsCommandOutput = {
3276+
$metadata: deserializeMetadata(output),
3277+
};
3278+
return response;
3279+
};
3280+
3281+
/**
3282+
* deserializeAws_json1_1SetKeepJobFlowAliveWhenNoStepsCommandError
3283+
*/
3284+
const de_SetKeepJobFlowAliveWhenNoStepsCommandError = async (
3285+
output: __HttpResponse,
3286+
context: __SerdeContext
3287+
): Promise<SetKeepJobFlowAliveWhenNoStepsCommandOutput> => {
3288+
const parsedOutput: any = {
3289+
...output,
3290+
body: await parseErrorBody(output.body, context),
3291+
};
3292+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3293+
switch (errorCode) {
3294+
case "InternalServerError":
3295+
case "com.amazonaws.emr#InternalServerError":
3296+
throw await de_InternalServerErrorRes(parsedOutput, context);
3297+
default:
3298+
const parsedBody = parsedOutput.body;
3299+
return throwDefaultError({
3300+
output,
3301+
parsedBody,
3302+
errorCode,
3303+
});
3304+
}
3305+
};
3306+
32463307
/**
32473308
* deserializeAws_json1_1SetTerminationProtectionCommand
32483309
*/
@@ -4123,6 +4184,8 @@ const se_ScalingTrigger = (input: ScalingTrigger, context: __SerdeContext): any
41234184

41244185
// se_SecurityGroupsList omitted.
41254186

4187+
// se_SetKeepJobFlowAliveWhenNoStepsInput omitted.
4188+
41264189
// se_SetTerminationProtectionInput omitted.
41274190

41284191
// se_SetVisibleToAllUsersInput omitted.

codegen/sdk-codegen/aws-models/emr.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,6 +2794,9 @@
27942794
{
27952795
"target": "com.amazonaws.emr#RunJobFlow"
27962796
},
2797+
{
2798+
"target": "com.amazonaws.emr#SetKeepJobFlowAliveWhenNoSteps"
2799+
},
27972800
{
27982801
"target": "com.amazonaws.emr#SetTerminationProtection"
27992802
},
@@ -8935,6 +8938,47 @@
89358938
"target": "com.amazonaws.emr#SessionMappingSummary"
89368939
}
89378940
},
8941+
"com.amazonaws.emr#SetKeepJobFlowAliveWhenNoSteps": {
8942+
"type": "operation",
8943+
"input": {
8944+
"target": "com.amazonaws.emr#SetKeepJobFlowAliveWhenNoStepsInput"
8945+
},
8946+
"output": {
8947+
"target": "smithy.api#Unit"
8948+
},
8949+
"errors": [
8950+
{
8951+
"target": "com.amazonaws.emr#InternalServerError"
8952+
}
8953+
],
8954+
"traits": {
8955+
"smithy.api#documentation": "<p>You can use the <code>SetKeepJobFlowAliveWhenNoSteps</code> to configure a cluster (job flow) to terminate after the step execution, i.e., all your \n steps are executed. If you want a transient cluster that shuts down after the last of the current executing steps are completed, \n you can configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to false. If you want a long running cluster, configure <code>SetKeepJobFlowAliveWhenNoSteps</code> to true.</p>\n <p>For more information, see <a href=\"https://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html\">Managing Cluster Termination</a> in the <i>Amazon EMR Management Guide</i>.</p>"
8956+
}
8957+
},
8958+
"com.amazonaws.emr#SetKeepJobFlowAliveWhenNoStepsInput": {
8959+
"type": "structure",
8960+
"members": {
8961+
"JobFlowIds": {
8962+
"target": "com.amazonaws.emr#XmlStringList",
8963+
"traits": {
8964+
"smithy.api#clientOptional": {},
8965+
"smithy.api#documentation": "<p>A list of strings that uniquely identify the clusters to protect. This identifier is returned by \n <a href=\"https://docs.aws.amazon.com/emr/latest/APIReference/API_RunJobFlow.html\">RunJobFlow</a> and can also \n be obtained from <a href=\"https://docs.aws.amazon.com/emr/latest/APIReference/API_DescribeJobFlows.html\">DescribeJobFlows</a>.</p>",
8966+
"smithy.api#required": {}
8967+
}
8968+
},
8969+
"KeepJobFlowAliveWhenNoSteps": {
8970+
"target": "com.amazonaws.emr#Boolean",
8971+
"traits": {
8972+
"smithy.api#clientOptional": {},
8973+
"smithy.api#documentation": "<p>A Boolean that indicates whether to terminate the cluster after all steps are executed.</p>",
8974+
"smithy.api#required": {}
8975+
}
8976+
}
8977+
},
8978+
"traits": {
8979+
"smithy.api#input": {}
8980+
}
8981+
},
89388982
"com.amazonaws.emr#SetTerminationProtection": {
89398983
"type": "operation",
89408984
"input": {

0 commit comments

Comments
 (0)