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 +

    +
  • @@ -83,7 +88,7 @@ AWS SDK for JavaScript MWAA Client for Node.js, Browser and React Native. ## Installing -To install the this package, simply type add or install @aws-sdk/client-mwaa +To install this package, simply type add or install @aws-sdk/client-mwaa using your favorite package manager: - `npm install @aws-sdk/client-mwaa` @@ -315,6 +320,14 @@ GetEnvironment [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/) + +
    + +InvokeRestApi + + +[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/) +
    diff --git a/clients/client-mwaa/src/MWAA.ts b/clients/client-mwaa/src/MWAA.ts index 5d3dbd10b16dc..13ab86ba27568 100644 --- a/clients/client-mwaa/src/MWAA.ts +++ b/clients/client-mwaa/src/MWAA.ts @@ -27,6 +27,11 @@ import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput, } from "./commands/GetEnvironmentCommand"; +import { + InvokeRestApiCommand, + InvokeRestApiCommandInput, + InvokeRestApiCommandOutput, +} from "./commands/InvokeRestApiCommand"; import { ListEnvironmentsCommand, ListEnvironmentsCommandInput, @@ -61,6 +66,7 @@ const commands = { CreateWebLoginTokenCommand, DeleteEnvironmentCommand, GetEnvironmentCommand, + InvokeRestApiCommand, ListEnvironmentsCommand, ListTagsForResourceCommand, PublishMetricsCommand, @@ -149,6 +155,17 @@ export interface MWAA { cb: (err: any, data?: GetEnvironmentCommandOutput) => void ): void; + /** + * @see {@link InvokeRestApiCommand} + */ + invokeRestApi(args: InvokeRestApiCommandInput, options?: __HttpHandlerOptions): Promise; + invokeRestApi(args: InvokeRestApiCommandInput, cb: (err: any, data?: InvokeRestApiCommandOutput) => void): void; + invokeRestApi( + args: InvokeRestApiCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: InvokeRestApiCommandOutput) => void + ): void; + /** * @see {@link ListEnvironmentsCommand} */ @@ -305,6 +322,11 @@ export interface MWAA { * CreateWebLoginToken *

    * + *
  • + *

    + * InvokeRestApi + *

    + *
  • * * * diff --git a/clients/client-mwaa/src/MWAAClient.ts b/clients/client-mwaa/src/MWAAClient.ts index 6b1adb123a34b..3072c514f9ab3 100644 --- a/clients/client-mwaa/src/MWAAClient.ts +++ b/clients/client-mwaa/src/MWAAClient.ts @@ -61,6 +61,7 @@ import { } from "./commands/CreateWebLoginTokenCommand"; import { DeleteEnvironmentCommandInput, DeleteEnvironmentCommandOutput } from "./commands/DeleteEnvironmentCommand"; import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "./commands/GetEnvironmentCommand"; +import { InvokeRestApiCommandInput, InvokeRestApiCommandOutput } from "./commands/InvokeRestApiCommand"; import { ListEnvironmentsCommandInput, ListEnvironmentsCommandOutput } from "./commands/ListEnvironmentsCommand"; import { ListTagsForResourceCommandInput, @@ -90,6 +91,7 @@ export type ServiceInputTypes = | CreateWebLoginTokenCommandInput | DeleteEnvironmentCommandInput | GetEnvironmentCommandInput + | InvokeRestApiCommandInput | ListEnvironmentsCommandInput | ListTagsForResourceCommandInput | PublishMetricsCommandInput @@ -106,6 +108,7 @@ export type ServiceOutputTypes = | CreateWebLoginTokenCommandOutput | DeleteEnvironmentCommandOutput | GetEnvironmentCommandOutput + | InvokeRestApiCommandOutput | ListEnvironmentsCommandOutput | ListTagsForResourceCommandOutput | PublishMetricsCommandOutput @@ -351,6 +354,11 @@ export interface MWAAClientResolvedConfig extends MWAAClientResolvedConfigType { * CreateWebLoginToken *

    * + *
  • + *

    + * InvokeRestApi + *

    + *
  • * * * diff --git a/clients/client-mwaa/src/commands/CreateEnvironmentCommand.ts b/clients/client-mwaa/src/commands/CreateEnvironmentCommand.ts index d37ef0ac46c96..3117de4a38c46 100644 --- a/clients/client-mwaa/src/commands/CreateEnvironmentCommand.ts +++ b/clients/client-mwaa/src/commands/CreateEnvironmentCommand.ts @@ -32,7 +32,7 @@ export interface CreateEnvironmentCommandInput extends CreateEnvironmentInput {} export interface CreateEnvironmentCommandOutput extends CreateEnvironmentOutput, __MetadataBearer {} /** - *

    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 + *

    + *
  • * * * diff --git a/clients/client-mwaa/src/models/models_0.ts b/clients/client-mwaa/src/models/models_0.ts index c7baa7078447e..27ae514b306c3 100644 --- a/clients/client-mwaa/src/models/models_0.ts +++ b/clients/client-mwaa/src/models/models_0.ts @@ -1,6 +1,8 @@ // smithy-typescript generated code import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client"; +import { DocumentType as __DocumentType } from "@smithy/types"; + import { MWAAServiceException as __BaseException } from "./MWAAServiceException"; /** @@ -191,7 +193,7 @@ export const WebserverAccessMode = { export type WebserverAccessMode = (typeof WebserverAccessMode)[keyof typeof WebserverAccessMode]; /** - *

    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 - *

    + * For more information, see Apache Airflow versions on Amazon Managed Workflows for Apache Airflow (Amazon 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, 2.9.2, and 2.10.1.

    * @public */ AirflowVersion?: string; @@ -769,7 +771,9 @@ export interface Environment { /** *

    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.

    * @public */ AirflowVersion?: string; @@ -984,6 +988,151 @@ export interface GetEnvironmentOutput { Environment?: Environment; } +/** + * @public + * @enum + */ +export const RestApiMethod = { + DELETE: "DELETE", + GET: "GET", + PATCH: "PATCH", + POST: "POST", + PUT: "PUT", +} as const; + +/** + * @public + */ +export type RestApiMethod = (typeof RestApiMethod)[keyof typeof RestApiMethod]; + +/** + * @public + */ +export interface InvokeRestApiRequest { + /** + *

    The name of the Amazon MWAA environment. For example, MyMWAAEnvironment.

    + * @public + */ + Name: string | undefined; + + /** + *

    The Apache Airflow REST API endpoint path to be called. For example, + * /dags/123456/clearTaskInstances. For more information, see Apache Airflow API + *

    + * @public + */ + Path: string | undefined; + + /** + *

    The HTTP method used for making Airflow REST API calls. For example, + * POST.

    + * @public + */ + Method: RestApiMethod | undefined; + + /** + *

    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: __ExceptionOptionType) { + super({ + name: "RestApiClientException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, RestApiClientException.prototype); + this.RestApiStatusCode = opts.RestApiStatusCode; + this.RestApiResponse = opts.RestApiResponse; + } +} + +/** + *

    An 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: __ExceptionOptionType) { + super({ + name: "RestApiServerException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, RestApiServerException.prototype); + this.RestApiStatusCode = opts.RestApiStatusCode; + this.RestApiResponse = opts.RestApiResponse; + } +} + /** * @public */ @@ -1296,7 +1445,9 @@ export interface UpdateEnvironmentInput { *

    The 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.

    * @public */ AirflowVersion?: string; @@ -1499,6 +1650,22 @@ export const GetEnvironmentOutputFilterSensitiveLog = (obj: GetEnvironmentOutput ...(obj.Environment && { Environment: EnvironmentFilterSensitiveLog(obj.Environment) }), }); +/** + * @internal + */ +export const InvokeRestApiRequestFilterSensitiveLog = (obj: InvokeRestApiRequest): any => ({ + ...obj, + ...(obj.Body && { Body: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const InvokeRestApiResponseFilterSensitiveLog = (obj: InvokeRestApiResponse): any => ({ + ...obj, + ...(obj.RestApiResponse && { RestApiResponse: SENSITIVE_STRING }), +}); + /** * @internal */ diff --git a/clients/client-mwaa/src/protocols/Aws_restJson1.ts b/clients/client-mwaa/src/protocols/Aws_restJson1.ts index 3fce20d250c84..24203e5c006bd 100644 --- a/clients/client-mwaa/src/protocols/Aws_restJson1.ts +++ b/clients/client-mwaa/src/protocols/Aws_restJson1.ts @@ -24,6 +24,7 @@ import { withBaseException, } from "@smithy/smithy-client"; import { + DocumentType as __DocumentType, Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, SerdeContext as __SerdeContext, @@ -37,6 +38,7 @@ import { } from "../commands/CreateWebLoginTokenCommand"; import { DeleteEnvironmentCommandInput, DeleteEnvironmentCommandOutput } from "../commands/DeleteEnvironmentCommand"; import { GetEnvironmentCommandInput, GetEnvironmentCommandOutput } from "../commands/GetEnvironmentCommand"; +import { InvokeRestApiCommandInput, InvokeRestApiCommandOutput } from "../commands/InvokeRestApiCommand"; import { ListEnvironmentsCommandInput, ListEnvironmentsCommandOutput } from "../commands/ListEnvironmentsCommand"; import { ListTagsForResourceCommandInput, @@ -57,6 +59,8 @@ import { ModuleLoggingConfigurationInput, NetworkConfiguration, ResourceNotFoundException, + RestApiClientException, + RestApiServerException, StatisticSet, UpdateNetworkConfigurationInput, ValidationException, @@ -213,6 +217,40 @@ export const se_GetEnvironmentCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1InvokeRestApiCommand + */ +export const se_InvokeRestApiCommand = async ( + input: InvokeRestApiCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/restapi/{Name}"); + b.p("Name", () => input.Name!, "{Name}", false); + let body: any; + body = JSON.stringify( + take(input, { + Body: (_) => se_RestApiRequestBody(_, context), + Method: [], + Path: [], + QueryParameters: (_) => se_Document(_, context), + }) + ); + let { hostname: resolvedHostname } = await context.endpoint(); + if (context.disableHostPrefix !== true) { + resolvedHostname = "env." + resolvedHostname; + if (!__isValidHostname(resolvedHostname)) { + throw new Error("ValidationError: prefixed hostname must be hostname compatible."); + } + } + b.hn(resolvedHostname); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1ListEnvironmentsCommand */ @@ -509,6 +547,28 @@ export const de_GetEnvironmentCommand = async ( return contents; }; +/** + * deserializeAws_restJson1InvokeRestApiCommand + */ +export const de_InvokeRestApiCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + RestApiResponse: (_) => de_RestApiResponse(_, context), + RestApiStatusCode: __expectInt32, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1ListEnvironmentsCommand */ @@ -646,6 +706,12 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): case "AccessDeniedException": case "com.amazonaws.mwaa#AccessDeniedException": throw await de_AccessDeniedExceptionRes(parsedOutput, context); + case "RestApiClientException": + case "com.amazonaws.mwaa#RestApiClientException": + throw await de_RestApiClientExceptionRes(parsedOutput, context); + case "RestApiServerException": + case "com.amazonaws.mwaa#RestApiServerException": + throw await de_RestApiServerExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; return throwDefaultError({ @@ -717,6 +783,48 @@ const de_ResourceNotFoundExceptionRes = async ( return __decorateServiceException(exception, parsedOutput.body); }; +/** + * deserializeAws_restJson1RestApiClientExceptionRes + */ +const de_RestApiClientExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: any = map({}); + const data: any = parsedOutput.body; + const doc = take(data, { + RestApiResponse: (_) => de_RestApiResponse(_, context), + RestApiStatusCode: __expectInt32, + }); + Object.assign(contents, doc); + const exception = new RestApiClientException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents, + }); + return __decorateServiceException(exception, parsedOutput.body); +}; + +/** + * deserializeAws_restJson1RestApiServerExceptionRes + */ +const de_RestApiServerExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const contents: any = map({}); + const data: any = parsedOutput.body; + const doc = take(data, { + RestApiResponse: (_) => de_RestApiResponse(_, context), + RestApiStatusCode: __expectInt32, + }); + Object.assign(contents, doc); + const exception = new RestApiServerException({ + $metadata: deserializeMetadata(parsedOutput), + ...contents, + }); + return __decorateServiceException(exception, parsedOutput.body); +}; + /** * deserializeAws_restJson1ValidationExceptionRes */ @@ -771,6 +879,13 @@ const se_MetricDatum = (input: MetricDatum, context: __SerdeContext): any => { // se_NetworkConfiguration omitted. +/** + * serializeAws_restJson1RestApiRequestBody + */ +const se_RestApiRequestBody = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + // se_SecurityGroupList omitted. /** @@ -791,6 +906,13 @@ const se_StatisticSet = (input: StatisticSet, context: __SerdeContext): any => { // se_UpdateNetworkConfigurationInput omitted. +/** + * serializeAws_restJson1Document + */ +const se_Document = (input: __DocumentType, context: __SerdeContext): any => { + return input; +}; + // de_AirflowConfigurationOptions omitted. /** @@ -855,6 +977,13 @@ const de_LastUpdate = (output: any, context: __SerdeContext): LastUpdate => { // de_NetworkConfiguration omitted. +/** + * deserializeAws_restJson1RestApiResponse + */ +const de_RestApiResponse = (output: any, context: __SerdeContext): __DocumentType => { + return output; +}; + // de_SecurityGroupList omitted. // de_SubnetList omitted. diff --git a/codegen/sdk-codegen/aws-models/mwaa.json b/codegen/sdk-codegen/aws-models/mwaa.json index 35d20ae7d1a8c..b38420fa188ce 100644 --- a/codegen/sdk-codegen/aws-models/mwaa.json +++ b/codegen/sdk-codegen/aws-models/mwaa.json @@ -64,6 +64,9 @@ { "target": "com.amazonaws.mwaa#GetEnvironment" }, + { + "target": "com.amazonaws.mwaa#InvokeRestApi" + }, { "target": "com.amazonaws.mwaa#ListEnvironments" }, @@ -92,7 +95,7 @@ "name": "airflow" }, "aws.protocols#restJson1": {}, - "smithy.api#documentation": "Amazon Managed Workflows for Apache Airflow\n

    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

    \n Regions\n

    \n

    For a list of supported regions, see Amazon MWAA endpoints and quotas in the Amazon Web Services General Reference.

    ", + "smithy.api#documentation": "Amazon Managed Workflows for Apache Airflow\n

    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

    \n Regions\n

    \n

    For 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).

    \n

    Valid 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

    " + "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 (Amazon MWAA).

    \n

    Valid 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.

    " } }, "LoggingConfiguration": { @@ -1192,7 +1195,7 @@ } }, "traits": { - "smithy.api#documentation": "

    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.

    \n

    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.

    " + "smithy.api#documentation": "

    The Apache Airflow version on your environment.

    \n

    Valid 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.

    " } }, "SourceBucketArn": { @@ -1793,6 +1796,132 @@ "smithy.api#httpError": 500 } }, + "com.amazonaws.mwaa#InvokeRestApi": { + "type": "operation", + "input": { + "target": "com.amazonaws.mwaa#InvokeRestApiRequest" + }, + "output": { + "target": "com.amazonaws.mwaa#InvokeRestApiResponse" + }, + "errors": [ + { + "target": "com.amazonaws.mwaa#AccessDeniedException" + }, + { + "target": "com.amazonaws.mwaa#InternalServerException" + }, + { + "target": "com.amazonaws.mwaa#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.mwaa#RestApiClientException" + }, + { + "target": "com.amazonaws.mwaa#RestApiServerException" + }, + { + "target": "com.amazonaws.mwaa#ValidationException" + } + ], + "traits": { + "aws.api#dataPlane": {}, + "smithy.api#documentation": "

    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.

    ", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "Path": { + "target": "com.amazonaws.mwaa#RestApiPath", + "traits": { + "smithy.api#documentation": "

    The Apache Airflow REST API endpoint path to be called. For example,\n /dags/123456/clearTaskInstances. For more information, see Apache Airflow API\n

    ", + "smithy.api#required": {} + } + }, + "Method": { + "target": "com.amazonaws.mwaa#RestApiMethod", + "traits": { + "smithy.api#documentation": "

    The HTTP method used for making Airflow REST API calls. For example,\n POST.

    ", + "smithy.api#required": {} + } + }, + "QueryParameters": { + "target": "smithy.api#Document", + "traits": { + "smithy.api#documentation": "

    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.

    \n

    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\n your resources, see Upgrading an Amazon MWAA environment.

    \n

    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.

    " + "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.

    \n

    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\n your resources, see Upgrading an Amazon MWAA environment.

    \n

    Valid 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.

    " } }, "SourceBucketArn": {