Skip to content

Commit 2129ba2

Browse files
author
awstools
committed
feat(client-batch): This release adds support for the AWS Batch GetJobQueueSnapshot API operation.
1 parent d391abe commit 2129ba2

File tree

8 files changed

+368
-8
lines changed

8 files changed

+368
-8
lines changed

clients/client-batch/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,14 @@ DescribeSchedulingPolicies
317317

318318
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/batch/command/DescribeSchedulingPoliciesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-batch/Interface/DescribeSchedulingPoliciesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-batch/Interface/DescribeSchedulingPoliciesCommandOutput/)
319319

320+
</details>
321+
<details>
322+
<summary>
323+
GetJobQueueSnapshot
324+
</summary>
325+
326+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/batch/command/GetJobQueueSnapshotCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-batch/Interface/GetJobQueueSnapshotCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-batch/Interface/GetJobQueueSnapshotCommandOutput/)
327+
320328
</details>
321329
<details>
322330
<summary>

clients/client-batch/src/Batch.ts

+23
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ import {
6464
DescribeSchedulingPoliciesCommandInput,
6565
DescribeSchedulingPoliciesCommandOutput,
6666
} from "./commands/DescribeSchedulingPoliciesCommand";
67+
import {
68+
GetJobQueueSnapshotCommand,
69+
GetJobQueueSnapshotCommandInput,
70+
GetJobQueueSnapshotCommandOutput,
71+
} from "./commands/GetJobQueueSnapshotCommand";
6772
import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "./commands/ListJobsCommand";
6873
import {
6974
ListSchedulingPoliciesCommand,
@@ -122,6 +127,7 @@ const commands = {
122127
DescribeJobQueuesCommand,
123128
DescribeJobsCommand,
124129
DescribeSchedulingPoliciesCommand,
130+
GetJobQueueSnapshotCommand,
125131
ListJobsCommand,
126132
ListSchedulingPoliciesCommand,
127133
ListTagsForResourceCommand,
@@ -342,6 +348,23 @@ export interface Batch {
342348
cb: (err: any, data?: DescribeSchedulingPoliciesCommandOutput) => void
343349
): void;
344350

351+
/**
352+
* @see {@link GetJobQueueSnapshotCommand}
353+
*/
354+
getJobQueueSnapshot(
355+
args: GetJobQueueSnapshotCommandInput,
356+
options?: __HttpHandlerOptions
357+
): Promise<GetJobQueueSnapshotCommandOutput>;
358+
getJobQueueSnapshot(
359+
args: GetJobQueueSnapshotCommandInput,
360+
cb: (err: any, data?: GetJobQueueSnapshotCommandOutput) => void
361+
): void;
362+
getJobQueueSnapshot(
363+
args: GetJobQueueSnapshotCommandInput,
364+
options: __HttpHandlerOptions,
365+
cb: (err: any, data?: GetJobQueueSnapshotCommandOutput) => void
366+
): void;
367+
345368
/**
346369
* @see {@link ListJobsCommand}
347370
*/

clients/client-batch/src/BatchClient.ts

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ import {
9090
DescribeSchedulingPoliciesCommandInput,
9191
DescribeSchedulingPoliciesCommandOutput,
9292
} from "./commands/DescribeSchedulingPoliciesCommand";
93+
import {
94+
GetJobQueueSnapshotCommandInput,
95+
GetJobQueueSnapshotCommandOutput,
96+
} from "./commands/GetJobQueueSnapshotCommand";
9397
import { ListJobsCommandInput, ListJobsCommandOutput } from "./commands/ListJobsCommand";
9498
import {
9599
ListSchedulingPoliciesCommandInput,
@@ -144,6 +148,7 @@ export type ServiceInputTypes =
144148
| DescribeJobQueuesCommandInput
145149
| DescribeJobsCommandInput
146150
| DescribeSchedulingPoliciesCommandInput
151+
| GetJobQueueSnapshotCommandInput
147152
| ListJobsCommandInput
148153
| ListSchedulingPoliciesCommandInput
149154
| ListTagsForResourceCommandInput
@@ -173,6 +178,7 @@ export type ServiceOutputTypes =
173178
| DescribeJobQueuesCommandOutput
174179
| DescribeJobsCommandOutput
175180
| DescribeSchedulingPoliciesCommandOutput
181+
| GetJobQueueSnapshotCommandOutput
176182
| ListJobsCommandOutput
177183
| ListSchedulingPoliciesCommandOutput
178184
| ListTagsForResourceCommandOutput
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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 { BatchClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BatchClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { GetJobQueueSnapshotRequest, GetJobQueueSnapshotResponse } from "../models/models_0";
10+
import { de_GetJobQueueSnapshotCommand, se_GetJobQueueSnapshotCommand } from "../protocols/Aws_restJson1";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link GetJobQueueSnapshotCommand}.
20+
*/
21+
export interface GetJobQueueSnapshotCommandInput extends GetJobQueueSnapshotRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link GetJobQueueSnapshotCommand}.
26+
*/
27+
export interface GetJobQueueSnapshotCommandOutput extends GetJobQueueSnapshotResponse, __MetadataBearer {}
28+
29+
/**
30+
* <p>Provides a list of the first 100 <code>RUNNABLE</code> jobs associated to a single job queue.</p>
31+
* @example
32+
* Use a bare-bones client and the command you need to make an API call.
33+
* ```javascript
34+
* import { BatchClient, GetJobQueueSnapshotCommand } from "@aws-sdk/client-batch"; // ES Modules import
35+
* // const { BatchClient, GetJobQueueSnapshotCommand } = require("@aws-sdk/client-batch"); // CommonJS import
36+
* const client = new BatchClient(config);
37+
* const input = { // GetJobQueueSnapshotRequest
38+
* jobQueue: "STRING_VALUE", // required
39+
* };
40+
* const command = new GetJobQueueSnapshotCommand(input);
41+
* const response = await client.send(command);
42+
* // { // GetJobQueueSnapshotResponse
43+
* // frontOfQueue: { // FrontOfQueueDetail
44+
* // jobs: [ // FrontOfQueueJobSummaryList
45+
* // { // FrontOfQueueJobSummary
46+
* // jobArn: "STRING_VALUE",
47+
* // earliestTimeAtPosition: Number("long"),
48+
* // },
49+
* // ],
50+
* // lastUpdatedAt: Number("long"),
51+
* // },
52+
* // };
53+
*
54+
* ```
55+
*
56+
* @param GetJobQueueSnapshotCommandInput - {@link GetJobQueueSnapshotCommandInput}
57+
* @returns {@link GetJobQueueSnapshotCommandOutput}
58+
* @see {@link GetJobQueueSnapshotCommandInput} for command's `input` shape.
59+
* @see {@link GetJobQueueSnapshotCommandOutput} for command's `response` shape.
60+
* @see {@link BatchClientResolvedConfig | config} for BatchClient's `config` shape.
61+
*
62+
* @throws {@link ClientException} (client fault)
63+
* <p>These errors are usually caused by a client action. One example cause is using an action or resource on behalf
64+
* of a user that doesn't have permissions to use the action or resource. Another cause is specifying an identifier
65+
* that's not valid.</p>
66+
*
67+
* @throws {@link ServerException} (server fault)
68+
* <p>These errors are usually caused by a server issue.</p>
69+
*
70+
* @throws {@link BatchServiceException}
71+
* <p>Base exception class for all service exceptions from Batch service.</p>
72+
*
73+
* @public
74+
*/
75+
export class GetJobQueueSnapshotCommand extends $Command
76+
.classBuilder<
77+
GetJobQueueSnapshotCommandInput,
78+
GetJobQueueSnapshotCommandOutput,
79+
BatchClientResolvedConfig,
80+
ServiceInputTypes,
81+
ServiceOutputTypes
82+
>()
83+
.ep({
84+
...commonParams,
85+
})
86+
.m(function (this: any, Command: any, cs: any, config: BatchClientResolvedConfig, o: any) {
87+
return [
88+
getSerdePlugin(config, this.serialize, this.deserialize),
89+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
90+
];
91+
})
92+
.s("AWSBatchV20160810", "GetJobQueueSnapshot", {})
93+
.n("BatchClient", "GetJobQueueSnapshotCommand")
94+
.f(void 0, void 0)
95+
.ser(se_GetJobQueueSnapshotCommand)
96+
.de(de_GetJobQueueSnapshotCommand)
97+
.build() {}

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

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export * from "./DescribeJobDefinitionsCommand";
1212
export * from "./DescribeJobQueuesCommand";
1313
export * from "./DescribeJobsCommand";
1414
export * from "./DescribeSchedulingPoliciesCommand";
15+
export * from "./GetJobQueueSnapshotCommand";
1516
export * from "./ListJobsCommand";
1617
export * from "./ListSchedulingPoliciesCommand";
1718
export * from "./ListTagsForResourceCommand";

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

+75-7
Original file line numberDiff line numberDiff line change
@@ -5629,6 +5629,64 @@ export interface DescribeSchedulingPoliciesResponse {
56295629
schedulingPolicies?: SchedulingPolicyDetail[];
56305630
}
56315631

5632+
/**
5633+
* @public
5634+
*/
5635+
export interface GetJobQueueSnapshotRequest {
5636+
/**
5637+
* <p>The job queue’s name or full queue Amazon Resource Name (ARN).</p>
5638+
* @public
5639+
*/
5640+
jobQueue: string | undefined;
5641+
}
5642+
5643+
/**
5644+
* <p>An object that represents summary details for the first 100 <code>RUNNABLE</code> jobs in a job queue.</p>
5645+
* @public
5646+
*/
5647+
export interface FrontOfQueueJobSummary {
5648+
/**
5649+
* <p>The ARN for a job in a named job queue.</p>
5650+
* @public
5651+
*/
5652+
jobArn?: string;
5653+
5654+
/**
5655+
* <p>The Unix timestamp (in milliseconds) for when the job transitioned to its current position in the job queue.</p>
5656+
* @public
5657+
*/
5658+
earliestTimeAtPosition?: number;
5659+
}
5660+
5661+
/**
5662+
* <p>Contains a list of the first 100 <code>RUNNABLE</code> jobs associated to a single job queue.</p>
5663+
* @public
5664+
*/
5665+
export interface FrontOfQueueDetail {
5666+
/**
5667+
* <p>The Amazon Resource Names (ARNs) of the first 100 <code>RUNNABLE</code> jobs in a named job queue. For first-in-first-out (FIFO) job queues, jobs are ordered based on their submission time. For fair share scheduling (FSS) job queues, jobs are ordered based on their job priority and share usage.</p>
5668+
* @public
5669+
*/
5670+
jobs?: FrontOfQueueJobSummary[];
5671+
5672+
/**
5673+
* <p>The Unix timestamp (in milliseconds) for when each of the first 100 <code>RUNNABLE</code> jobs were last updated. </p>
5674+
* @public
5675+
*/
5676+
lastUpdatedAt?: number;
5677+
}
5678+
5679+
/**
5680+
* @public
5681+
*/
5682+
export interface GetJobQueueSnapshotResponse {
5683+
/**
5684+
* <p>The list of the first 100 <code>RUNNABLE</code> jobs in each job queue. For first-in-first-out (FIFO) job queues, jobs are ordered based on their submission time. For fair share scheduling (FSS) job queues, jobs are ordered based on their job priority and share usage.</p>
5685+
* @public
5686+
*/
5687+
frontOfQueue?: FrontOfQueueDetail;
5688+
}
5689+
56325690
/**
56335691
* <p>A filter name and value pair that's used to return a more specific list of results from a
56345692
* <code>ListJobs</code> API operation.</p>
@@ -5683,13 +5741,23 @@ export interface ListJobsRequest {
56835741
jobStatus?: JobStatus;
56845742

56855743
/**
5686-
* <p>The maximum number of results returned by <code>ListJobs</code> in paginated output. When
5687-
* this parameter is used, <code>ListJobs</code> only returns <code>maxResults</code> results in
5688-
* a single page and a <code>nextToken</code> response element. The remaining results of the
5689-
* initial request can be seen by sending another <code>ListJobs</code> request with the returned
5690-
* <code>nextToken</code> value. This value can be between 1 and
5691-
* 100. If this parameter isn't used, then <code>ListJobs</code> returns up to
5692-
* 100 results and a <code>nextToken</code> value if applicable.</p>
5744+
* <p>The maximum number of results returned by <code>ListJobs</code> in a paginated output. When this parameter is used, <code>ListJobs</code> returns up to <code>maxResults</code> results in a single page and a <code>nextToken</code> response element, if applicable. The remaining results of the initial request can be seen by sending another <code>ListJobs</code> request with the returned <code>nextToken</code> value.</p>
5745+
* <p>The following outlines key parameters and limitations:</p>
5746+
* <ul>
5747+
* <li>
5748+
* <p>The minimum value is 1. </p>
5749+
* </li>
5750+
* <li>
5751+
* <p>When <code>--job-status</code> is used, Batch returns up to 1000 values. </p>
5752+
* </li>
5753+
* <li>
5754+
* <p>When <code>--filters</code> is used, Batch returns up to 100 values.</p>
5755+
* </li>
5756+
* <li>
5757+
* <p>If neither parameter is used, then <code>ListJobs</code> returns up to
5758+
* 1000 results (jobs that are in the <code>RUNNING</code> status) and a <code>nextToken</code> value, if applicable.</p>
5759+
* </li>
5760+
* </ul>
56935761
* @public
56945762
*/
56955763
maxResults?: number;

clients/client-batch/src/protocols/Aws_restJson1.ts

+53
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ import {
6363
DescribeSchedulingPoliciesCommandInput,
6464
DescribeSchedulingPoliciesCommandOutput,
6565
} from "../commands/DescribeSchedulingPoliciesCommand";
66+
import {
67+
GetJobQueueSnapshotCommandInput,
68+
GetJobQueueSnapshotCommandOutput,
69+
} from "../commands/GetJobQueueSnapshotCommand";
6670
import { ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand";
6771
import {
6872
ListSchedulingPoliciesCommandInput,
@@ -473,6 +477,28 @@ export const se_DescribeSchedulingPoliciesCommand = async (
473477
return b.build();
474478
};
475479

480+
/**
481+
* serializeAws_restJson1GetJobQueueSnapshotCommand
482+
*/
483+
export const se_GetJobQueueSnapshotCommand = async (
484+
input: GetJobQueueSnapshotCommandInput,
485+
context: __SerdeContext
486+
): Promise<__HttpRequest> => {
487+
const b = rb(input, context);
488+
const headers: any = {
489+
"content-type": "application/json",
490+
};
491+
b.bp("/v1/getjobqueuesnapshot");
492+
let body: any;
493+
body = JSON.stringify(
494+
take(input, {
495+
jobQueue: [],
496+
})
497+
);
498+
b.m("POST").h(headers).b(body);
499+
return b.build();
500+
};
501+
476502
/**
477503
* serializeAws_restJson1ListJobsCommand
478504
*/
@@ -1015,6 +1041,27 @@ export const de_DescribeSchedulingPoliciesCommand = async (
10151041
return contents;
10161042
};
10171043

1044+
/**
1045+
* deserializeAws_restJson1GetJobQueueSnapshotCommand
1046+
*/
1047+
export const de_GetJobQueueSnapshotCommand = async (
1048+
output: __HttpResponse,
1049+
context: __SerdeContext
1050+
): Promise<GetJobQueueSnapshotCommandOutput> => {
1051+
if (output.statusCode !== 200 && output.statusCode >= 300) {
1052+
return de_CommandError(output, context);
1053+
}
1054+
const contents: any = map({
1055+
$metadata: deserializeMetadata(output),
1056+
});
1057+
const data: Record<string, any> = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1058+
const doc = take(data, {
1059+
frontOfQueue: _json,
1060+
});
1061+
Object.assign(contents, doc);
1062+
return contents;
1063+
};
1064+
10181065
/**
10191066
* deserializeAws_restJson1ListJobsCommand
10201067
*/
@@ -1676,6 +1723,12 @@ const de_FairsharePolicy = (output: any, context: __SerdeContext): FairsharePoli
16761723

16771724
// de_FargatePlatformConfiguration omitted.
16781725

1726+
// de_FrontOfQueueDetail omitted.
1727+
1728+
// de_FrontOfQueueJobSummary omitted.
1729+
1730+
// de_FrontOfQueueJobSummaryList omitted.
1731+
16791732
// de_Host omitted.
16801733

16811734
// de_ImagePullSecret omitted.

0 commit comments

Comments
 (0)