Skip to content

Commit 180dd23

Browse files
author
awstools
committed
feat(client-mwaa): Introducing InvokeRestApi which allows users to invoke the Apache Airflow REST API on the webserver with the specified inputs.
1 parent aa53886 commit 180dd23

File tree

11 files changed

+735
-17
lines changed

11 files changed

+735
-17
lines changed

clients/client-mwaa/README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ AWS SDK for JavaScript MWAA Client for Node.js, Browser and React Native.
7373
<a href="https://docs.aws.amazon.com/mwaa/latest/API/API_CreateWebLoginToken.html">CreateWebLoginToken</a>
7474
</p>
7575
</li>
76+
<li>
77+
<p>
78+
<a href="https://docs.aws.amazon.com/mwaa/latest/API/API_InvokeRestApi.html">InvokeRestApi</a>
79+
</p>
80+
</li>
7681
</ul>
7782
</li>
7883
</ul>
@@ -83,7 +88,7 @@ AWS SDK for JavaScript MWAA Client for Node.js, Browser and React Native.
8388

8489
## Installing
8590

86-
To install the this package, simply type add or install @aws-sdk/client-mwaa
91+
To install this package, simply type add or install @aws-sdk/client-mwaa
8792
using your favorite package manager:
8893

8994
- `npm install @aws-sdk/client-mwaa`
@@ -315,6 +320,14 @@ GetEnvironment
315320

316321
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/mwaa/command/GetEnvironmentCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-mwaa/Interface/GetEnvironmentCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-mwaa/Interface/GetEnvironmentCommandOutput/)
317322

323+
</details>
324+
<details>
325+
<summary>
326+
InvokeRestApi
327+
</summary>
328+
329+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/mwaa/command/InvokeRestApiCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-mwaa/Interface/InvokeRestApiCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-mwaa/Interface/InvokeRestApiCommandOutput/)
330+
318331
</details>
319332
<details>
320333
<summary>

clients/client-mwaa/src/MWAA.ts

+22
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ import {
2727
GetEnvironmentCommandInput,
2828
GetEnvironmentCommandOutput,
2929
} from "./commands/GetEnvironmentCommand";
30+
import {
31+
InvokeRestApiCommand,
32+
InvokeRestApiCommandInput,
33+
InvokeRestApiCommandOutput,
34+
} from "./commands/InvokeRestApiCommand";
3035
import {
3136
ListEnvironmentsCommand,
3237
ListEnvironmentsCommandInput,
@@ -61,6 +66,7 @@ const commands = {
6166
CreateWebLoginTokenCommand,
6267
DeleteEnvironmentCommand,
6368
GetEnvironmentCommand,
69+
InvokeRestApiCommand,
6470
ListEnvironmentsCommand,
6571
ListTagsForResourceCommand,
6672
PublishMetricsCommand,
@@ -149,6 +155,17 @@ export interface MWAA {
149155
cb: (err: any, data?: GetEnvironmentCommandOutput) => void
150156
): void;
151157

158+
/**
159+
* @see {@link InvokeRestApiCommand}
160+
*/
161+
invokeRestApi(args: InvokeRestApiCommandInput, options?: __HttpHandlerOptions): Promise<InvokeRestApiCommandOutput>;
162+
invokeRestApi(args: InvokeRestApiCommandInput, cb: (err: any, data?: InvokeRestApiCommandOutput) => void): void;
163+
invokeRestApi(
164+
args: InvokeRestApiCommandInput,
165+
options: __HttpHandlerOptions,
166+
cb: (err: any, data?: InvokeRestApiCommandOutput) => void
167+
): void;
168+
152169
/**
153170
* @see {@link ListEnvironmentsCommand}
154171
*/
@@ -305,6 +322,11 @@ export interface MWAA {
305322
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_CreateWebLoginToken.html">CreateWebLoginToken</a>
306323
* </p>
307324
* </li>
325+
* <li>
326+
* <p>
327+
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_InvokeRestApi.html">InvokeRestApi</a>
328+
* </p>
329+
* </li>
308330
* </ul>
309331
* </li>
310332
* </ul>

clients/client-mwaa/src/MWAAClient.ts

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import {
6161
} from "./commands/CreateWebLoginTokenCommand";
6262
import { DeleteEnvironmentCommandInput, DeleteEnvironmentCommandOutput } from "./commands/DeleteEnvironmentCommand";
6363
import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "./commands/GetEnvironmentCommand";
64+
import { InvokeRestApiCommandInput, InvokeRestApiCommandOutput } from "./commands/InvokeRestApiCommand";
6465
import { ListEnvironmentsCommandInput, ListEnvironmentsCommandOutput } from "./commands/ListEnvironmentsCommand";
6566
import {
6667
ListTagsForResourceCommandInput,
@@ -90,6 +91,7 @@ export type ServiceInputTypes =
9091
| CreateWebLoginTokenCommandInput
9192
| DeleteEnvironmentCommandInput
9293
| GetEnvironmentCommandInput
94+
| InvokeRestApiCommandInput
9395
| ListEnvironmentsCommandInput
9496
| ListTagsForResourceCommandInput
9597
| PublishMetricsCommandInput
@@ -106,6 +108,7 @@ export type ServiceOutputTypes =
106108
| CreateWebLoginTokenCommandOutput
107109
| DeleteEnvironmentCommandOutput
108110
| GetEnvironmentCommandOutput
111+
| InvokeRestApiCommandOutput
109112
| ListEnvironmentsCommandOutput
110113
| ListTagsForResourceCommandOutput
111114
| PublishMetricsCommandOutput
@@ -351,6 +354,11 @@ export interface MWAAClientResolvedConfig extends MWAAClientResolvedConfigType {
351354
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_CreateWebLoginToken.html">CreateWebLoginToken</a>
352355
* </p>
353356
* </li>
357+
* <li>
358+
* <p>
359+
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_InvokeRestApi.html">InvokeRestApi</a>
360+
* </p>
361+
* </li>
354362
* </ul>
355363
* </li>
356364
* </ul>

clients/client-mwaa/src/commands/CreateEnvironmentCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface CreateEnvironmentCommandInput extends CreateEnvironmentInput {}
3232
export interface CreateEnvironmentCommandOutput extends CreateEnvironmentOutput, __MetadataBearer {}
3333

3434
/**
35-
* <p>Creates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.</p>
35+
* <p>Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.</p>
3636
* @example
3737
* Use a bare-bones client and the command you need to make an API call.
3838
* ```javascript

clients/client-mwaa/src/commands/DeleteEnvironmentCommand.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface DeleteEnvironmentCommandInput extends DeleteEnvironmentInput {}
2828
export interface DeleteEnvironmentCommandOutput extends DeleteEnvironmentOutput, __MetadataBearer {}
2929

3030
/**
31-
* <p>Deletes an Amazon Managed Workflows for Apache Airflow (MWAA) environment.</p>
31+
* <p>Deletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.</p>
3232
* @example
3333
* Use a bare-bones client and the command you need to make an API call.
3434
* ```javascript
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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 { commonParams } from "../endpoint/EndpointParameters";
8+
import {
9+
InvokeRestApiRequest,
10+
InvokeRestApiRequestFilterSensitiveLog,
11+
InvokeRestApiResponse,
12+
InvokeRestApiResponseFilterSensitiveLog,
13+
} from "../models/models_0";
14+
import { MWAAClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../MWAAClient";
15+
import { de_InvokeRestApiCommand, se_InvokeRestApiCommand } from "../protocols/Aws_restJson1";
16+
17+
/**
18+
* @public
19+
*/
20+
export type { __MetadataBearer };
21+
export { $Command };
22+
/**
23+
* @public
24+
*
25+
* The input for {@link InvokeRestApiCommand}.
26+
*/
27+
export interface InvokeRestApiCommandInput extends InvokeRestApiRequest {}
28+
/**
29+
* @public
30+
*
31+
* The output of {@link InvokeRestApiCommand}.
32+
*/
33+
export interface InvokeRestApiCommandOutput extends InvokeRestApiResponse, __MetadataBearer {}
34+
35+
/**
36+
* <p>Invokes the Apache Airflow REST API on the webserver with the specified inputs. To
37+
* learn more, see <a href="https://docs.aws.amazon.com/mwaa/latest/userguide/access-mwaa-apache-airflow-rest-api.html">Using the Apache Airflow REST API</a>
38+
* </p>
39+
* @example
40+
* Use a bare-bones client and the command you need to make an API call.
41+
* ```javascript
42+
* import { MWAAClient, InvokeRestApiCommand } from "@aws-sdk/client-mwaa"; // ES Modules import
43+
* // const { MWAAClient, InvokeRestApiCommand } = require("@aws-sdk/client-mwaa"); // CommonJS import
44+
* const client = new MWAAClient(config);
45+
* const input = { // InvokeRestApiRequest
46+
* Name: "STRING_VALUE", // required
47+
* Path: "STRING_VALUE", // required
48+
* Method: "STRING_VALUE", // required
49+
* QueryParameters: "DOCUMENT_VALUE",
50+
* Body: "DOCUMENT_VALUE",
51+
* };
52+
* const command = new InvokeRestApiCommand(input);
53+
* const response = await client.send(command);
54+
* // { // InvokeRestApiResponse
55+
* // RestApiStatusCode: Number("int"),
56+
* // RestApiResponse: "DOCUMENT_VALUE",
57+
* // };
58+
*
59+
* ```
60+
*
61+
* @param InvokeRestApiCommandInput - {@link InvokeRestApiCommandInput}
62+
* @returns {@link InvokeRestApiCommandOutput}
63+
* @see {@link InvokeRestApiCommandInput} for command's `input` shape.
64+
* @see {@link InvokeRestApiCommandOutput} for command's `response` shape.
65+
* @see {@link MWAAClientResolvedConfig | config} for MWAAClient's `config` shape.
66+
*
67+
* @throws {@link AccessDeniedException} (client fault)
68+
* <p>Access to the Apache Airflow Web UI or CLI has been denied due to insufficient permissions. To learn more, see <a href="https://docs.aws.amazon.com/mwaa/latest/userguide/access-policies.html">Accessing an Amazon MWAA environment</a>.</p>
69+
*
70+
* @throws {@link InternalServerException} (server fault)
71+
* <p>InternalServerException: An internal error has occurred.</p>
72+
*
73+
* @throws {@link ResourceNotFoundException} (client fault)
74+
* <p>ResourceNotFoundException: The resource is not available.</p>
75+
*
76+
* @throws {@link RestApiClientException} (client fault)
77+
* <p>An exception indicating that a client-side error occurred during the Apache Airflow
78+
* REST API call.</p>
79+
*
80+
* @throws {@link RestApiServerException} (client fault)
81+
* <p>An exception indicating that a server-side error occurred during the Apache Airflow
82+
* REST API call.</p>
83+
*
84+
* @throws {@link ValidationException} (client fault)
85+
* <p>ValidationException: The provided input is not valid.</p>
86+
*
87+
* @throws {@link MWAAServiceException}
88+
* <p>Base exception class for all service exceptions from MWAA service.</p>
89+
*
90+
* @public
91+
* @example Listing Airflow variables.
92+
* ```javascript
93+
* //
94+
* const input = {
95+
* "Method": "GET",
96+
* "Name": "MyEnvironment",
97+
* "Path": "/variables"
98+
* };
99+
* const command = new InvokeRestApiCommand(input);
100+
* const response = await client.send(command);
101+
* /* response ==
102+
* {
103+
* "RestApiResponse": {
104+
* "total_entries": 1,
105+
* "variables": [
106+
* {
107+
* "key": "test-variable",
108+
* "value": "123",
109+
* "description": "Example variable"
110+
* }
111+
* ]
112+
* },
113+
* "RestApiStatusCode": 200
114+
* }
115+
* *\/
116+
* // example id: example-1
117+
* ```
118+
*
119+
*/
120+
export class InvokeRestApiCommand extends $Command
121+
.classBuilder<
122+
InvokeRestApiCommandInput,
123+
InvokeRestApiCommandOutput,
124+
MWAAClientResolvedConfig,
125+
ServiceInputTypes,
126+
ServiceOutputTypes
127+
>()
128+
.ep(commonParams)
129+
.m(function (this: any, Command: any, cs: any, config: MWAAClientResolvedConfig, o: any) {
130+
return [
131+
getSerdePlugin(config, this.serialize, this.deserialize),
132+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
133+
];
134+
})
135+
.s("AmazonMWAA", "InvokeRestApi", {})
136+
.n("MWAAClient", "InvokeRestApiCommand")
137+
.f(InvokeRestApiRequestFilterSensitiveLog, InvokeRestApiResponseFilterSensitiveLog)
138+
.ser(se_InvokeRestApiCommand)
139+
.de(de_InvokeRestApiCommand)
140+
.build() {
141+
/** @internal type navigation helper, not in runtime. */
142+
protected declare static __types: {
143+
api: {
144+
input: InvokeRestApiRequest;
145+
output: InvokeRestApiResponse;
146+
};
147+
sdk: {
148+
input: InvokeRestApiCommandInput;
149+
output: InvokeRestApiCommandOutput;
150+
};
151+
};
152+
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from "./CreateEnvironmentCommand";
44
export * from "./CreateWebLoginTokenCommand";
55
export * from "./DeleteEnvironmentCommand";
66
export * from "./GetEnvironmentCommand";
7+
export * from "./InvokeRestApiCommand";
78
export * from "./ListEnvironmentsCommand";
89
export * from "./ListTagsForResourceCommand";
910
export * from "./PublishMetricsCommand";

clients/client-mwaa/src/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_CreateWebLoginToken.html">CreateWebLoginToken</a>
6868
* </p>
6969
* </li>
70+
* <li>
71+
* <p>
72+
* <a href="https://docs.aws.amazon.com/mwaa/latest/API/API_InvokeRestApi.html">InvokeRestApi</a>
73+
* </p>
74+
* </li>
7075
* </ul>
7176
* </li>
7277
* </ul>

0 commit comments

Comments
 (0)