diff --git a/clients/client-mwaa/README.md b/clients/client-mwaa/README.md index 7feeec27788c2..5d6df153bbf0c 100644 --- a/clients/client-mwaa/README.md +++ b/clients/client-mwaa/README.md @@ -73,6 +73,11 @@ AWS SDK for JavaScript MWAA Client for Node.js, Browser and React Native. CreateWebLoginToken
++ * InvokeRestApi + *
+ *+ * InvokeRestApi + *
+ *Creates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
+ *Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-mwaa/src/commands/DeleteEnvironmentCommand.ts b/clients/client-mwaa/src/commands/DeleteEnvironmentCommand.ts index 164d5c1e0c57d..7f97153098970 100644 --- a/clients/client-mwaa/src/commands/DeleteEnvironmentCommand.ts +++ b/clients/client-mwaa/src/commands/DeleteEnvironmentCommand.ts @@ -28,7 +28,7 @@ export interface DeleteEnvironmentCommandInput extends DeleteEnvironmentInput {} export interface DeleteEnvironmentCommandOutput extends DeleteEnvironmentOutput, __MetadataBearer {} /** - *Deletes an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
+ *Deletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-mwaa/src/commands/InvokeRestApiCommand.ts b/clients/client-mwaa/src/commands/InvokeRestApiCommand.ts new file mode 100644 index 0000000000000..1f6d4fe2af353 --- /dev/null +++ b/clients/client-mwaa/src/commands/InvokeRestApiCommand.ts @@ -0,0 +1,152 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { + InvokeRestApiRequest, + InvokeRestApiRequestFilterSensitiveLog, + InvokeRestApiResponse, + InvokeRestApiResponseFilterSensitiveLog, +} from "../models/models_0"; +import { MWAAClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../MWAAClient"; +import { de_InvokeRestApiCommand, se_InvokeRestApiCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link InvokeRestApiCommand}. + */ +export interface InvokeRestApiCommandInput extends InvokeRestApiRequest {} +/** + * @public + * + * The output of {@link InvokeRestApiCommand}. + */ +export interface InvokeRestApiCommandOutput extends InvokeRestApiResponse, __MetadataBearer {} + +/** + *Invokes the Apache Airflow REST API on the webserver with the specified inputs. To + * learn more, see Using the Apache Airflow REST API + *
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { MWAAClient, InvokeRestApiCommand } from "@aws-sdk/client-mwaa"; // ES Modules import + * // const { MWAAClient, InvokeRestApiCommand } = require("@aws-sdk/client-mwaa"); // CommonJS import + * const client = new MWAAClient(config); + * const input = { // InvokeRestApiRequest + * Name: "STRING_VALUE", // required + * Path: "STRING_VALUE", // required + * Method: "STRING_VALUE", // required + * QueryParameters: "DOCUMENT_VALUE", + * Body: "DOCUMENT_VALUE", + * }; + * const command = new InvokeRestApiCommand(input); + * const response = await client.send(command); + * // { // InvokeRestApiResponse + * // RestApiStatusCode: Number("int"), + * // RestApiResponse: "DOCUMENT_VALUE", + * // }; + * + * ``` + * + * @param InvokeRestApiCommandInput - {@link InvokeRestApiCommandInput} + * @returns {@link InvokeRestApiCommandOutput} + * @see {@link InvokeRestApiCommandInput} for command's `input` shape. + * @see {@link InvokeRestApiCommandOutput} for command's `response` shape. + * @see {@link MWAAClientResolvedConfig | config} for MWAAClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *Access to the Apache Airflow Web UI or CLI has been denied due to insufficient permissions. To learn more, see Accessing an Amazon MWAA environment.
+ * + * @throws {@link InternalServerException} (server fault) + *InternalServerException: An internal error has occurred.
+ * + * @throws {@link ResourceNotFoundException} (client fault) + *ResourceNotFoundException: The resource is not available.
+ * + * @throws {@link RestApiClientException} (client fault) + *An exception indicating that a client-side error occurred during the Apache Airflow + * REST API call.
+ * + * @throws {@link RestApiServerException} (client fault) + *An exception indicating that a server-side error occurred during the Apache Airflow + * REST API call.
+ * + * @throws {@link ValidationException} (client fault) + *ValidationException: The provided input is not valid.
+ * + * @throws {@link MWAAServiceException} + *Base exception class for all service exceptions from MWAA service.
+ * + * @public + * @example Listing Airflow variables. + * ```javascript + * // + * const input = { + * "Method": "GET", + * "Name": "MyEnvironment", + * "Path": "/variables" + * }; + * const command = new InvokeRestApiCommand(input); + * const response = await client.send(command); + * /* response == + * { + * "RestApiResponse": { + * "total_entries": 1, + * "variables": [ + * { + * "key": "test-variable", + * "value": "123", + * "description": "Example variable" + * } + * ] + * }, + * "RestApiStatusCode": 200 + * } + * *\/ + * // example id: example-1 + * ``` + * + */ +export class InvokeRestApiCommand extends $Command + .classBuilder< + InvokeRestApiCommandInput, + InvokeRestApiCommandOutput, + MWAAClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: MWAAClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonMWAA", "InvokeRestApi", {}) + .n("MWAAClient", "InvokeRestApiCommand") + .f(InvokeRestApiRequestFilterSensitiveLog, InvokeRestApiResponseFilterSensitiveLog) + .ser(se_InvokeRestApiCommand) + .de(de_InvokeRestApiCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: InvokeRestApiRequest; + output: InvokeRestApiResponse; + }; + sdk: { + input: InvokeRestApiCommandInput; + output: InvokeRestApiCommandOutput; + }; + }; +} diff --git a/clients/client-mwaa/src/commands/index.ts b/clients/client-mwaa/src/commands/index.ts index d41b073239fa2..f41c9e96afadd 100644 --- a/clients/client-mwaa/src/commands/index.ts +++ b/clients/client-mwaa/src/commands/index.ts @@ -4,6 +4,7 @@ export * from "./CreateEnvironmentCommand"; export * from "./CreateWebLoginTokenCommand"; export * from "./DeleteEnvironmentCommand"; export * from "./GetEnvironmentCommand"; +export * from "./InvokeRestApiCommand"; export * from "./ListEnvironmentsCommand"; export * from "./ListTagsForResourceCommand"; export * from "./PublishMetricsCommand"; diff --git a/clients/client-mwaa/src/index.ts b/clients/client-mwaa/src/index.ts index 6f7645ed44924..926dad7d99995 100644 --- a/clients/client-mwaa/src/index.ts +++ b/clients/client-mwaa/src/index.ts @@ -67,6 +67,11 @@ * CreateWebLoginToken * * + *+ * InvokeRestApi + *
+ *This section contains the Amazon Managed Workflows for Apache Airflow (MWAA) API reference documentation to create an environment. For more information, see Get started with Amazon Managed Workflows for Apache Airflow.
+ *This section contains the Amazon Managed Workflows for Apache Airflow (Amazon MWAA) API reference documentation to create an environment. For more information, see Get started with Amazon Managed Workflows for Apache Airflow.
* @public */ export interface CreateEnvironmentInput { @@ -303,10 +305,10 @@ export interface CreateEnvironmentInput { /** *The Apache Airflow version for your environment. If no value is specified, it defaults to the latest version. - * For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (MWAA).
- *Valid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
- * 2.8.1
- *
Valid values: 1.10.12
, 2.0.2
, 2.2.2
,
+ * 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,
+ * 2.8.1
, 2.9.2
, and 2.10.1
.
The Apache Airflow version on your environment.
- *Valid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
, 2.8.1
.
Valid values: 1.10.12
, 2.0.2
, 2.2.2
,
+ * 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,
+ * 2.8.1
, 2.9.2
, and 2.10.1
.
The name of the Amazon MWAA environment. For example, MyMWAAEnvironment
.
The Apache Airflow REST API endpoint path to be called. For example,
+ * /dags/123456/clearTaskInstances
. For more information, see Apache Airflow API
+ *
The HTTP method used for making Airflow REST API calls. For example,
+ * POST
.
Query parameters to be included in the Apache Airflow REST API call, provided as a + * JSON object.
+ * @public + */ + QueryParameters?: __DocumentType; + + /** + *The request body for the Apache Airflow REST API call, provided as a JSON + * object.
+ * @public + */ + Body?: __DocumentType; +} + +/** + * @public + */ +export interface InvokeRestApiResponse { + /** + *The HTTP status code returned by the Apache Airflow REST API call.
+ * @public + */ + RestApiStatusCode?: number; + + /** + *The response data from the Apache Airflow REST API call, provided as a JSON + * object.
+ * @public + */ + RestApiResponse?: __DocumentType; +} + +/** + *An exception indicating that a client-side error occurred during the Apache Airflow + * REST API call.
+ * @public + */ +export class RestApiClientException extends __BaseException { + readonly name: "RestApiClientException" = "RestApiClientException"; + readonly $fault: "client" = "client"; + /** + *The HTTP status code returned by the Apache Airflow REST API call.
+ * @public + */ + RestApiStatusCode?: number; + + /** + *The error response data from the Apache Airflow REST API call, provided as a JSON + * object.
+ * @public + */ + RestApiResponse?: __DocumentType; + /** + * @internal + */ + constructor(opts: __ExceptionOptionTypeAn exception indicating that a server-side error occurred during the Apache Airflow + * REST API call.
+ * @public + */ +export class RestApiServerException extends __BaseException { + readonly name: "RestApiServerException" = "RestApiServerException"; + readonly $fault: "client" = "client"; + /** + *The HTTP status code returned by the Apache Airflow REST API call.
+ * @public + */ + RestApiStatusCode?: number; + + /** + *The error response data from the Apache Airflow REST API call, provided as a JSON + * object.
+ * @public + */ + RestApiResponse?: __DocumentType; + /** + * @internal + */ + constructor(opts: __ExceptionOptionTypeThe Apache Airflow version for your environment. To upgrade your environment, specify a newer version of Apache Airflow supported by Amazon MWAA.
*Before you upgrade an environment, make sure your requirements, DAGs, plugins, and other resources used in your workflows are compatible with the new Apache Airflow version. For more information about updating * your resources, see Upgrading an Amazon MWAA environment.
- *Valid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
, 2.8.1
.
Valid values: 1.10.12
, 2.0.2
, 2.2.2
,
+ * 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,
+ * 2.8.1
, 2.9.2
, and 2.10.1
.
This section contains the Amazon Managed Workflows for Apache Airflow (MWAA) API reference documentation. For more information, see What is Amazon MWAA?.
\n\n Endpoints\n
\n\n api.airflow.{region}.amazonaws.com
- This endpoint is used for environment management.
\n CreateEnvironment\n
\n\n DeleteEnvironment\n
\n\n GetEnvironment\n
\n\n ListEnvironments\n
\n\n ListTagsForResource\n
\n\n TagResource\n
\n\n UntagResource\n
\n\n UpdateEnvironment\n
\n\n env.airflow.{region}.amazonaws.com
- This endpoint is used to operate the Airflow environment.
\n CreateCliToken\n
\n\n CreateWebLoginToken\n
\n\n Regions\n
\nFor a list of supported regions, see Amazon MWAA endpoints and quotas in the Amazon Web Services General Reference.
", + "smithy.api#documentation": "This section contains the Amazon Managed Workflows for Apache Airflow (MWAA) API reference documentation. For more information, see What is Amazon MWAA?.
\n\n Endpoints\n
\n\n api.airflow.{region}.amazonaws.com
- This endpoint is used for environment management.
\n CreateEnvironment\n
\n\n DeleteEnvironment\n
\n\n GetEnvironment\n
\n\n ListEnvironments\n
\n\n ListTagsForResource\n
\n\n TagResource\n
\n\n UntagResource\n
\n\n UpdateEnvironment\n
\n\n env.airflow.{region}.amazonaws.com
- This endpoint is used to operate the Airflow environment.
\n CreateCliToken\n
\n\n CreateWebLoginToken\n
\n\n InvokeRestApi\n
\n\n Regions\n
\nFor a list of supported regions, see Amazon MWAA endpoints and quotas in the Amazon Web Services General Reference.
", "smithy.api#title": "AmazonMWAA", "smithy.rules#endpointRuleSet": { "version": "1.0", @@ -1019,7 +1022,7 @@ } ], "traits": { - "smithy.api#documentation": "Creates an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
", + "smithy.api#documentation": "Creates an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
", "smithy.api#endpoint": { "hostPrefix": "api." }, @@ -1133,7 +1136,7 @@ "AirflowVersion": { "target": "com.amazonaws.mwaa#AirflowVersion", "traits": { - "smithy.api#documentation": "The Apache Airflow version for your environment. If no value is specified, it defaults to the latest version.\n For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (MWAA).
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
\n 2.8.1
\n
The Apache Airflow version for your environment. If no value is specified, it defaults to the latest version.\n For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (Amazon MWAA).
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
,\n 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,\n 2.8.1
, 2.9.2
, and 2.10.1
.
This section contains the Amazon Managed Workflows for Apache Airflow (MWAA) API reference documentation to create an environment. For more information, see Get started with Amazon Managed Workflows for Apache Airflow.
" + "smithy.api#documentation": "This section contains the Amazon Managed Workflows for Apache Airflow (Amazon MWAA) API reference documentation to create an environment. For more information, see Get started with Amazon Managed Workflows for Apache Airflow.
" } }, "com.amazonaws.mwaa#CreateEnvironmentOutput": { @@ -1306,7 +1309,7 @@ } ], "traits": { - "smithy.api#documentation": "Deletes an Amazon Managed Workflows for Apache Airflow (MWAA) environment.
", + "smithy.api#documentation": "Deletes an Amazon Managed Workflows for Apache Airflow (Amazon MWAA) environment.
", "smithy.api#endpoint": { "hostPrefix": "api." }, @@ -1440,7 +1443,7 @@ "AirflowVersion": { "target": "com.amazonaws.mwaa#AirflowVersion", "traits": { - "smithy.api#documentation": "The Apache Airflow version on your environment.
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
, 2.8.1
.
The Apache Airflow version on your environment.
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
,\n 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,\n 2.8.1
, 2.9.2
, and 2.10.1
.
Invokes the Apache Airflow REST API on the webserver with the specified inputs. To\n learn more, see Using the Apache Airflow REST API\n
", + "smithy.api#endpoint": { + "hostPrefix": "env." + }, + "smithy.api#examples": [ + { + "title": "Listing Airflow variables.", + "input": { + "Name": "MyEnvironment", + "Path": "/variables", + "Method": "GET" + }, + "output": { + "RestApiStatusCode": 200, + "RestApiResponse": { + "total_entries": 1, + "variables": [ + { + "description": "Example variable", + "key": "test-variable", + "value": "123" + } + ] + } + } + } + ], + "smithy.api#http": { + "uri": "/restapi/{Name}", + "method": "POST", + "code": 200 + } + } + }, + "com.amazonaws.mwaa#InvokeRestApiRequest": { + "type": "structure", + "members": { + "Name": { + "target": "com.amazonaws.mwaa#EnvironmentName", + "traits": { + "smithy.api#documentation": "The name of the Amazon MWAA environment. For example, MyMWAAEnvironment
.
The Apache Airflow REST API endpoint path to be called. For example,\n /dags/123456/clearTaskInstances
. For more information, see Apache Airflow API\n
The HTTP method used for making Airflow REST API calls. For example,\n POST
.
Query parameters to be included in the Apache Airflow REST API call, provided as a\n JSON object.
" + } + }, + "Body": { + "target": "com.amazonaws.mwaa#RestApiRequestBody", + "traits": { + "smithy.api#documentation": "The request body for the Apache Airflow REST API call, provided as a JSON\n object.
" + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.mwaa#InvokeRestApiResponse": { + "type": "structure", + "members": { + "RestApiStatusCode": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "The HTTP status code returned by the Apache Airflow REST API call.
" + } + }, + "RestApiResponse": { + "target": "com.amazonaws.mwaa#RestApiResponse", + "traits": { + "smithy.api#documentation": "The response data from the Apache Airflow REST API call, provided as a JSON\n object.
" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.mwaa#KmsKey": { "type": "string", "traits": { @@ -2329,6 +2458,98 @@ "smithy.api#httpError": 404 } }, + "com.amazonaws.mwaa#RestApiClientException": { + "type": "structure", + "members": { + "RestApiStatusCode": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "The HTTP status code returned by the Apache Airflow REST API call.
" + } + }, + "RestApiResponse": { + "target": "com.amazonaws.mwaa#RestApiResponse", + "traits": { + "smithy.api#documentation": "The error response data from the Apache Airflow REST API call, provided as a JSON\n object.
" + } + } + }, + "traits": { + "smithy.api#documentation": "An exception indicating that a client-side error occurred during the Apache Airflow\n REST API call.
", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.mwaa#RestApiMethod": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "GET", + "name": "GET" + }, + { + "value": "PUT", + "name": "PUT" + }, + { + "value": "POST", + "name": "POST" + }, + { + "value": "PATCH", + "name": "PATCH" + }, + { + "value": "DELETE", + "name": "DELETE" + } + ] + } + }, + "com.amazonaws.mwaa#RestApiPath": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 64 + } + } + }, + "com.amazonaws.mwaa#RestApiRequestBody": { + "type": "document", + "traits": { + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.mwaa#RestApiResponse": { + "type": "document", + "traits": { + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.mwaa#RestApiServerException": { + "type": "structure", + "members": { + "RestApiStatusCode": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "The HTTP status code returned by the Apache Airflow REST API call.
" + } + }, + "RestApiResponse": { + "target": "com.amazonaws.mwaa#RestApiResponse", + "traits": { + "smithy.api#documentation": "The error response data from the Apache Airflow REST API call, provided as a JSON\n object.
" + } + } + }, + "traits": { + "smithy.api#documentation": "An exception indicating that a server-side error occurred during the Apache Airflow\n REST API call.
", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, "com.amazonaws.mwaa#S3BucketArn": { "type": "string", "traits": { @@ -2768,7 +2989,7 @@ "AirflowVersion": { "target": "com.amazonaws.mwaa#AirflowVersion", "traits": { - "smithy.api#documentation": "The Apache Airflow version for your environment. To upgrade your environment, specify a newer version of Apache Airflow supported by Amazon MWAA.
\nBefore you upgrade an environment, make sure your requirements, DAGs, plugins, and other resources used in your workflows are compatible with the new Apache Airflow version. For more information about updating\n your resources, see Upgrading an Amazon MWAA environment.
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
, 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
, 2.8.1
.
The Apache Airflow version for your environment. To upgrade your environment, specify a newer version of Apache Airflow supported by Amazon MWAA.
\nBefore you upgrade an environment, make sure your requirements, DAGs, plugins, and other resources used in your workflows are compatible with the new Apache Airflow version. For more information about updating\n your resources, see Upgrading an Amazon MWAA environment.
\nValid values: 1.10.12
, 2.0.2
, 2.2.2
,\n 2.4.3
, 2.5.1
, 2.6.3
, 2.7.2
,\n 2.8.1
, 2.9.2
, and 2.10.1
.