diff --git a/clients/client-resource-groups/.gitignore b/clients/client-resource-groups/.gitignore new file mode 100644 index 000000000000..b41c05b597c4 --- /dev/null +++ b/clients/client-resource-groups/.gitignore @@ -0,0 +1,14 @@ +/node_modules/ +/build/ +/coverage/ +/docs/ +/types/ +/dist/ +*.tsbuildinfo +*.tgz +*.log +package-lock.json + +*.d.ts +*.js +*.js.map diff --git a/clients/client-resource-groups/.npmignore b/clients/client-resource-groups/.npmignore new file mode 100644 index 000000000000..b7ff81137c4a --- /dev/null +++ b/clients/client-resource-groups/.npmignore @@ -0,0 +1,4 @@ +/coverage/ +/docs/ +tsconfig.test.json +*.tsbuildinfo diff --git a/clients/client-resource-groups/LICENSE b/clients/client-resource-groups/LICENSE new file mode 100644 index 000000000000..b7d2463d8cc0 --- /dev/null +++ b/clients/client-resource-groups/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/clients/client-resource-groups/README.md b/clients/client-resource-groups/README.md new file mode 100644 index 000000000000..2fdff4bf92a4 --- /dev/null +++ b/clients/client-resource-groups/README.md @@ -0,0 +1,6 @@ +@aws-sdk/client-resource-groups + +[![NPM version](https://img.shields.io/npm/v/@aws-sdk/client-resource-groups/preview.svg)](https://www.npmjs.com/package/@aws-sdk/client-resource-groups) +[![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/client-resource-groups.svg)](https://www.npmjs.com/package/@aws-sdk/client-resource-groups) + +For SDK usage, please step to [SDK reademe](https://github.com/aws/aws-sdk-js-v3). diff --git a/clients/client-resource-groups/ResourceGroups.ts b/clients/client-resource-groups/ResourceGroups.ts new file mode 100644 index 000000000000..6bcd59d94a76 --- /dev/null +++ b/clients/client-resource-groups/ResourceGroups.ts @@ -0,0 +1,545 @@ +import { ResourceGroupsClient } from "./ResourceGroupsClient"; +import { + CreateGroupCommand, + CreateGroupCommandInput, + CreateGroupCommandOutput +} from "./commands/CreateGroupCommand"; +import { + DeleteGroupCommand, + DeleteGroupCommandInput, + DeleteGroupCommandOutput +} from "./commands/DeleteGroupCommand"; +import { + GetGroupCommand, + GetGroupCommandInput, + GetGroupCommandOutput +} from "./commands/GetGroupCommand"; +import { + GetGroupQueryCommand, + GetGroupQueryCommandInput, + GetGroupQueryCommandOutput +} from "./commands/GetGroupQueryCommand"; +import { + GetTagsCommand, + GetTagsCommandInput, + GetTagsCommandOutput +} from "./commands/GetTagsCommand"; +import { + ListGroupResourcesCommand, + ListGroupResourcesCommandInput, + ListGroupResourcesCommandOutput +} from "./commands/ListGroupResourcesCommand"; +import { + ListGroupsCommand, + ListGroupsCommandInput, + ListGroupsCommandOutput +} from "./commands/ListGroupsCommand"; +import { + SearchResourcesCommand, + SearchResourcesCommandInput, + SearchResourcesCommandOutput +} from "./commands/SearchResourcesCommand"; +import { + TagCommand, + TagCommandInput, + TagCommandOutput +} from "./commands/TagCommand"; +import { + UntagCommand, + UntagCommandInput, + UntagCommandOutput +} from "./commands/UntagCommand"; +import { + UpdateGroupCommand, + UpdateGroupCommandInput, + UpdateGroupCommandOutput +} from "./commands/UpdateGroupCommand"; +import { + UpdateGroupQueryCommand, + UpdateGroupQueryCommandInput, + UpdateGroupQueryCommandOutput +} from "./commands/UpdateGroupQueryCommand"; +import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types"; + +/** + * + * AWS Resource Groups + *

AWS Resource Groups lets you organize AWS resources such as Amazon EC2 instances, + * Amazon Relational Database Service databases, and Amazon S3 buckets into groups using criteria + * that you define as tags. A resource group is a collection of resources that match the resource + * types specified in a query, and share one or more tags or portions of tags. You can create a + * group of resources based on their roles in your cloud infrastructure, lifecycle stages, + * regions, application layers, or virtually any criteria. Resource groups enable you to automate + * management tasks, such as those in AWS Systems Manager Automation documents, on tag-related + * resources in AWS Systems Manager. Groups of tagged resources also let you quickly view a + * custom console in AWS Systems Manager that shows AWS Config compliance and other monitoring + * data about member resources.

+ *

To create a resource group, build a resource query, and specify tags that identify + * the criteria that members of the group have in common. Tags are key-value pairs.

+ *

For more information about Resource Groups, see the AWS Resource Groups User + * Guide.

+ *

AWS Resource Groups uses a REST-compliant API that you can use to perform the following types of operations.

+ * + * + */ +export class ResourceGroups extends ResourceGroupsClient { + /** + * + *

Returns a list of ARNs of resources that are members of a specified resource group.

+ * + */ + public listGroupResources( + args: ListGroupResourcesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public listGroupResources( + args: ListGroupResourcesCommandInput, + cb: (err: any, data?: ListGroupResourcesCommandOutput) => void + ): void; + public listGroupResources( + args: ListGroupResourcesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ListGroupResourcesCommandOutput) => void + ): void; + public listGroupResources( + args: ListGroupResourcesCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: ListGroupResourcesCommandOutput) => void), + cb?: (err: any, data?: ListGroupResourcesCommandOutput) => void + ): Promise | void { + const command = new ListGroupResourcesCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Adds tags to a resource group with the specified ARN. Existing tags on a resource group are not changed if they are not specified in the request parameters.

+ * + */ + public tag( + args: TagCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public tag( + args: TagCommandInput, + cb: (err: any, data?: TagCommandOutput) => void + ): void; + public tag( + args: TagCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: TagCommandOutput) => void + ): void; + public tag( + args: TagCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: TagCommandOutput) => void), + cb?: (err: any, data?: TagCommandOutput) => void + ): Promise | void { + const command = new TagCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Updates an existing group with a new or changed description. You cannot update the name of a resource group.

+ * + */ + public updateGroup( + args: UpdateGroupCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public updateGroup( + args: UpdateGroupCommandInput, + cb: (err: any, data?: UpdateGroupCommandOutput) => void + ): void; + public updateGroup( + args: UpdateGroupCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: UpdateGroupCommandOutput) => void + ): void; + public updateGroup( + args: UpdateGroupCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: UpdateGroupCommandOutput) => void), + cb?: (err: any, data?: UpdateGroupCommandOutput) => void + ): Promise | void { + const command = new UpdateGroupCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Creates a group with a specified name, description, and resource query.

+ * + */ + public createGroup( + args: CreateGroupCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public createGroup( + args: CreateGroupCommandInput, + cb: (err: any, data?: CreateGroupCommandOutput) => void + ): void; + public createGroup( + args: CreateGroupCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: CreateGroupCommandOutput) => void + ): void; + public createGroup( + args: CreateGroupCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: CreateGroupCommandOutput) => void), + cb?: (err: any, data?: CreateGroupCommandOutput) => void + ): Promise | void { + const command = new CreateGroupCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Updates the resource query of a group.

+ * + */ + public updateGroupQuery( + args: UpdateGroupQueryCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public updateGroupQuery( + args: UpdateGroupQueryCommandInput, + cb: (err: any, data?: UpdateGroupQueryCommandOutput) => void + ): void; + public updateGroupQuery( + args: UpdateGroupQueryCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: UpdateGroupQueryCommandOutput) => void + ): void; + public updateGroupQuery( + args: UpdateGroupQueryCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: UpdateGroupQueryCommandOutput) => void), + cb?: (err: any, data?: UpdateGroupQueryCommandOutput) => void + ): Promise | void { + const command = new UpdateGroupQueryCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Returns a list of AWS resource identifiers that matches a specified query. The query uses the same format as a resource query in a CreateGroup or UpdateGroupQuery operation.

+ * + */ + public searchResources( + args: SearchResourcesCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public searchResources( + args: SearchResourcesCommandInput, + cb: (err: any, data?: SearchResourcesCommandOutput) => void + ): void; + public searchResources( + args: SearchResourcesCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: SearchResourcesCommandOutput) => void + ): void; + public searchResources( + args: SearchResourcesCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: SearchResourcesCommandOutput) => void), + cb?: (err: any, data?: SearchResourcesCommandOutput) => void + ): Promise | void { + const command = new SearchResourcesCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Returns a list of existing resource groups in your account.

+ * + */ + public listGroups( + args: ListGroupsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public listGroups( + args: ListGroupsCommandInput, + cb: (err: any, data?: ListGroupsCommandOutput) => void + ): void; + public listGroups( + args: ListGroupsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ListGroupsCommandOutput) => void + ): void; + public listGroups( + args: ListGroupsCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: ListGroupsCommandOutput) => void), + cb?: (err: any, data?: ListGroupsCommandOutput) => void + ): Promise | void { + const command = new ListGroupsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Deletes specified tags from a specified resource.

+ * + */ + public untag( + args: UntagCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public untag( + args: UntagCommandInput, + cb: (err: any, data?: UntagCommandOutput) => void + ): void; + public untag( + args: UntagCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: UntagCommandOutput) => void + ): void; + public untag( + args: UntagCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: UntagCommandOutput) => void), + cb?: (err: any, data?: UntagCommandOutput) => void + ): Promise | void { + const command = new UntagCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Deletes a specified resource group. Deleting a resource group does not delete resources that are members of the group; it only deletes the group structure.

+ * + */ + public deleteGroup( + args: DeleteGroupCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public deleteGroup( + args: DeleteGroupCommandInput, + cb: (err: any, data?: DeleteGroupCommandOutput) => void + ): void; + public deleteGroup( + args: DeleteGroupCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DeleteGroupCommandOutput) => void + ): void; + public deleteGroup( + args: DeleteGroupCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: DeleteGroupCommandOutput) => void), + cb?: (err: any, data?: DeleteGroupCommandOutput) => void + ): Promise | void { + const command = new DeleteGroupCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Returns the resource query associated with the specified resource group.

+ * + */ + public getGroupQuery( + args: GetGroupQueryCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public getGroupQuery( + args: GetGroupQueryCommandInput, + cb: (err: any, data?: GetGroupQueryCommandOutput) => void + ): void; + public getGroupQuery( + args: GetGroupQueryCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetGroupQueryCommandOutput) => void + ): void; + public getGroupQuery( + args: GetGroupQueryCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: GetGroupQueryCommandOutput) => void), + cb?: (err: any, data?: GetGroupQueryCommandOutput) => void + ): Promise | void { + const command = new GetGroupQueryCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Returns a list of tags that are associated with a resource group, specified by an ARN.

+ * + */ + public getTags( + args: GetTagsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public getTags( + args: GetTagsCommandInput, + cb: (err: any, data?: GetTagsCommandOutput) => void + ): void; + public getTags( + args: GetTagsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetTagsCommandOutput) => void + ): void; + public getTags( + args: GetTagsCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: GetTagsCommandOutput) => void), + cb?: (err: any, data?: GetTagsCommandOutput) => void + ): Promise | void { + const command = new GetTagsCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + + /** + * + *

Returns information about a specified resource group.

+ * + */ + public getGroup( + args: GetGroupCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public getGroup( + args: GetGroupCommandInput, + cb: (err: any, data?: GetGroupCommandOutput) => void + ): void; + public getGroup( + args: GetGroupCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: GetGroupCommandOutput) => void + ): void; + public getGroup( + args: GetGroupCommandInput, + optionsOrCb?: + | __HttpHandlerOptions + | ((err: any, data?: GetGroupCommandOutput) => void), + cb?: (err: any, data?: GetGroupCommandOutput) => void + ): Promise | void { + const command = new GetGroupCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") + throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } +} diff --git a/clients/client-resource-groups/ResourceGroupsClient.ts b/clients/client-resource-groups/ResourceGroupsClient.ts new file mode 100644 index 000000000000..14ca8f41675b --- /dev/null +++ b/clients/client-resource-groups/ResourceGroupsClient.ts @@ -0,0 +1,274 @@ +import { + CreateGroupInput, + CreateGroupOutput, + DeleteGroupInput, + DeleteGroupOutput, + GetGroupInput, + GetGroupOutput, + GetGroupQueryInput, + GetGroupQueryOutput, + GetTagsInput, + GetTagsOutput, + ListGroupResourcesInput, + ListGroupResourcesOutput, + ListGroupsInput, + ListGroupsOutput, + SearchResourcesInput, + SearchResourcesOutput, + TagInput, + TagOutput, + UntagInput, + UntagOutput, + UpdateGroupInput, + UpdateGroupOutput, + UpdateGroupQueryInput, + UpdateGroupQueryOutput +} from "./models/index"; +import { ClientDefaultValues as __ClientDefaultValues } from "./runtimeConfig"; +import { + EndpointsInputConfig, + EndpointsResolvedConfig, + RegionInputConfig, + RegionResolvedConfig, + resolveEndpointsConfig, + resolveRegionConfig +} from "@aws-sdk/config-resolver"; +import { getContentLengthPlugin } from "@aws-sdk/middleware-content-length"; +import { + HostHeaderInputConfig, + HostHeaderResolvedConfig, + getHostHeaderPlugin, + resolveHostHeaderConfig +} from "@aws-sdk/middleware-host-header"; +import { + RetryInputConfig, + RetryResolvedConfig, + getRetryPlugin, + resolveRetryConfig +} from "@aws-sdk/middleware-retry"; +import { + AwsAuthInputConfig, + AwsAuthResolvedConfig, + getAwsAuthPlugin, + resolveAwsAuthConfig +} from "@aws-sdk/middleware-signing"; +import { + UserAgentInputConfig, + UserAgentResolvedConfig, + getUserAgentPlugin, + resolveUserAgentConfig +} from "@aws-sdk/middleware-user-agent"; +import { HttpHandler as __HttpHandler } from "@aws-sdk/protocol-http"; +import { + Client as __Client, + SmithyConfiguration as __SmithyConfiguration, + SmithyResolvedConfiguration as __SmithyResolvedConfiguration +} from "@aws-sdk/smithy-client"; +import { + RegionInfoProvider, + Credentials as __Credentials, + Decoder as __Decoder, + Encoder as __Encoder, + HashConstructor as __HashConstructor, + HttpHandlerOptions as __HttpHandlerOptions, + Provider as __Provider, + StreamCollector as __StreamCollector, + UrlParser as __UrlParser +} from "@aws-sdk/types"; + +export type ServiceInputTypes = + | CreateGroupInput + | DeleteGroupInput + | GetGroupInput + | GetGroupQueryInput + | GetTagsInput + | ListGroupResourcesInput + | ListGroupsInput + | SearchResourcesInput + | TagInput + | UntagInput + | UpdateGroupInput + | UpdateGroupQueryInput; + +export type ServiceOutputTypes = + | CreateGroupOutput + | DeleteGroupOutput + | GetGroupOutput + | GetGroupQueryOutput + | GetTagsOutput + | ListGroupResourcesOutput + | ListGroupsOutput + | SearchResourcesOutput + | TagOutput + | UntagOutput + | UpdateGroupOutput + | UpdateGroupQueryOutput; + +export interface ClientDefaults + extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> { + /** + * The HTTP handler to use. Fetch in browser and Https in Nodejs. + */ + requestHandler?: __HttpHandler; + + /** + * A constructor for a class implementing the @aws-sdk/types.Hash interface + * that computes the SHA-256 HMAC or checksum of a string or binary buffer. + */ + sha256?: __HashConstructor; + + /** + * The function that will be used to convert strings into HTTP endpoints. + */ + urlParser?: __UrlParser; + + /** + * A function that can calculate the length of a request body. + */ + bodyLengthChecker?: (body: any) => number | undefined; + + /** + * A function that converts a stream into an array of bytes. + */ + streamCollector?: __StreamCollector; + + /** + * The function that will be used to convert a base64-encoded string to a byte array + */ + base64Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a base64-encoded string + */ + base64Encoder?: __Encoder; + + /** + * The function that will be used to convert a UTF8-encoded string to a byte array + */ + utf8Decoder?: __Decoder; + + /** + * The function that will be used to convert binary data to a UTF-8 encoded string + */ + utf8Encoder?: __Encoder; + + /** + * The string that will be used to populate default value in 'User-Agent' header + */ + defaultUserAgent?: string; + + /** + * The runtime environment + */ + runtime?: string; + + /** + * The service name with which to sign requests. + */ + signingName?: string; + + /** + * Default credentials provider; Not available in browser runtime + */ + credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; + + /** + * Provider function that return promise of a region string + */ + regionDefaultProvider?: (input: any) => __Provider; + + /** + * Fetch related hostname, signing name or signing region with given region. + */ + regionInfoProvider?: RegionInfoProvider; +} + +export type ResourceGroupsClientConfig = Partial< + __SmithyConfiguration<__HttpHandlerOptions> +> & + ClientDefaults & + RegionInputConfig & + EndpointsInputConfig & + AwsAuthInputConfig & + RetryInputConfig & + UserAgentInputConfig & + HostHeaderInputConfig; + +export type ResourceGroupsClientResolvedConfig = __SmithyResolvedConfiguration< + __HttpHandlerOptions +> & + Required & + RegionResolvedConfig & + EndpointsResolvedConfig & + AwsAuthResolvedConfig & + RetryResolvedConfig & + UserAgentResolvedConfig & + HostHeaderResolvedConfig; + +/** + * + * AWS Resource Groups + *

AWS Resource Groups lets you organize AWS resources such as Amazon EC2 instances, + * Amazon Relational Database Service databases, and Amazon S3 buckets into groups using criteria + * that you define as tags. A resource group is a collection of resources that match the resource + * types specified in a query, and share one or more tags or portions of tags. You can create a + * group of resources based on their roles in your cloud infrastructure, lifecycle stages, + * regions, application layers, or virtually any criteria. Resource groups enable you to automate + * management tasks, such as those in AWS Systems Manager Automation documents, on tag-related + * resources in AWS Systems Manager. Groups of tagged resources also let you quickly view a + * custom console in AWS Systems Manager that shows AWS Config compliance and other monitoring + * data about member resources.

+ *

To create a resource group, build a resource query, and specify tags that identify + * the criteria that members of the group have in common. Tags are key-value pairs.

+ *

For more information about Resource Groups, see the AWS Resource Groups User + * Guide.

+ *

AWS Resource Groups uses a REST-compliant API that you can use to perform the following types of operations.

+ *
    + *
  • + *

    Create, Read, Update, and Delete (CRUD) operations on resource groups and resource query entities

    + *
  • + *
  • + *

    Applying, editing, and removing tags from resource groups

    + *
  • + *
  • + *

    Resolving resource group member ARNs so they can be returned as search results

    + *
  • + *
  • + *

    Getting data about resources that are members of a group

    + *
  • + *
  • + *

    Searching AWS resources based on a resource query

    + *
  • + *
+ * + */ +export class ResourceGroupsClient extends __Client< + __HttpHandlerOptions, + ServiceInputTypes, + ServiceOutputTypes, + ResourceGroupsClientResolvedConfig +> { + readonly config: ResourceGroupsClientResolvedConfig; + + constructor(configuration: ResourceGroupsClientConfig) { + let _config_0 = { + ...__ClientDefaultValues, + ...configuration + }; + let _config_1 = resolveRegionConfig(_config_0); + let _config_2 = resolveEndpointsConfig(_config_1); + let _config_3 = resolveAwsAuthConfig(_config_2); + let _config_4 = resolveRetryConfig(_config_3); + let _config_5 = resolveUserAgentConfig(_config_4); + let _config_6 = resolveHostHeaderConfig(_config_5); + super(_config_6); + this.config = _config_6; + this.middlewareStack.use(getAwsAuthPlugin(this.config)); + this.middlewareStack.use(getRetryPlugin(this.config)); + this.middlewareStack.use(getUserAgentPlugin(this.config)); + this.middlewareStack.use(getContentLengthPlugin(this.config)); + this.middlewareStack.use(getHostHeaderPlugin(this.config)); + } + + destroy(): void {} +} diff --git a/clients/client-resource-groups/commands/CreateGroupCommand.ts b/clients/client-resource-groups/commands/CreateGroupCommand.ts new file mode 100644 index 000000000000..d0f377b5bb76 --- /dev/null +++ b/clients/client-resource-groups/commands/CreateGroupCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { CreateGroupInput, CreateGroupOutput } from "../models/index"; +import { + deserializeAws_restJson1_1CreateGroupCommand, + serializeAws_restJson1_1CreateGroupCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type CreateGroupCommandInput = CreateGroupInput; +export type CreateGroupCommandOutput = CreateGroupOutput; + +export class CreateGroupCommand extends $Command< + CreateGroupCommandInput, + CreateGroupCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: CreateGroupCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: CreateGroupCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1CreateGroupCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1CreateGroupCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/DeleteGroupCommand.ts b/clients/client-resource-groups/commands/DeleteGroupCommand.ts new file mode 100644 index 000000000000..2efe0e223cf2 --- /dev/null +++ b/clients/client-resource-groups/commands/DeleteGroupCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { DeleteGroupInput, DeleteGroupOutput } from "../models/index"; +import { + deserializeAws_restJson1_1DeleteGroupCommand, + serializeAws_restJson1_1DeleteGroupCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type DeleteGroupCommandInput = DeleteGroupInput; +export type DeleteGroupCommandOutput = DeleteGroupOutput; + +export class DeleteGroupCommand extends $Command< + DeleteGroupCommandInput, + DeleteGroupCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: DeleteGroupCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: DeleteGroupCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1DeleteGroupCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1DeleteGroupCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/GetGroupCommand.ts b/clients/client-resource-groups/commands/GetGroupCommand.ts new file mode 100644 index 000000000000..5ef30af33e58 --- /dev/null +++ b/clients/client-resource-groups/commands/GetGroupCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { GetGroupInput, GetGroupOutput } from "../models/index"; +import { + deserializeAws_restJson1_1GetGroupCommand, + serializeAws_restJson1_1GetGroupCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type GetGroupCommandInput = GetGroupInput; +export type GetGroupCommandOutput = GetGroupOutput; + +export class GetGroupCommand extends $Command< + GetGroupCommandInput, + GetGroupCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GetGroupCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: GetGroupCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1GetGroupCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1GetGroupCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/GetGroupQueryCommand.ts b/clients/client-resource-groups/commands/GetGroupQueryCommand.ts new file mode 100644 index 000000000000..44296fd04b3a --- /dev/null +++ b/clients/client-resource-groups/commands/GetGroupQueryCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { GetGroupQueryInput, GetGroupQueryOutput } from "../models/index"; +import { + deserializeAws_restJson1_1GetGroupQueryCommand, + serializeAws_restJson1_1GetGroupQueryCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type GetGroupQueryCommandInput = GetGroupQueryInput; +export type GetGroupQueryCommandOutput = GetGroupQueryOutput; + +export class GetGroupQueryCommand extends $Command< + GetGroupQueryCommandInput, + GetGroupQueryCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GetGroupQueryCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: GetGroupQueryCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1GetGroupQueryCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1GetGroupQueryCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/GetTagsCommand.ts b/clients/client-resource-groups/commands/GetTagsCommand.ts new file mode 100644 index 000000000000..f13bfe0c1b12 --- /dev/null +++ b/clients/client-resource-groups/commands/GetTagsCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { GetTagsInput, GetTagsOutput } from "../models/index"; +import { + deserializeAws_restJson1_1GetTagsCommand, + serializeAws_restJson1_1GetTagsCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type GetTagsCommandInput = GetTagsInput; +export type GetTagsCommandOutput = GetTagsOutput; + +export class GetTagsCommand extends $Command< + GetTagsCommandInput, + GetTagsCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: GetTagsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: GetTagsCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1GetTagsCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1GetTagsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/ListGroupResourcesCommand.ts b/clients/client-resource-groups/commands/ListGroupResourcesCommand.ts new file mode 100644 index 000000000000..65358acadd60 --- /dev/null +++ b/clients/client-resource-groups/commands/ListGroupResourcesCommand.ts @@ -0,0 +1,84 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { + ListGroupResourcesInput, + ListGroupResourcesOutput +} from "../models/index"; +import { + deserializeAws_restJson1_1ListGroupResourcesCommand, + serializeAws_restJson1_1ListGroupResourcesCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type ListGroupResourcesCommandInput = ListGroupResourcesInput; +export type ListGroupResourcesCommandOutput = ListGroupResourcesOutput; + +export class ListGroupResourcesCommand extends $Command< + ListGroupResourcesCommandInput, + ListGroupResourcesCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ListGroupResourcesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: ListGroupResourcesCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1ListGroupResourcesCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1ListGroupResourcesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/ListGroupsCommand.ts b/clients/client-resource-groups/commands/ListGroupsCommand.ts new file mode 100644 index 000000000000..728a047a53f8 --- /dev/null +++ b/clients/client-resource-groups/commands/ListGroupsCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { ListGroupsInput, ListGroupsOutput } from "../models/index"; +import { + deserializeAws_restJson1_1ListGroupsCommand, + serializeAws_restJson1_1ListGroupsCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type ListGroupsCommandInput = ListGroupsInput; +export type ListGroupsCommandOutput = ListGroupsOutput; + +export class ListGroupsCommand extends $Command< + ListGroupsCommandInput, + ListGroupsCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: ListGroupsCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: ListGroupsCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1ListGroupsCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1ListGroupsCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/SearchResourcesCommand.ts b/clients/client-resource-groups/commands/SearchResourcesCommand.ts new file mode 100644 index 000000000000..930c9c74e6c7 --- /dev/null +++ b/clients/client-resource-groups/commands/SearchResourcesCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { SearchResourcesInput, SearchResourcesOutput } from "../models/index"; +import { + deserializeAws_restJson1_1SearchResourcesCommand, + serializeAws_restJson1_1SearchResourcesCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type SearchResourcesCommandInput = SearchResourcesInput; +export type SearchResourcesCommandOutput = SearchResourcesOutput; + +export class SearchResourcesCommand extends $Command< + SearchResourcesCommandInput, + SearchResourcesCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: SearchResourcesCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: SearchResourcesCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1SearchResourcesCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1SearchResourcesCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/TagCommand.ts b/clients/client-resource-groups/commands/TagCommand.ts new file mode 100644 index 000000000000..c4300a29b123 --- /dev/null +++ b/clients/client-resource-groups/commands/TagCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { TagInput, TagOutput } from "../models/index"; +import { + deserializeAws_restJson1_1TagCommand, + serializeAws_restJson1_1TagCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type TagCommandInput = TagInput; +export type TagCommandOutput = TagOutput; + +export class TagCommand extends $Command< + TagCommandInput, + TagCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: TagCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: TagCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1TagCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1TagCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/UntagCommand.ts b/clients/client-resource-groups/commands/UntagCommand.ts new file mode 100644 index 000000000000..2b4e2a9f67f1 --- /dev/null +++ b/clients/client-resource-groups/commands/UntagCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { UntagInput, UntagOutput } from "../models/index"; +import { + deserializeAws_restJson1_1UntagCommand, + serializeAws_restJson1_1UntagCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type UntagCommandInput = UntagInput; +export type UntagCommandOutput = UntagOutput; + +export class UntagCommand extends $Command< + UntagCommandInput, + UntagCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: UntagCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: UntagCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1UntagCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1UntagCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/UpdateGroupCommand.ts b/clients/client-resource-groups/commands/UpdateGroupCommand.ts new file mode 100644 index 000000000000..1b355a17f1eb --- /dev/null +++ b/clients/client-resource-groups/commands/UpdateGroupCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { UpdateGroupInput, UpdateGroupOutput } from "../models/index"; +import { + deserializeAws_restJson1_1UpdateGroupCommand, + serializeAws_restJson1_1UpdateGroupCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type UpdateGroupCommandInput = UpdateGroupInput; +export type UpdateGroupCommandOutput = UpdateGroupOutput; + +export class UpdateGroupCommand extends $Command< + UpdateGroupCommandInput, + UpdateGroupCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: UpdateGroupCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: UpdateGroupCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1UpdateGroupCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1UpdateGroupCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/commands/UpdateGroupQueryCommand.ts b/clients/client-resource-groups/commands/UpdateGroupQueryCommand.ts new file mode 100644 index 000000000000..07271875f9ec --- /dev/null +++ b/clients/client-resource-groups/commands/UpdateGroupQueryCommand.ts @@ -0,0 +1,81 @@ +import { + ResourceGroupsClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes +} from "../ResourceGroupsClient"; +import { UpdateGroupQueryInput, UpdateGroupQueryOutput } from "../models/index"; +import { + deserializeAws_restJson1_1UpdateGroupQueryCommand, + serializeAws_restJson1_1UpdateGroupQueryCommand +} from "../protocols/Aws_restJson1_1"; +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + MiddlewareStack, + SerdeContext, + HttpHandlerOptions as __HttpHandlerOptions +} from "@aws-sdk/types"; + +export type UpdateGroupQueryCommandInput = UpdateGroupQueryInput; +export type UpdateGroupQueryCommandOutput = UpdateGroupQueryOutput; + +export class UpdateGroupQueryCommand extends $Command< + UpdateGroupQueryCommandInput, + UpdateGroupQueryCommandOutput, + ResourceGroupsClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: UpdateGroupQueryCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: ResourceGroupsClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use( + getSerdePlugin(configuration, this.serialize, this.deserialize) + ); + + const stack = clientStack.concat(this.middlewareStack); + + const handlerExecutionContext: HandlerExecutionContext = { + logger: {} as any + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize( + input: UpdateGroupQueryCommandInput, + context: SerdeContext + ): Promise<__HttpRequest> { + return serializeAws_restJson1_1UpdateGroupQueryCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: SerdeContext + ): Promise { + return deserializeAws_restJson1_1UpdateGroupQueryCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-resource-groups/endpoints.ts b/clients/client-resource-groups/endpoints.ts new file mode 100644 index 000000000000..326876df1e97 --- /dev/null +++ b/clients/client-resource-groups/endpoints.ts @@ -0,0 +1,214 @@ +import { RegionInfo, RegionInfoProvider } from "@aws-sdk/types"; + +// Partition default templates +const AWS_TEMPLATE = "resource-groups.{region}.amazonaws.com"; +const AWS_CN_TEMPLATE = "resource-groups.{region}.amazonaws.com.cn"; +const AWS_ISO_TEMPLATE = "resource-groups.{region}.c2s.ic.gov"; +const AWS_ISO_B_TEMPLATE = "resource-groups.{region}.sc2s.sgov.gov"; +const AWS_US_GOV_TEMPLATE = "resource-groups.{region}.amazonaws.com"; + +// Partition regions +const AWS_REGIONS = new Set([ + "ap-south-1", + "eu-north-1", + "eu-west-3", + "eu-west-2", + "eu-west-1", + "ap-northeast-2", + "ap-northeast-1", + "me-south-1", + "ca-central-1", + "sa-east-1", + "ap-east-1", + "ap-southeast-1", + "ap-southeast-2", + "eu-central-1", + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2" +]); +const AWS_CN_REGIONS = new Set(["cn-north-1", "cn-northwest-1"]); +const AWS_ISO_REGIONS = new Set(["us-iso-east-1"]); +const AWS_ISO_B_REGIONS = new Set(["us-isob-east-1"]); +const AWS_US_GOV_REGIONS = new Set(["us-gov-west-1", "us-gov-east-1"]); + +export const defaultRegionInfoProvider: RegionInfoProvider = ( + region: string, + options?: any +) => { + let regionInfo: RegionInfo | undefined = undefined; + switch (region) { + // First, try to match exact region names. + case "ap-east-1": + regionInfo = { + hostname: "resource-groups.ap-east-1.amazonaws.com" + }; + break; + case "ap-northeast-1": + regionInfo = { + hostname: "resource-groups.ap-northeast-1.amazonaws.com" + }; + break; + case "ap-northeast-2": + regionInfo = { + hostname: "resource-groups.ap-northeast-2.amazonaws.com" + }; + break; + case "ap-south-1": + regionInfo = { + hostname: "resource-groups.ap-south-1.amazonaws.com" + }; + break; + case "ap-southeast-1": + regionInfo = { + hostname: "resource-groups.ap-southeast-1.amazonaws.com" + }; + break; + case "ap-southeast-2": + regionInfo = { + hostname: "resource-groups.ap-southeast-2.amazonaws.com" + }; + break; + case "ca-central-1": + regionInfo = { + hostname: "resource-groups.ca-central-1.amazonaws.com" + }; + break; + case "eu-central-1": + regionInfo = { + hostname: "resource-groups.eu-central-1.amazonaws.com" + }; + break; + case "eu-north-1": + regionInfo = { + hostname: "resource-groups.eu-north-1.amazonaws.com" + }; + break; + case "eu-west-1": + regionInfo = { + hostname: "resource-groups.eu-west-1.amazonaws.com" + }; + break; + case "eu-west-2": + regionInfo = { + hostname: "resource-groups.eu-west-2.amazonaws.com" + }; + break; + case "eu-west-3": + regionInfo = { + hostname: "resource-groups.eu-west-3.amazonaws.com" + }; + break; + case "fips-us-east-1": + regionInfo = { + hostname: "resource-groups-fips.us-east-1.amazonaws.com", + signingRegion: "us-east-1" + }; + break; + case "fips-us-east-2": + regionInfo = { + hostname: "resource-groups-fips.us-east-2.amazonaws.com", + signingRegion: "us-east-2" + }; + break; + case "fips-us-gov-east-1": + regionInfo = { + hostname: "resource-groups.us-gov-east-1.amazonaws.com", + signingRegion: "us-gov-east-1" + }; + break; + case "fips-us-gov-west-1": + regionInfo = { + hostname: "resource-groups.us-gov-west-1.amazonaws.com", + signingRegion: "us-gov-west-1" + }; + break; + case "fips-us-west-1": + regionInfo = { + hostname: "resource-groups-fips.us-west-1.amazonaws.com", + signingRegion: "us-west-1" + }; + break; + case "fips-us-west-2": + regionInfo = { + hostname: "resource-groups-fips.us-west-2.amazonaws.com", + signingRegion: "us-west-2" + }; + break; + case "me-south-1": + regionInfo = { + hostname: "resource-groups.me-south-1.amazonaws.com" + }; + break; + case "sa-east-1": + regionInfo = { + hostname: "resource-groups.sa-east-1.amazonaws.com" + }; + break; + case "us-east-1": + regionInfo = { + hostname: "resource-groups.us-east-1.amazonaws.com" + }; + break; + case "us-east-2": + regionInfo = { + hostname: "resource-groups.us-east-2.amazonaws.com" + }; + break; + case "us-gov-east-1": + regionInfo = { + hostname: "resource-groups.us-gov-east-1.amazonaws.com" + }; + break; + case "us-gov-west-1": + regionInfo = { + hostname: "resource-groups.us-gov-west-1.amazonaws.com" + }; + break; + case "us-west-1": + regionInfo = { + hostname: "resource-groups.us-west-1.amazonaws.com" + }; + break; + case "us-west-2": + regionInfo = { + hostname: "resource-groups.us-west-2.amazonaws.com" + }; + break; + // Next, try to match partition endpoints. + default: + if (AWS_REGIONS.has(region)) { + regionInfo = { + hostname: AWS_TEMPLATE.replace("{region}", region) + }; + } + if (AWS_CN_REGIONS.has(region)) { + regionInfo = { + hostname: AWS_CN_TEMPLATE.replace("{region}", region) + }; + } + if (AWS_ISO_REGIONS.has(region)) { + regionInfo = { + hostname: AWS_ISO_TEMPLATE.replace("{region}", region) + }; + } + if (AWS_ISO_B_REGIONS.has(region)) { + regionInfo = { + hostname: AWS_ISO_B_TEMPLATE.replace("{region}", region) + }; + } + if (AWS_US_GOV_REGIONS.has(region)) { + regionInfo = { + hostname: AWS_US_GOV_TEMPLATE.replace("{region}", region) + }; + } + // Finally, assume it's an AWS partition endpoint. + if (regionInfo === undefined) { + regionInfo = { + hostname: AWS_TEMPLATE.replace("{region}", region) + }; + } + } + return Promise.resolve(regionInfo); +}; diff --git a/clients/client-resource-groups/index.ts b/clients/client-resource-groups/index.ts new file mode 100644 index 000000000000..7163a00b088c --- /dev/null +++ b/clients/client-resource-groups/index.ts @@ -0,0 +1,14 @@ +export * from "./ResourceGroupsClient"; +export * from "./ResourceGroups"; +export * from "./commands/ListGroupResourcesCommand"; +export * from "./commands/TagCommand"; +export * from "./commands/UpdateGroupCommand"; +export * from "./commands/CreateGroupCommand"; +export * from "./commands/UpdateGroupQueryCommand"; +export * from "./commands/SearchResourcesCommand"; +export * from "./commands/ListGroupsCommand"; +export * from "./commands/UntagCommand"; +export * from "./commands/DeleteGroupCommand"; +export * from "./commands/GetGroupQueryCommand"; +export * from "./commands/GetTagsCommand"; +export * from "./commands/GetGroupCommand"; diff --git a/clients/client-resource-groups/models/index.ts b/clients/client-resource-groups/models/index.ts new file mode 100644 index 000000000000..b66f951ec86d --- /dev/null +++ b/clients/client-resource-groups/models/index.ts @@ -0,0 +1,1011 @@ +import * as _smithy from "@aws-sdk/smithy-client"; +import { MetadataBearer as $MetadataBearer } from "@aws-sdk/types"; + +/** + * + *

The request does not comply with validation rules that are defined for the request parameters.

+ * + */ +export interface BadRequestException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "BadRequestException"; + $fault: "client"; + Message?: string; +} + +export namespace BadRequestException { + export function isa(o: any): o is BadRequestException { + return _smithy.isa(o, "BadRequestException"); + } +} + +export interface CreateGroupInput { + __type?: "CreateGroupInput"; + /** + * + *

The description of the resource group. Descriptions can have a maximum of 511 characters, including letters, numbers, hyphens, underscores, + * punctuation, and spaces.

+ * + */ + Description?: string; + + /** + * + *

The name of the group, which is the identifier of the group in other operations. A resource group name cannot be updated after it is created. + * A resource group name can have a maximum of 128 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with + * AWS or aws; these are reserved. A resource group name must be unique within your account.

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

The resource query that determines which AWS resources are members of this group.

+ * + */ + ResourceQuery: ResourceQuery | undefined; + + /** + * + *

The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, + * and tag values can have a maximum length of 256 characters.

+ * + */ + Tags?: { [key: string]: string }; +} + +export namespace CreateGroupInput { + export function isa(o: any): o is CreateGroupInput { + return _smithy.isa(o, "CreateGroupInput"); + } +} + +export interface CreateGroupOutput extends $MetadataBearer { + __type?: "CreateGroupOutput"; + /** + * + *

A full description of the resource group after it is created.

+ * + */ + Group?: Group; + + /** + * + *

The resource query associated with the group.

+ * + */ + ResourceQuery?: ResourceQuery; + + /** + * + *

The tags associated with the group.

+ * + */ + Tags?: { [key: string]: string }; +} + +export namespace CreateGroupOutput { + export function isa(o: any): o is CreateGroupOutput { + return _smithy.isa(o, "CreateGroupOutput"); + } +} + +export interface DeleteGroupInput { + __type?: "DeleteGroupInput"; + /** + * + *

The name of the resource group to delete.

+ * + */ + GroupName: string | undefined; +} + +export namespace DeleteGroupInput { + export function isa(o: any): o is DeleteGroupInput { + return _smithy.isa(o, "DeleteGroupInput"); + } +} + +export interface DeleteGroupOutput extends $MetadataBearer { + __type?: "DeleteGroupOutput"; + /** + * + *

A full description of the deleted resource group.

+ * + */ + Group?: Group; +} + +export namespace DeleteGroupOutput { + export function isa(o: any): o is DeleteGroupOutput { + return _smithy.isa(o, "DeleteGroupOutput"); + } +} + +/** + * + *

The caller is not authorized to make the request.

+ * + */ +export interface ForbiddenException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "ForbiddenException"; + $fault: "client"; + Message?: string; +} + +export namespace ForbiddenException { + export function isa(o: any): o is ForbiddenException { + return _smithy.isa(o, "ForbiddenException"); + } +} + +export interface GetGroupInput { + __type?: "GetGroupInput"; + /** + * + *

The name of the resource group.

+ * + */ + GroupName: string | undefined; +} + +export namespace GetGroupInput { + export function isa(o: any): o is GetGroupInput { + return _smithy.isa(o, "GetGroupInput"); + } +} + +export interface GetGroupOutput extends $MetadataBearer { + __type?: "GetGroupOutput"; + /** + * + *

A full description of the resource group.

+ * + */ + Group?: Group; +} + +export namespace GetGroupOutput { + export function isa(o: any): o is GetGroupOutput { + return _smithy.isa(o, "GetGroupOutput"); + } +} + +export interface GetGroupQueryInput { + __type?: "GetGroupQueryInput"; + /** + * + *

The name of the resource group.

+ * + */ + GroupName: string | undefined; +} + +export namespace GetGroupQueryInput { + export function isa(o: any): o is GetGroupQueryInput { + return _smithy.isa(o, "GetGroupQueryInput"); + } +} + +export interface GetGroupQueryOutput extends $MetadataBearer { + __type?: "GetGroupQueryOutput"; + /** + * + *

The resource query associated with the specified group.

+ * + */ + GroupQuery?: GroupQuery; +} + +export namespace GetGroupQueryOutput { + export function isa(o: any): o is GetGroupQueryOutput { + return _smithy.isa(o, "GetGroupQueryOutput"); + } +} + +export interface GetTagsInput { + __type?: "GetTagsInput"; + /** + * + *

The ARN of the resource group for which you want a list of tags. The resource must exist within the account you are using.

+ * + */ + Arn: string | undefined; +} + +export namespace GetTagsInput { + export function isa(o: any): o is GetTagsInput { + return _smithy.isa(o, "GetTagsInput"); + } +} + +export interface GetTagsOutput extends $MetadataBearer { + __type?: "GetTagsOutput"; + /** + * + *

The ARN of the tagged resource group.

+ * + */ + Arn?: string; + + /** + * + *

The tags associated with the specified resource group.

+ * + */ + Tags?: { [key: string]: string }; +} + +export namespace GetTagsOutput { + export function isa(o: any): o is GetTagsOutput { + return _smithy.isa(o, "GetTagsOutput"); + } +} + +/** + * + *

A resource group.

+ * + */ +export interface Group { + __type?: "Group"; + /** + * + *

The description of the resource group.

+ * + */ + Description?: string; + + /** + * + *

The ARN of a resource group.

+ * + */ + GroupArn: string | undefined; + + /** + * + *

The name of a resource group.

+ * + */ + Name: string | undefined; +} + +export namespace Group { + export function isa(o: any): o is Group { + return _smithy.isa(o, "Group"); + } +} + +/** + * + *

A filter name and value pair that is used to obtain more specific results from a list of groups.

+ * + */ +export interface GroupFilter { + __type?: "GroupFilter"; + /** + * + *

The name of the filter. Filter names are case-sensitive.

+ * + */ + Name: GroupFilterName | string | undefined; + + /** + * + *

One or more filter values. Allowed filter values vary by group filter name, and are case-sensitive.

+ * + */ + Values: Array | undefined; +} + +export namespace GroupFilter { + export function isa(o: any): o is GroupFilter { + return _smithy.isa(o, "GroupFilter"); + } +} + +export enum GroupFilterName { + ResourceType = "resource-type" +} + +/** + * + *

The ARN and group name of a group.

+ * + */ +export interface GroupIdentifier { + __type?: "GroupIdentifier"; + /** + * + *

The ARN of a resource group.

+ * + */ + GroupArn?: string; + + /** + * + *

The name of a resource group.

+ * + */ + GroupName?: string; +} + +export namespace GroupIdentifier { + export function isa(o: any): o is GroupIdentifier { + return _smithy.isa(o, "GroupIdentifier"); + } +} + +/** + * + *

The underlying resource query of a resource group. Resources that match query results are part of the group.

+ * + */ +export interface GroupQuery { + __type?: "GroupQuery"; + /** + * + *

The name of a resource group that is associated with a specific resource query.

+ * + */ + GroupName: string | undefined; + + /** + * + *

The resource query which determines which AWS resources are members of the associated resource group.

+ * + */ + ResourceQuery: ResourceQuery | undefined; +} + +export namespace GroupQuery { + export function isa(o: any): o is GroupQuery { + return _smithy.isa(o, "GroupQuery"); + } +} + +/** + * + *

An internal error occurred while processing the request.

+ * + */ +export interface InternalServerErrorException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "InternalServerErrorException"; + $fault: "server"; + Message?: string; +} + +export namespace InternalServerErrorException { + export function isa(o: any): o is InternalServerErrorException { + return _smithy.isa(o, "InternalServerErrorException"); + } +} + +export interface ListGroupResourcesInput { + __type?: "ListGroupResourcesInput"; + /** + * + *

Filters, formatted as ResourceFilter objects, that you want to apply to a ListGroupResources operation.

+ *
    + *
  • + *

    + * resource-type - Filter resources by their type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType. For example, AWS::EC2::Instance, or AWS::S3::Bucket.

    + *
  • + *
+ * + */ + Filters?: Array; + + /** + * + *

The name of the resource group.

+ * + */ + GroupName: string | undefined; + + /** + * + *

The maximum number of group member ARNs that are returned in a single call by ListGroupResources, in paginated output. By default, this number is 50.

+ * + */ + MaxResults?: number; + + /** + * + *

The NextToken value that is returned in a paginated ListGroupResources request. To get the next page of results, + * run the call again, add the NextToken parameter, and specify the NextToken value.

+ * + */ + NextToken?: string; +} + +export namespace ListGroupResourcesInput { + export function isa(o: any): o is ListGroupResourcesInput { + return _smithy.isa(o, "ListGroupResourcesInput"); + } +} + +export interface ListGroupResourcesOutput extends $MetadataBearer { + __type?: "ListGroupResourcesOutput"; + /** + * + *

The NextToken value to include in a subsequent ListGroupResources request, to get more results.

+ * + */ + NextToken?: string; + + /** + * + *

A list of QueryError objects. Each error is an object that contains + * ErrorCode and Message structures. Possible values + * for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

+ * + */ + QueryErrors?: Array; + + /** + * + *

The ARNs and resource types of resources that are members of the group that you specified.

+ * + */ + ResourceIdentifiers?: Array; +} + +export namespace ListGroupResourcesOutput { + export function isa(o: any): o is ListGroupResourcesOutput { + return _smithy.isa(o, "ListGroupResourcesOutput"); + } +} + +export interface ListGroupsInput { + __type?: "ListGroupsInput"; + /** + * + *

Filters, formatted as GroupFilter objects, that you want to apply to a ListGroups operation.

+ *
    + *
  • + *

    + * resource-type - Filter groups by resource type. Specify up to five resource types in the format AWS::ServiceCode::ResourceType. For example, AWS::EC2::Instance, or AWS::S3::Bucket.

    + *
  • + *
+ * + */ + Filters?: Array; + + /** + * + *

The maximum number of resource group results that are returned by ListGroups in paginated output. By default, this number is 50.

+ * + */ + MaxResults?: number; + + /** + * + *

The NextToken value that is returned in a paginated ListGroups request. To get the next page of results, + * run the call again, add the NextToken parameter, and specify the NextToken value.

+ * + */ + NextToken?: string; +} + +export namespace ListGroupsInput { + export function isa(o: any): o is ListGroupsInput { + return _smithy.isa(o, "ListGroupsInput"); + } +} + +export interface ListGroupsOutput extends $MetadataBearer { + __type?: "ListGroupsOutput"; + /** + * + *

A list of GroupIdentifier objects. Each identifier is an object that contains both the GroupName and the GroupArn.

+ * + */ + GroupIdentifiers?: Array; + + /** + * + *

A list of resource groups.

+ * + */ + Groups?: Array; + + /** + * + *

The NextToken value to include in a subsequent ListGroups request, to get more results.

+ * + */ + NextToken?: string; +} + +export namespace ListGroupsOutput { + export function isa(o: any): o is ListGroupsOutput { + return _smithy.isa(o, "ListGroupsOutput"); + } +} + +/** + * + *

The request uses an HTTP method which is not allowed for the specified resource.

+ * + */ +export interface MethodNotAllowedException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "MethodNotAllowedException"; + $fault: "client"; + Message?: string; +} + +export namespace MethodNotAllowedException { + export function isa(o: any): o is MethodNotAllowedException { + return _smithy.isa(o, "MethodNotAllowedException"); + } +} + +/** + * + *

One or more resources specified in the request do not exist.

+ * + */ +export interface NotFoundException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "NotFoundException"; + $fault: "client"; + Message?: string; +} + +export namespace NotFoundException { + export function isa(o: any): o is NotFoundException { + return _smithy.isa(o, "NotFoundException"); + } +} + +/** + * + *

A two-part error structure that can occur in ListGroupResources or + * SearchResources operations on CloudFormation stack-based queries. The error + * occurs if the CloudFormation stack on which the query is based either does not exist, or + * has a status that renders the stack inactive. A QueryError occurrence does + * not necessarily mean that AWS Resource Groups could not complete the operation, but the + * resulting group might have no member resources.

+ * + */ +export interface QueryError { + __type?: "QueryError"; + /** + * + *

Possible values are CLOUDFORMATION_STACK_INACTIVE and CLOUDFORMATION_STACK_NOT_EXISTING.

+ * + */ + ErrorCode?: QueryErrorCode | string; + + /** + * + *

A message that explains the ErrorCode value. Messages might state + * that the specified CloudFormation stack does not exist (or no longer exists). + * For CLOUDFORMATION_STACK_INACTIVE, the message typically states that the + * CloudFormation stack has a status that is not (or no longer) active, such as + * CREATE_FAILED.

+ * + */ + Message?: string; +} + +export namespace QueryError { + export function isa(o: any): o is QueryError { + return _smithy.isa(o, "QueryError"); + } +} + +export enum QueryErrorCode { + CLOUDFORMATION_STACK_INACTIVE = "CLOUDFORMATION_STACK_INACTIVE", + CLOUDFORMATION_STACK_NOT_EXISTING = "CLOUDFORMATION_STACK_NOT_EXISTING" +} + +export enum QueryType { + CLOUDFORMATION_STACK_1_0 = "CLOUDFORMATION_STACK_1_0", + TAG_FILTERS_1_0 = "TAG_FILTERS_1_0" +} + +/** + * + *

A filter name and value pair that is used to obtain more specific results from a list of resources.

+ * + */ +export interface ResourceFilter { + __type?: "ResourceFilter"; + /** + * + *

The name of the filter. Filter names are case-sensitive.

+ * + */ + Name: ResourceFilterName | string | undefined; + + /** + * + *

One or more filter values. Allowed filter values vary by resource filter name, and are case-sensitive.

+ * + */ + Values: Array | undefined; +} + +export namespace ResourceFilter { + export function isa(o: any): o is ResourceFilter { + return _smithy.isa(o, "ResourceFilter"); + } +} + +export enum ResourceFilterName { + ResourceType = "resource-type" +} + +/** + * + *

The ARN of a resource, and its resource type.

+ * + */ +export interface ResourceIdentifier { + __type?: "ResourceIdentifier"; + /** + * + *

The ARN of a resource.

+ * + */ + ResourceArn?: string; + + /** + * + *

The resource type of a resource, such as AWS::EC2::Instance.

+ * + */ + ResourceType?: string; +} + +export namespace ResourceIdentifier { + export function isa(o: any): o is ResourceIdentifier { + return _smithy.isa(o, "ResourceIdentifier"); + } +} + +/** + * + *

The query that is used to define a resource group or a search for resources.

+ * + */ +export interface ResourceQuery { + __type?: "ResourceQuery"; + /** + * + *

The query that defines a group or a search.

+ * + */ + Query: string | undefined; + + /** + * + *

The type of the query. The valid values in this release are TAG_FILTERS_1_0 and CLOUDFORMATION_STACK_1_0.

+ *

+ * + * TAG_FILTERS_1_0: + * A JSON syntax that lets you specify a collection of simple tag filters for resource types and tags, + * as supported by the AWS Tagging API GetResources operation. + * If you specify more than one tag key, only resources that match all tag keys, and at least one value of each specified tag key, are returned in your query. If you + * specify more than one value for a tag key, a resource matches the filter if it has a tag key value that matches any of the specified values.

+ *

For example, consider the following sample query for resources that have two tags, Stage and Version, with two values each. + * ([{"Key":"Stage","Values":["Test","Deploy"]},{"Key":"Version","Values":["1","2"]}]) The results of this query might include the following.

+ *
    + *
  • + *

    An EC2 instance that has the following two tags: {"Key":"Stage","Value":"Deploy"}, and {"Key":"Version","Value":"2"} + *

    + *
  • + *
  • + *

    An S3 bucket that has the following two tags: {"Key":"Stage","Value":"Test"}, and {"Key":"Version","Value":"1"}

    + *
  • + *
+ *

The query would not return the following results, however. The following EC2 instance does not have all tag keys specified in the filter, so it is rejected. + * The RDS database has all of the tag keys, but no values that match at least one of the specified tag key values in the filter.

+ *
    + *
  • + *

    An EC2 instance that has only the following tag: {"Key":"Stage","Value":"Deploy"}.

    + *
  • + *
  • + *

    An RDS database that has the following two tags: {"Key":"Stage","Value":"Archived"}, and {"Key":"Version","Value":"4"} + *

    + *
  • + *
+ *

+ * + * CLOUDFORMATION_STACK_1_0: + * A JSON syntax that lets you specify a CloudFormation stack ARN.

+ * + */ + Type: QueryType | string | undefined; +} + +export namespace ResourceQuery { + export function isa(o: any): o is ResourceQuery { + return _smithy.isa(o, "ResourceQuery"); + } +} + +export interface SearchResourcesInput { + __type?: "SearchResourcesInput"; + /** + * + *

The maximum number of group member ARNs returned by SearchResources in paginated output. By default, this number is 50.

+ * + */ + MaxResults?: number; + + /** + * + *

The NextToken value that is returned in a paginated SearchResources request. To get the next page of results, + * run the call again, add the NextToken parameter, and specify the NextToken value.

+ * + */ + NextToken?: string; + + /** + * + *

The search query, using the same formats that are supported for resource group definition.

+ * + */ + ResourceQuery: ResourceQuery | undefined; +} + +export namespace SearchResourcesInput { + export function isa(o: any): o is SearchResourcesInput { + return _smithy.isa(o, "SearchResourcesInput"); + } +} + +export interface SearchResourcesOutput extends $MetadataBearer { + __type?: "SearchResourcesOutput"; + /** + * + *

The NextToken value to include in a subsequent SearchResources request, to get more results.

+ * + */ + NextToken?: string; + + /** + * + *

A list of QueryError objects. Each error is an object that + * contains ErrorCode and Message structures. Possible values + * for ErrorCode are CLOUDFORMATION_STACK_INACTIVE and + * CLOUDFORMATION_STACK_NOT_EXISTING.

+ * + */ + QueryErrors?: Array; + + /** + * + *

The ARNs and resource types of resources that are members of the group that you specified.

+ * + */ + ResourceIdentifiers?: Array; +} + +export namespace SearchResourcesOutput { + export function isa(o: any): o is SearchResourcesOutput { + return _smithy.isa(o, "SearchResourcesOutput"); + } +} + +export interface TagInput { + __type?: "TagInput"; + /** + * + *

The ARN of the resource to which to add tags.

+ * + */ + Arn: string | undefined; + + /** + * + *

The tags to add to the specified resource. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, + * and tag values can have a maximum length of 256 characters.

+ * + */ + Tags: { [key: string]: string } | undefined; +} + +export namespace TagInput { + export function isa(o: any): o is TagInput { + return _smithy.isa(o, "TagInput"); + } +} + +export interface TagOutput extends $MetadataBearer { + __type?: "TagOutput"; + /** + * + *

The ARN of the tagged resource.

+ * + */ + Arn?: string; + + /** + * + *

The tags that have been added to the specified resource.

+ * + */ + Tags?: { [key: string]: string }; +} + +export namespace TagOutput { + export function isa(o: any): o is TagOutput { + return _smithy.isa(o, "TagOutput"); + } +} + +/** + * + *

The caller has exceeded throttling limits.

+ * + */ +export interface TooManyRequestsException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "TooManyRequestsException"; + $fault: "client"; + Message?: string; +} + +export namespace TooManyRequestsException { + export function isa(o: any): o is TooManyRequestsException { + return _smithy.isa(o, "TooManyRequestsException"); + } +} + +/** + * + *

The request has not been applied because it lacks valid authentication credentials for the target resource.

+ * + */ +export interface UnauthorizedException + extends _smithy.SmithyException, + $MetadataBearer { + __type: "UnauthorizedException"; + $fault: "client"; + Message?: string; +} + +export namespace UnauthorizedException { + export function isa(o: any): o is UnauthorizedException { + return _smithy.isa(o, "UnauthorizedException"); + } +} + +export interface UntagInput { + __type?: "UntagInput"; + /** + * + *

The ARN of the resource from which to remove tags.

+ * + */ + Arn: string | undefined; + + /** + * + *

The keys of the tags to be removed.

+ * + */ + Keys: Array | undefined; +} + +export namespace UntagInput { + export function isa(o: any): o is UntagInput { + return _smithy.isa(o, "UntagInput"); + } +} + +export interface UntagOutput extends $MetadataBearer { + __type?: "UntagOutput"; + /** + * + *

The ARN of the resource from which tags have been removed.

+ * + */ + Arn?: string; + + /** + * + *

The keys of tags that have been removed.

+ * + */ + Keys?: Array; +} + +export namespace UntagOutput { + export function isa(o: any): o is UntagOutput { + return _smithy.isa(o, "UntagOutput"); + } +} + +export interface UpdateGroupInput { + __type?: "UpdateGroupInput"; + /** + * + *

The description of the resource group. Descriptions can have a maximum of 511 characters, including letters, numbers, hyphens, underscores, + * punctuation, and spaces.

+ * + */ + Description?: string; + + /** + * + *

The name of the resource group for which you want to update its description.

+ * + */ + GroupName: string | undefined; +} + +export namespace UpdateGroupInput { + export function isa(o: any): o is UpdateGroupInput { + return _smithy.isa(o, "UpdateGroupInput"); + } +} + +export interface UpdateGroupOutput extends $MetadataBearer { + __type?: "UpdateGroupOutput"; + /** + * + *

The full description of the resource group after it has been updated.

+ * + */ + Group?: Group; +} + +export namespace UpdateGroupOutput { + export function isa(o: any): o is UpdateGroupOutput { + return _smithy.isa(o, "UpdateGroupOutput"); + } +} + +export interface UpdateGroupQueryInput { + __type?: "UpdateGroupQueryInput"; + /** + * + *

The name of the resource group for which you want to edit the query.

+ * + */ + GroupName: string | undefined; + + /** + * + *

The resource query that determines which AWS resources are members of the resource group.

+ * + */ + ResourceQuery: ResourceQuery | undefined; +} + +export namespace UpdateGroupQueryInput { + export function isa(o: any): o is UpdateGroupQueryInput { + return _smithy.isa(o, "UpdateGroupQueryInput"); + } +} + +export interface UpdateGroupQueryOutput extends $MetadataBearer { + __type?: "UpdateGroupQueryOutput"; + /** + * + *

The resource query associated with the resource group after the update.

+ * + */ + GroupQuery?: GroupQuery; +} + +export namespace UpdateGroupQueryOutput { + export function isa(o: any): o is UpdateGroupQueryOutput { + return _smithy.isa(o, "UpdateGroupQueryOutput"); + } +} diff --git a/clients/client-resource-groups/package.json b/clients/client-resource-groups/package.json new file mode 100644 index 000000000000..0232dfbc5811 --- /dev/null +++ b/clients/client-resource-groups/package.json @@ -0,0 +1,75 @@ +{ + "name": "@aws-sdk/client-resource-groups", + "description": "@aws-sdk/client-resource-groups client", + "version": "0.1.0-preview.1", + "scripts": { + "clean": "npm run remove-definitions && npm run remove-dist && npm run remove-js && npm run remove-maps", + "build-documentation": "npm run clean && typedoc ./", + "prepublishOnly": "yarn build", + "pretest": "tsc", + "remove-definitions": "rimraf ./types", + "remove-dist": "rimraf ./dist", + "remove-documentation": "rimraf ./docs", + "remove-js": "rimraf *.js && rimraf ./commands/*.js && rimraf ./models/*.js && rimraf ./protocols/*.js", + "remove-maps": "rimraf *.js.map && rimraf ./commands/*.js.map && rimraf ./models/*.js.map && rimraf ./protocols/*.js.map", + "test": "exit 0", + "smoke-test": "npm run pretest && node ./test/smoke/index.spec.js", + "build:es": "tsc -p tsconfig.es.json", + "build": "yarn pretest && yarn build:es" + }, + "main": "./dist/cjs/index.js", + "types": "./types/index.d.ts", + "module": "./dist/es/index.js", + "browser": { + "./runtimeConfig": "./runtimeConfig.browser" + }, + "sideEffects": false, + "dependencies": { + "tslib": "^1.8.0", + "@aws-crypto/sha256-browser": "^0.1.0-preview.1", + "@aws-sdk/config-resolver": "^0.1.0-preview.5", + "@aws-sdk/credential-provider-node": "^0.1.0-preview.7", + "@aws-sdk/fetch-http-handler": "^0.1.0-preview.5", + "@aws-sdk/hash-node": "^0.1.0-preview.5", + "@aws-sdk/invalid-dependency": "^0.1.0-preview.1", + "@aws-sdk/middleware-content-length": "^0.1.0-preview.5", + "@aws-sdk/middleware-host-header": "^0.1.0-preview.1", + "@aws-sdk/middleware-retry": "^0.1.0-preview.5", + "@aws-sdk/middleware-serde": "^0.1.0-preview.1", + "@aws-sdk/middleware-signing": "^0.1.0-preview.7", + "@aws-sdk/middleware-stack": "^0.1.0-preview.6", + "@aws-sdk/middleware-user-agent": "^0.1.0-preview.1", + "@aws-sdk/node-http-handler": "^0.1.0-preview.6", + "@aws-sdk/protocol-http": "^0.1.0-preview.1", + "@aws-sdk/region-provider": "^0.1.0-preview.5", + "@aws-sdk/smithy-client": "^0.1.0-preview.1", + "@aws-sdk/stream-collector-browser": "^0.1.0-preview.5", + "@aws-sdk/stream-collector-node": "^0.1.0-preview.6", + "@aws-sdk/types": "^0.1.0-preview.5", + "@aws-sdk/url-parser-browser": "^0.1.0-preview.5", + "@aws-sdk/url-parser-node": "^0.1.0-preview.5", + "@aws-sdk/util-base64-browser": "^0.1.0-preview.3", + "@aws-sdk/util-base64-node": "^0.1.0-preview.3", + "@aws-sdk/util-body-length-browser": "^0.1.0-preview.3", + "@aws-sdk/util-body-length-node": "^0.1.0-preview.4", + "@aws-sdk/util-user-agent-browser": "^0.1.0-preview.6", + "@aws-sdk/util-user-agent-node": "^0.1.0-preview.6", + "@aws-sdk/util-utf8-browser": "^0.1.0-preview.3", + "@aws-sdk/util-utf8-node": "^0.1.0-preview.3" + }, + "devDependencies": { + "rimraf": "^3.0.0", + "typedoc": "^0.15.0", + "typescript": "^3.6.3", + "@types/node": "^12.7.5", + "tslib": "^1.8.0" + }, + "engines": { + "node": ">=8.0.0" + }, + "author": { + "name": "AWS SDK for JavaScript Team", + "url": "https://aws.amazon.com/javascript/" + }, + "license": "Apache-2.0" +} diff --git a/clients/client-resource-groups/protocols/Aws_restJson1_1.ts b/clients/client-resource-groups/protocols/Aws_restJson1_1.ts new file mode 100644 index 000000000000..1b2ecbfd91d9 --- /dev/null +++ b/clients/client-resource-groups/protocols/Aws_restJson1_1.ts @@ -0,0 +1,1943 @@ +import { + CreateGroupCommandInput, + CreateGroupCommandOutput +} from "../commands/CreateGroupCommand"; +import { + DeleteGroupCommandInput, + DeleteGroupCommandOutput +} from "../commands/DeleteGroupCommand"; +import { + GetGroupCommandInput, + GetGroupCommandOutput +} from "../commands/GetGroupCommand"; +import { + GetGroupQueryCommandInput, + GetGroupQueryCommandOutput +} from "../commands/GetGroupQueryCommand"; +import { + GetTagsCommandInput, + GetTagsCommandOutput +} from "../commands/GetTagsCommand"; +import { + ListGroupResourcesCommandInput, + ListGroupResourcesCommandOutput +} from "../commands/ListGroupResourcesCommand"; +import { + ListGroupsCommandInput, + ListGroupsCommandOutput +} from "../commands/ListGroupsCommand"; +import { + SearchResourcesCommandInput, + SearchResourcesCommandOutput +} from "../commands/SearchResourcesCommand"; +import { TagCommandInput, TagCommandOutput } from "../commands/TagCommand"; +import { + UntagCommandInput, + UntagCommandOutput +} from "../commands/UntagCommand"; +import { + UpdateGroupCommandInput, + UpdateGroupCommandOutput +} from "../commands/UpdateGroupCommand"; +import { + UpdateGroupQueryCommandInput, + UpdateGroupQueryCommandOutput +} from "../commands/UpdateGroupQueryCommand"; +import { + BadRequestException, + ForbiddenException, + Group, + GroupFilter, + GroupIdentifier, + GroupQuery, + InternalServerErrorException, + MethodNotAllowedException, + NotFoundException, + QueryError, + ResourceFilter, + ResourceIdentifier, + ResourceQuery, + TooManyRequestsException, + UnauthorizedException +} from "../models/index"; +import { + HttpRequest as __HttpRequest, + HttpResponse as __HttpResponse +} from "@aws-sdk/protocol-http"; +import { SmithyException as __SmithyException } from "@aws-sdk/smithy-client"; +import { + Endpoint as __Endpoint, + MetadataBearer as __MetadataBearer, + ResponseMetadata as __ResponseMetadata, + SerdeContext as __SerdeContext +} from "@aws-sdk/types"; + +export async function serializeAws_restJson1_1CreateGroupCommand( + input: CreateGroupCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/groups"; + let body: any = {}; + const bodyParams: any = {}; + if (input.Description !== undefined) { + bodyParams["Description"] = input.Description; + } + if (input.Name !== undefined) { + bodyParams["Name"] = input.Name; + } + if (input.ResourceQuery !== undefined) { + bodyParams["ResourceQuery"] = serializeAws_restJson1_1ResourceQuery( + input.ResourceQuery, + context + ); + } + if (input.Tags !== undefined) { + bodyParams["Tags"] = serializeAws_restJson1_1Tags(input.Tags, context); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "POST", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function serializeAws_restJson1_1DeleteGroupCommand( + input: DeleteGroupCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = ""; + let resolvedPath = "/groups/{GroupName}"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "DELETE", + headers: headers, + path: resolvedPath + }); +} + +export async function serializeAws_restJson1_1GetGroupCommand( + input: GetGroupCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = ""; + let resolvedPath = "/groups/{GroupName}"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "GET", + headers: headers, + path: resolvedPath + }); +} + +export async function serializeAws_restJson1_1GetGroupQueryCommand( + input: GetGroupQueryCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = ""; + let resolvedPath = "/groups/{GroupName}/query"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "GET", + headers: headers, + path: resolvedPath + }); +} + +export async function serializeAws_restJson1_1GetTagsCommand( + input: GetTagsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = ""; + let resolvedPath = "/resources/{Arn}/tags"; + if (input.Arn !== undefined) { + const labelValue: any = input.Arn.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: Arn."); + } + resolvedPath = resolvedPath.replace("{Arn}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: Arn."); + } + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "GET", + headers: headers, + path: resolvedPath + }); +} + +export async function serializeAws_restJson1_1ListGroupResourcesCommand( + input: ListGroupResourcesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/groups/{GroupName}/resource-identifiers-list"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + const query: any = {}; + if (input.MaxResults !== undefined) { + query["maxResults"] = input.MaxResults.toString(); + } + if (input.NextToken !== undefined) { + query["nextToken"] = input.NextToken.toString(); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.Filters !== undefined) { + bodyParams["Filters"] = serializeAws_restJson1_1ResourceFilterList( + input.Filters, + context + ); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "POST", + headers: headers, + path: resolvedPath, + query: query, + body: body + }); +} + +export async function serializeAws_restJson1_1ListGroupsCommand( + input: ListGroupsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/groups-list"; + const query: any = {}; + if (input.MaxResults !== undefined) { + query["maxResults"] = input.MaxResults.toString(); + } + if (input.NextToken !== undefined) { + query["nextToken"] = input.NextToken.toString(); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.Filters !== undefined) { + bodyParams["Filters"] = serializeAws_restJson1_1GroupFilterList( + input.Filters, + context + ); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "POST", + headers: headers, + path: resolvedPath, + query: query, + body: body + }); +} + +export async function serializeAws_restJson1_1SearchResourcesCommand( + input: SearchResourcesCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/resources/search"; + let body: any = {}; + const bodyParams: any = {}; + if (input.MaxResults !== undefined) { + bodyParams["MaxResults"] = input.MaxResults; + } + if (input.NextToken !== undefined) { + bodyParams["NextToken"] = input.NextToken; + } + if (input.ResourceQuery !== undefined) { + bodyParams["ResourceQuery"] = serializeAws_restJson1_1ResourceQuery( + input.ResourceQuery, + context + ); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "POST", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function serializeAws_restJson1_1TagCommand( + input: TagCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/resources/{Arn}/tags"; + if (input.Arn !== undefined) { + const labelValue: any = input.Arn.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: Arn."); + } + resolvedPath = resolvedPath.replace("{Arn}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: Arn."); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.Tags !== undefined) { + bodyParams["Tags"] = serializeAws_restJson1_1Tags(input.Tags, context); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "PUT", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function serializeAws_restJson1_1UntagCommand( + input: UntagCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/resources/{Arn}/tags"; + if (input.Arn !== undefined) { + const labelValue: any = input.Arn.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: Arn."); + } + resolvedPath = resolvedPath.replace("{Arn}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: Arn."); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.Keys !== undefined) { + bodyParams["Keys"] = serializeAws_restJson1_1TagKeyList( + input.Keys, + context + ); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "PATCH", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function serializeAws_restJson1_1UpdateGroupCommand( + input: UpdateGroupCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/groups/{GroupName}"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.Description !== undefined) { + bodyParams["Description"] = input.Description; + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "PUT", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function serializeAws_restJson1_1UpdateGroupQueryCommand( + input: UpdateGroupQueryCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> { + const headers: any = {}; + headers["Content-Type"] = "application/json"; + let resolvedPath = "/groups/{GroupName}/query"; + if (input.GroupName !== undefined) { + const labelValue: any = input.GroupName.toString(); + if (labelValue.length <= 0) { + throw new Error("Empty value provided for input HTTP label: GroupName."); + } + resolvedPath = resolvedPath.replace("{GroupName}", labelValue); + } else { + throw new Error("No value provided for input HTTP label: GroupName."); + } + let body: any = {}; + const bodyParams: any = {}; + if (input.ResourceQuery !== undefined) { + bodyParams["ResourceQuery"] = serializeAws_restJson1_1ResourceQuery( + input.ResourceQuery, + context + ); + } + body = JSON.stringify(bodyParams); + return new __HttpRequest({ + ...context.endpoint, + protocol: "https", + method: "PUT", + headers: headers, + path: resolvedPath, + body: body + }); +} + +export async function deserializeAws_restJson1_1CreateGroupCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1CreateGroupCommandError(output, context); + } + const contents: CreateGroupCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "CreateGroupOutput", + Group: undefined, + ResourceQuery: undefined, + Tags: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Group !== undefined) { + contents.Group = deserializeAws_restJson1_1Group(data.Group, context); + } + if (data.ResourceQuery !== undefined) { + contents.ResourceQuery = deserializeAws_restJson1_1ResourceQuery( + data.ResourceQuery, + context + ); + } + if (data.Tags !== undefined) { + contents.Tags = deserializeAws_restJson1_1Tags(data.Tags, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1CreateGroupCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1DeleteGroupCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1DeleteGroupCommandError(output, context); + } + const contents: DeleteGroupCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "DeleteGroupOutput", + Group: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Group !== undefined) { + contents.Group = deserializeAws_restJson1_1Group(data.Group, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1DeleteGroupCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1GetGroupCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1GetGroupCommandError(output, context); + } + const contents: GetGroupCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "GetGroupOutput", + Group: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Group !== undefined) { + contents.Group = deserializeAws_restJson1_1Group(data.Group, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1GetGroupCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1GetGroupQueryCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1GetGroupQueryCommandError(output, context); + } + const contents: GetGroupQueryCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "GetGroupQueryOutput", + GroupQuery: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.GroupQuery !== undefined) { + contents.GroupQuery = deserializeAws_restJson1_1GroupQuery( + data.GroupQuery, + context + ); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1GetGroupQueryCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1GetTagsCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1GetTagsCommandError(output, context); + } + const contents: GetTagsCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "GetTagsOutput", + Arn: undefined, + Tags: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Arn !== undefined) { + contents.Arn = data.Arn; + } + if (data.Tags !== undefined) { + contents.Tags = deserializeAws_restJson1_1Tags(data.Tags, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1GetTagsCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1ListGroupResourcesCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1ListGroupResourcesCommandError( + output, + context + ); + } + const contents: ListGroupResourcesCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "ListGroupResourcesOutput", + NextToken: undefined, + QueryErrors: undefined, + ResourceIdentifiers: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.NextToken !== undefined) { + contents.NextToken = data.NextToken; + } + if (data.QueryErrors !== undefined) { + contents.QueryErrors = deserializeAws_restJson1_1QueryErrorList( + data.QueryErrors, + context + ); + } + if (data.ResourceIdentifiers !== undefined) { + contents.ResourceIdentifiers = deserializeAws_restJson1_1ResourceIdentifierList( + data.ResourceIdentifiers, + context + ); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1ListGroupResourcesCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + case "UnauthorizedException": + case "com.amazonaws.ardi#UnauthorizedException": + response = await deserializeAws_restJson1_1UnauthorizedExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1ListGroupsCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1ListGroupsCommandError(output, context); + } + const contents: ListGroupsCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "ListGroupsOutput", + GroupIdentifiers: undefined, + Groups: undefined, + NextToken: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.GroupIdentifiers !== undefined) { + contents.GroupIdentifiers = deserializeAws_restJson1_1GroupIdentifierList( + data.GroupIdentifiers, + context + ); + } + if (data.Groups !== undefined) { + contents.Groups = deserializeAws_restJson1_1GroupList(data.Groups, context); + } + if (data.NextToken !== undefined) { + contents.NextToken = data.NextToken; + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1ListGroupsCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1SearchResourcesCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1SearchResourcesCommandError( + output, + context + ); + } + const contents: SearchResourcesCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "SearchResourcesOutput", + NextToken: undefined, + QueryErrors: undefined, + ResourceIdentifiers: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.NextToken !== undefined) { + contents.NextToken = data.NextToken; + } + if (data.QueryErrors !== undefined) { + contents.QueryErrors = deserializeAws_restJson1_1QueryErrorList( + data.QueryErrors, + context + ); + } + if (data.ResourceIdentifiers !== undefined) { + contents.ResourceIdentifiers = deserializeAws_restJson1_1ResourceIdentifierList( + data.ResourceIdentifiers, + context + ); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1SearchResourcesCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + case "UnauthorizedException": + case "com.amazonaws.ardi#UnauthorizedException": + response = await deserializeAws_restJson1_1UnauthorizedExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1TagCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1TagCommandError(output, context); + } + const contents: TagCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "TagOutput", + Arn: undefined, + Tags: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Arn !== undefined) { + contents.Arn = data.Arn; + } + if (data.Tags !== undefined) { + contents.Tags = deserializeAws_restJson1_1Tags(data.Tags, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1TagCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1UntagCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1UntagCommandError(output, context); + } + const contents: UntagCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "UntagOutput", + Arn: undefined, + Keys: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Arn !== undefined) { + contents.Arn = data.Arn; + } + if (data.Keys !== undefined) { + contents.Keys = deserializeAws_restJson1_1TagKeyList(data.Keys, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1UntagCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1UpdateGroupCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1UpdateGroupCommandError(output, context); + } + const contents: UpdateGroupCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "UpdateGroupOutput", + Group: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Group !== undefined) { + contents.Group = deserializeAws_restJson1_1Group(data.Group, context); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1UpdateGroupCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +export async function deserializeAws_restJson1_1UpdateGroupQueryCommand( + output: __HttpResponse, + context: __SerdeContext +): Promise { + if (output.statusCode !== 200) { + return deserializeAws_restJson1_1UpdateGroupQueryCommandError( + output, + context + ); + } + const contents: UpdateGroupQueryCommandOutput = { + $metadata: deserializeMetadata(output), + __type: "UpdateGroupQueryOutput", + GroupQuery: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.GroupQuery !== undefined) { + contents.GroupQuery = deserializeAws_restJson1_1GroupQuery( + data.GroupQuery, + context + ); + } + return Promise.resolve(contents); +} + +async function deserializeAws_restJson1_1UpdateGroupQueryCommandError( + output: __HttpResponse, + context: __SerdeContext +): Promise { + const data: any = await parseBody(output.body, context); + const parsedOutput: any = { + ...output, + body: data + }; + let response: __SmithyException & __MetadataBearer; + let errorCode: String; + errorCode = output.headers["x-amzn-errortype"].split(":")[0]; + switch (errorCode) { + case "BadRequestException": + case "com.amazonaws.ardi#BadRequestException": + response = await deserializeAws_restJson1_1BadRequestExceptionResponse( + parsedOutput, + context + ); + break; + case "ForbiddenException": + case "com.amazonaws.ardi#ForbiddenException": + response = await deserializeAws_restJson1_1ForbiddenExceptionResponse( + parsedOutput, + context + ); + break; + case "InternalServerErrorException": + case "com.amazonaws.ardi#InternalServerErrorException": + response = await deserializeAws_restJson1_1InternalServerErrorExceptionResponse( + parsedOutput, + context + ); + break; + case "MethodNotAllowedException": + case "com.amazonaws.ardi#MethodNotAllowedException": + response = await deserializeAws_restJson1_1MethodNotAllowedExceptionResponse( + parsedOutput, + context + ); + break; + case "NotFoundException": + case "com.amazonaws.ardi#NotFoundException": + response = await deserializeAws_restJson1_1NotFoundExceptionResponse( + parsedOutput, + context + ); + break; + case "TooManyRequestsException": + case "com.amazonaws.ardi#TooManyRequestsException": + response = await deserializeAws_restJson1_1TooManyRequestsExceptionResponse( + parsedOutput, + context + ); + break; + default: + errorCode = errorCode || "UnknownError"; + response = { + __type: `com.amazonaws.ardi#${errorCode}`, + $fault: "client", + $metadata: deserializeMetadata(output) + }; + } + return Promise.reject(Object.assign(new Error(response.__type), response)); +} + +const deserializeAws_restJson1_1BadRequestExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: BadRequestException = { + __type: "BadRequestException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1ForbiddenExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: ForbiddenException = { + __type: "ForbiddenException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1InternalServerErrorExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: InternalServerErrorException = { + __type: "InternalServerErrorException", + $fault: "server", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1MethodNotAllowedExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: MethodNotAllowedException = { + __type: "MethodNotAllowedException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1NotFoundExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: NotFoundException = { + __type: "NotFoundException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1TooManyRequestsExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: TooManyRequestsException = { + __type: "TooManyRequestsException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1UnauthorizedExceptionResponse = async ( + output: any, + context: __SerdeContext +): Promise => { + const contents: UnauthorizedException = { + __type: "UnauthorizedException", + $fault: "client", + $metadata: deserializeMetadata(output), + Message: undefined + }; + const data: any = await parseBody(output.body, context); + if (data.Message !== undefined) { + contents.Message = data.Message; + } + return contents; +}; + +const serializeAws_restJson1_1GroupFilter = ( + input: GroupFilter, + context: __SerdeContext +): any => { + let bodyParams: any = {}; + if (input.Name !== undefined) { + bodyParams["Name"] = input.Name; + } + if (input.Values !== undefined) { + bodyParams["Values"] = serializeAws_restJson1_1GroupFilterValues( + input.Values, + context + ); + } + return bodyParams; +}; + +const serializeAws_restJson1_1GroupFilterList = ( + input: Array, + context: __SerdeContext +): any => { + return (input || []).map(entry => + serializeAws_restJson1_1GroupFilter(entry, context) + ); +}; + +const serializeAws_restJson1_1GroupFilterValues = ( + input: Array, + context: __SerdeContext +): any => { + return (input || []).map(entry => entry); +}; + +const serializeAws_restJson1_1ResourceFilter = ( + input: ResourceFilter, + context: __SerdeContext +): any => { + let bodyParams: any = {}; + if (input.Name !== undefined) { + bodyParams["Name"] = input.Name; + } + if (input.Values !== undefined) { + bodyParams["Values"] = serializeAws_restJson1_1ResourceFilterValues( + input.Values, + context + ); + } + return bodyParams; +}; + +const serializeAws_restJson1_1ResourceFilterList = ( + input: Array, + context: __SerdeContext +): any => { + return (input || []).map(entry => + serializeAws_restJson1_1ResourceFilter(entry, context) + ); +}; + +const serializeAws_restJson1_1ResourceFilterValues = ( + input: Array, + context: __SerdeContext +): any => { + return (input || []).map(entry => entry); +}; + +const serializeAws_restJson1_1ResourceQuery = ( + input: ResourceQuery, + context: __SerdeContext +): any => { + let bodyParams: any = {}; + if (input.Query !== undefined) { + bodyParams["Query"] = input.Query; + } + if (input.Type !== undefined) { + bodyParams["Type"] = input.Type; + } + return bodyParams; +}; + +const serializeAws_restJson1_1TagKeyList = ( + input: Array, + context: __SerdeContext +): any => { + return (input || []).map(entry => entry); +}; + +const serializeAws_restJson1_1Tags = ( + input: { [key: string]: string }, + context: __SerdeContext +): any => { + let mapParams: any = {}; + Object.keys(input).forEach(key => { + mapParams[key] = input[key]; + }); + return mapParams; +}; + +const deserializeAws_restJson1_1Group = ( + output: any, + context: __SerdeContext +): Group => { + let contents: any = { + __type: "Group", + Description: undefined, + GroupArn: undefined, + Name: undefined + }; + if (output.Description !== undefined) { + contents.Description = output.Description; + } + if (output.GroupArn !== undefined) { + contents.GroupArn = output.GroupArn; + } + if (output.Name !== undefined) { + contents.Name = output.Name; + } + return contents; +}; + +const deserializeAws_restJson1_1GroupIdentifier = ( + output: any, + context: __SerdeContext +): GroupIdentifier => { + let contents: any = { + __type: "GroupIdentifier", + GroupArn: undefined, + GroupName: undefined + }; + if (output.GroupArn !== undefined) { + contents.GroupArn = output.GroupArn; + } + if (output.GroupName !== undefined) { + contents.GroupName = output.GroupName; + } + return contents; +}; + +const deserializeAws_restJson1_1GroupIdentifierList = ( + output: any, + context: __SerdeContext +): Array => { + return (output || []).map((entry: any) => + deserializeAws_restJson1_1GroupIdentifier(entry, context) + ); +}; + +const deserializeAws_restJson1_1GroupList = ( + output: any, + context: __SerdeContext +): Array => { + return (output || []).map((entry: any) => + deserializeAws_restJson1_1Group(entry, context) + ); +}; + +const deserializeAws_restJson1_1GroupQuery = ( + output: any, + context: __SerdeContext +): GroupQuery => { + let contents: any = { + __type: "GroupQuery", + GroupName: undefined, + ResourceQuery: undefined + }; + if (output.GroupName !== undefined) { + contents.GroupName = output.GroupName; + } + if (output.ResourceQuery !== undefined) { + contents.ResourceQuery = deserializeAws_restJson1_1ResourceQuery( + output.ResourceQuery, + context + ); + } + return contents; +}; + +const deserializeAws_restJson1_1QueryError = ( + output: any, + context: __SerdeContext +): QueryError => { + let contents: any = { + __type: "QueryError", + ErrorCode: undefined, + Message: undefined + }; + if (output.ErrorCode !== undefined) { + contents.ErrorCode = output.ErrorCode; + } + if (output.Message !== undefined) { + contents.Message = output.Message; + } + return contents; +}; + +const deserializeAws_restJson1_1QueryErrorList = ( + output: any, + context: __SerdeContext +): Array => { + return (output || []).map((entry: any) => + deserializeAws_restJson1_1QueryError(entry, context) + ); +}; + +const deserializeAws_restJson1_1ResourceIdentifier = ( + output: any, + context: __SerdeContext +): ResourceIdentifier => { + let contents: any = { + __type: "ResourceIdentifier", + ResourceArn: undefined, + ResourceType: undefined + }; + if (output.ResourceArn !== undefined) { + contents.ResourceArn = output.ResourceArn; + } + if (output.ResourceType !== undefined) { + contents.ResourceType = output.ResourceType; + } + return contents; +}; + +const deserializeAws_restJson1_1ResourceIdentifierList = ( + output: any, + context: __SerdeContext +): Array => { + return (output || []).map((entry: any) => + deserializeAws_restJson1_1ResourceIdentifier(entry, context) + ); +}; + +const deserializeAws_restJson1_1ResourceQuery = ( + output: any, + context: __SerdeContext +): ResourceQuery => { + let contents: any = { + __type: "ResourceQuery", + Query: undefined, + Type: undefined + }; + if (output.Query !== undefined) { + contents.Query = output.Query; + } + if (output.Type !== undefined) { + contents.Type = output.Type; + } + return contents; +}; + +const deserializeAws_restJson1_1TagKeyList = ( + output: any, + context: __SerdeContext +): Array => { + return (output || []).map((entry: any) => entry); +}; + +const deserializeAws_restJson1_1Tags = ( + output: any, + context: __SerdeContext +): { [key: string]: string } => { + let mapParams: any = {}; + Object.keys(output).forEach(key => { + mapParams[key] = output[key]; + }); + return mapParams; +}; + +const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ + httpStatusCode: output.statusCode, + httpHeaders: output.headers, + requestId: output.headers["x-amzn-requestid"] +}); + +const parseBody = (streamBody: any, context: __SerdeContext): any => { + return context.streamCollector(streamBody).then((body: any) => { + const encoded = context.utf8Encoder(body); + if (encoded.length) { + return JSON.parse(encoded); + } + return {}; + }); +}; diff --git a/clients/client-resource-groups/runtimeConfig.browser.ts b/clients/client-resource-groups/runtimeConfig.browser.ts new file mode 100644 index 000000000000..7a2fbdec5680 --- /dev/null +++ b/clients/client-resource-groups/runtimeConfig.browser.ts @@ -0,0 +1,30 @@ +import { invalidFunction } from "@aws-sdk/invalid-dependency"; +import { Sha256 } from "@aws-crypto/sha256-browser"; +import { FetchHttpHandler } from "@aws-sdk/fetch-http-handler"; +import { parseUrl } from "@aws-sdk/url-parser-browser"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { streamCollector } from "@aws-sdk/stream-collector-browser"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; +import { name, version } from "./package.json"; +import { ClientDefaults } from "./ResourceGroupsClient"; +import { ClientSharedValues } from "./runtimeConfig.shared"; + +export const ClientDefaultValues: Required = { + ...ClientSharedValues, + requestHandler: new FetchHttpHandler(), + sha256: Sha256, + urlParser: parseUrl, + bodyLengthChecker: calculateBodyLength, + streamCollector, + base64Decoder: fromBase64, + base64Encoder: toBase64, + utf8Decoder: fromUtf8, + utf8Encoder: toUtf8, + defaultUserAgent: defaultUserAgent(name, version), + runtime: "browser", + signingName: "resource-groups", + credentialDefaultProvider: invalidFunction("Credential is missing") as any, + regionDefaultProvider: invalidFunction("Region is missing") as any +}; diff --git a/clients/client-resource-groups/runtimeConfig.shared.ts b/clients/client-resource-groups/runtimeConfig.shared.ts new file mode 100644 index 000000000000..eea6c7c50459 --- /dev/null +++ b/clients/client-resource-groups/runtimeConfig.shared.ts @@ -0,0 +1,7 @@ +import { defaultRegionInfoProvider } from "./endpoints"; + +export const ClientSharedValues = { + apiVersion: "2017-11-27", + signingName: "resource-groups", + regionInfoProvider: defaultRegionInfoProvider +}; diff --git a/clients/client-resource-groups/runtimeConfig.ts b/clients/client-resource-groups/runtimeConfig.ts new file mode 100644 index 000000000000..2bb5cc878574 --- /dev/null +++ b/clients/client-resource-groups/runtimeConfig.ts @@ -0,0 +1,31 @@ +import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; +import { defaultProvider as regionDefaultProvider } from "@aws-sdk/region-provider"; +import { Hash } from "@aws-sdk/hash-node"; +import { NodeHttpHandler } from "@aws-sdk/node-http-handler"; +import { parseUrl } from "@aws-sdk/url-parser-node"; +import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { streamCollector } from "@aws-sdk/stream-collector-node"; +import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; +import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; +import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; +import { name, version } from "./package.json"; +import { ClientDefaults } from "./ResourceGroupsClient"; +import { ClientSharedValues } from "./runtimeConfig.shared"; + +export const ClientDefaultValues: Required = { + ...ClientSharedValues, + requestHandler: new NodeHttpHandler(), + sha256: Hash.bind(null, "sha256"), + urlParser: parseUrl, + bodyLengthChecker: calculateBodyLength, + streamCollector, + base64Decoder: fromBase64, + base64Encoder: toBase64, + utf8Decoder: fromUtf8, + utf8Encoder: toUtf8, + defaultUserAgent: defaultUserAgent(name, version), + runtime: "node", + signingName: "resource-groups", + credentialDefaultProvider, + regionDefaultProvider +}; diff --git a/clients/client-resource-groups/tsconfig.es.json b/clients/client-resource-groups/tsconfig.es.json new file mode 100644 index 000000000000..9add6a7c2445 --- /dev/null +++ b/clients/client-resource-groups/tsconfig.es.json @@ -0,0 +1,19 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "target": "es5", + "module": "esnext", + "moduleResolution": "node", + "declaration": false, + "declarationDir": null, + "lib": [ + "dom", + "es5", + "es2015.promise", + "es2015.collection", + "es2015.iterable", + "es2015.symbol.wellknown" + ], + "outDir": "dist/es" + } +} diff --git a/clients/client-resource-groups/tsconfig.json b/clients/client-resource-groups/tsconfig.json new file mode 100644 index 000000000000..ca2fadc08187 --- /dev/null +++ b/clients/client-resource-groups/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "alwaysStrict": true, + "target": "es2017", + "module": "commonjs", + "declaration": true, + "strict": true, + "sourceMap": true, + "downlevelIteration": true, + "importHelpers": true, + "noEmitHelpers": true, + "incremental": true, + "resolveJsonModule": true, + "declarationDir": "./types", + "outDir": "dist/cjs" + }, + "typedocOptions": { + "exclude": "**/node_modules/**", + "excludedNotExported": true, + "excludePrivate": true, + "hideGenerator": true, + "ignoreCompilerErrors": true, + "mode": "file", + "out": "./docs", + "plugin": "@aws-sdk/client-documentation-generator" + } +}