Skip to content

Commit

Permalink
feat(client-budgets): This release adds tag support for budgets and b…
Browse files Browse the repository at this point in the history
…udget actions.
  • Loading branch information
awstools committed May 7, 2024
1 parent 188916b commit da0c974
Show file tree
Hide file tree
Showing 16 changed files with 1,220 additions and 177 deletions.
38 changes: 31 additions & 7 deletions clients/client-budgets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ using your favorite package manager:

The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the `BudgetsClient` and
the commands you need, for example `DescribeBudgetsCommand`:
the commands you need, for example `ListTagsForResourceCommand`:

```js
// ES5 example
const { BudgetsClient, DescribeBudgetsCommand } = require("@aws-sdk/client-budgets");
const { BudgetsClient, ListTagsForResourceCommand } = require("@aws-sdk/client-budgets");
```

```ts
// ES6+ example
import { BudgetsClient, DescribeBudgetsCommand } from "@aws-sdk/client-budgets";
import { BudgetsClient, ListTagsForResourceCommand } from "@aws-sdk/client-budgets";
```

### Usage
Expand All @@ -93,7 +93,7 @@ const client = new BudgetsClient({ region: "REGION" });
const params = {
/** input parameters */
};
const command = new DescribeBudgetsCommand(params);
const command = new ListTagsForResourceCommand(params);
```

#### Async/await
Expand Down Expand Up @@ -172,15 +172,15 @@ const client = new AWS.Budgets({ region: "REGION" });

// async/await.
try {
const data = await client.describeBudgets(params);
const data = await client.listTagsForResource(params);
// process data.
} catch (error) {
// error handling.
}

// Promises.
client
.describeBudgets(params)
.listTagsForResource(params)
.then((data) => {
// process data.
})
Expand All @@ -189,7 +189,7 @@ client
});

// callbacks.
client.describeBudgets(params, (err, data) => {
client.listTagsForResource(params, (err, data) => {
// process err and data.
});
```
Expand Down Expand Up @@ -396,6 +396,30 @@ ExecuteBudgetAction

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/budgets/command/ExecuteBudgetActionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/ExecuteBudgetActionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/ExecuteBudgetActionCommandOutput/)

</details>
<details>
<summary>
ListTagsForResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/budgets/command/ListTagsForResourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/ListTagsForResourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/ListTagsForResourceCommandOutput/)

</details>
<details>
<summary>
TagResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/budgets/command/TagResourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/TagResourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/TagResourceCommandOutput/)

</details>
<details>
<summary>
UntagResource
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/budgets/command/UntagResourceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/UntagResourceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-budgets/Interface/UntagResourceCommandOutput/)

</details>
<details>
<summary>
Expand Down
53 changes: 53 additions & 0 deletions clients/client-budgets/src/Budgets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@ import {
ExecuteBudgetActionCommandInput,
ExecuteBudgetActionCommandOutput,
} from "./commands/ExecuteBudgetActionCommand";
import {
ListTagsForResourceCommand,
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
UntagResourceCommand,
UntagResourceCommandInput,
UntagResourceCommandOutput,
} from "./commands/UntagResourceCommand";
import {
UpdateBudgetActionCommand,
UpdateBudgetActionCommandInput,
Expand Down Expand Up @@ -139,6 +150,9 @@ const commands = {
DescribeNotificationsForBudgetCommand,
DescribeSubscribersForNotificationCommand,
ExecuteBudgetActionCommand,
ListTagsForResourceCommand,
TagResourceCommand,
UntagResourceCommand,
UpdateBudgetCommand,
UpdateBudgetActionCommand,
UpdateNotificationCommand,
Expand Down Expand Up @@ -451,6 +465,45 @@ export interface Budgets {
cb: (err: any, data?: ExecuteBudgetActionCommandOutput) => void
): void;

/**
* @see {@link ListTagsForResourceCommand}
*/
listTagsForResource(
args: ListTagsForResourceCommandInput,
options?: __HttpHandlerOptions
): Promise<ListTagsForResourceCommandOutput>;
listTagsForResource(
args: ListTagsForResourceCommandInput,
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
): void;
listTagsForResource(
args: ListTagsForResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListTagsForResourceCommandOutput) => void
): void;

/**
* @see {@link TagResourceCommand}
*/
tagResource(args: TagResourceCommandInput, options?: __HttpHandlerOptions): Promise<TagResourceCommandOutput>;
tagResource(args: TagResourceCommandInput, cb: (err: any, data?: TagResourceCommandOutput) => void): void;
tagResource(
args: TagResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TagResourceCommandOutput) => void
): void;

/**
* @see {@link UntagResourceCommand}
*/
untagResource(args: UntagResourceCommandInput, options?: __HttpHandlerOptions): Promise<UntagResourceCommandOutput>;
untagResource(args: UntagResourceCommandInput, cb: (err: any, data?: UntagResourceCommandOutput) => void): void;
untagResource(
args: UntagResourceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UntagResourceCommandOutput) => void
): void;

/**
* @see {@link UpdateBudgetCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-budgets/src/BudgetsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ import {
ExecuteBudgetActionCommandInput,
ExecuteBudgetActionCommandOutput,
} from "./commands/ExecuteBudgetActionCommand";
import {
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
} from "./commands/ListTagsForResourceCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import { UpdateBudgetActionCommandInput, UpdateBudgetActionCommandOutput } from "./commands/UpdateBudgetActionCommand";
import { UpdateBudgetCommandInput, UpdateBudgetCommandOutput } from "./commands/UpdateBudgetCommand";
import { UpdateNotificationCommandInput, UpdateNotificationCommandOutput } from "./commands/UpdateNotificationCommand";
Expand Down Expand Up @@ -137,6 +143,9 @@ export type ServiceInputTypes =
| DescribeNotificationsForBudgetCommandInput
| DescribeSubscribersForNotificationCommandInput
| ExecuteBudgetActionCommandInput
| ListTagsForResourceCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateBudgetActionCommandInput
| UpdateBudgetCommandInput
| UpdateNotificationCommandInput
Expand Down Expand Up @@ -165,6 +174,9 @@ export type ServiceOutputTypes =
| DescribeNotificationsForBudgetCommandOutput
| DescribeSubscribersForNotificationCommandOutput
| ExecuteBudgetActionCommandOutput
| ListTagsForResourceCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateBudgetActionCommandOutput
| UpdateBudgetCommandOutput
| UpdateNotificationCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ export interface CreateBudgetActionCommandOutput extends CreateBudgetActionRespo
* Address: "STRING_VALUE", // required
* },
* ],
* ResourceTags: [ // ResourceTagList
* { // ResourceTag
* Key: "STRING_VALUE", // required
* Value: "STRING_VALUE", // required
* },
* ],
* };
* const command = new CreateBudgetActionCommand(input);
* const response = await client.send(command);
Expand Down Expand Up @@ -119,6 +125,9 @@ export interface CreateBudgetActionCommandOutput extends CreateBudgetActionRespo
* @throws {@link NotFoundException} (client fault)
* <p>We can’t locate the resource that you specified.</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>You've reached the limit on the number of tags you can associate with a resource.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of API requests has exceeded the maximum allowed API request throttling limit
* for the account.</p>
Expand Down
9 changes: 9 additions & 0 deletions clients/client-budgets/src/commands/CreateBudgetCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ export interface CreateBudgetCommandOutput extends CreateBudgetResponse, __Metad
* ],
* },
* ],
* ResourceTags: [ // ResourceTagList
* { // ResourceTag
* Key: "STRING_VALUE", // required
* Value: "STRING_VALUE", // required
* },
* ],
* };
* const command = new CreateBudgetCommand(input);
* const response = await client.send(command);
Expand Down Expand Up @@ -140,6 +146,9 @@ export interface CreateBudgetCommandOutput extends CreateBudgetResponse, __Metad
* @throws {@link InvalidParameterException} (client fault)
* <p>An error on the client occurred. Typically, the cause is an invalid input value.</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>You've reached the limit on the number of tags you can associate with a resource.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of API requests has exceeded the maximum allowed API request throttling limit
* for the account.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export interface DeleteBudgetActionCommandOutput extends DeleteBudgetActionRespo
* <p>We can’t locate the resource that you specified.</p>
*
* @throws {@link ResourceLockedException} (client fault)
* <p> The request was received and recognized by the server, but the server rejected that
* particular method for the requested resource. </p>
* <p>The request was received and recognized by the server, but the server rejected that
* particular method for the requested resource.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of API requests has exceeded the maximum allowed API request throttling limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export interface DescribeBudgetNotificationsForAccountCommandOutput
__MetadataBearer {}

/**
* <p>
* Lists the budget names and notifications that are associated with an account.
* </p>
* <p> Lists the budget names and notifications that are associated with an account. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export interface ExecuteBudgetActionCommandOutput extends ExecuteBudgetActionRes
* <p>We can’t locate the resource that you specified.</p>
*
* @throws {@link ResourceLockedException} (client fault)
* <p> The request was received and recognized by the server, but the server rejected that
* particular method for the requested resource. </p>
* <p>The request was received and recognized by the server, but the server rejected that
* particular method for the requested resource.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of API requests has exceeded the maximum allowed API request throttling limit
Expand Down
102 changes: 102 additions & 0 deletions clients/client-budgets/src/commands/ListTagsForResourceCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { BudgetsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BudgetsClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { ListTagsForResourceRequest, ListTagsForResourceResponse } from "../models/models_0";
import { de_ListTagsForResourceCommand, se_ListTagsForResourceCommand } from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link ListTagsForResourceCommand}.
*/
export interface ListTagsForResourceCommandInput extends ListTagsForResourceRequest {}
/**
* @public
*
* The output of {@link ListTagsForResourceCommand}.
*/
export interface ListTagsForResourceCommandOutput extends ListTagsForResourceResponse, __MetadataBearer {}

/**
* <p>Lists tags associated with a budget or budget action resource.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BudgetsClient, ListTagsForResourceCommand } from "@aws-sdk/client-budgets"; // ES Modules import
* // const { BudgetsClient, ListTagsForResourceCommand } = require("@aws-sdk/client-budgets"); // CommonJS import
* const client = new BudgetsClient(config);
* const input = { // ListTagsForResourceRequest
* ResourceARN: "STRING_VALUE", // required
* };
* const command = new ListTagsForResourceCommand(input);
* const response = await client.send(command);
* // { // ListTagsForResourceResponse
* // ResourceTags: [ // ResourceTagList
* // { // ResourceTag
* // Key: "STRING_VALUE", // required
* // Value: "STRING_VALUE", // required
* // },
* // ],
* // };
*
* ```
*
* @param ListTagsForResourceCommandInput - {@link ListTagsForResourceCommandInput}
* @returns {@link ListTagsForResourceCommandOutput}
* @see {@link ListTagsForResourceCommandInput} for command's `input` shape.
* @see {@link ListTagsForResourceCommandOutput} for command's `response` shape.
* @see {@link BudgetsClientResolvedConfig | config} for BudgetsClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You are not authorized to use this operation with the given parameters.</p>
*
* @throws {@link InternalErrorException} (server fault)
* <p>An error on the server occurred during the processing of your request. Try again later.</p>
*
* @throws {@link InvalidParameterException} (client fault)
* <p>An error on the client occurred. Typically, the cause is an invalid input value.</p>
*
* @throws {@link NotFoundException} (client fault)
* <p>We can’t locate the resource that you specified.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of API requests has exceeded the maximum allowed API request throttling limit
* for the account.</p>
*
* @throws {@link BudgetsServiceException}
* <p>Base exception class for all service exceptions from Budgets service.</p>
*
* @public
*/
export class ListTagsForResourceCommand extends $Command
.classBuilder<
ListTagsForResourceCommandInput,
ListTagsForResourceCommandOutput,
BudgetsClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: BudgetsClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AWSBudgetServiceGateway", "ListTagsForResource", {})
.n("BudgetsClient", "ListTagsForResourceCommand")
.f(void 0, void 0)
.ser(se_ListTagsForResourceCommand)
.de(de_ListTagsForResourceCommand)
.build() {}
Loading

0 comments on commit da0c974

Please sign in to comment.