Skip to content

Commit dcc6ea3

Browse files
author
awstools
committed
feat(client-billing): Add ability to combine custom billing views to create new consolidated views.
1 parent 3dbdb5f commit dcc6ea3

14 files changed

+1337
-169
lines changed

clients/client-billing/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ see LICENSE for more information.
203203

204204
## Client Commands (Operations List)
205205

206+
<details>
207+
<summary>
208+
AssociateSourceViews
209+
</summary>
210+
211+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/billing/command/AssociateSourceViewsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/AssociateSourceViewsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/AssociateSourceViewsCommandOutput/)
212+
213+
</details>
206214
<details>
207215
<summary>
208216
CreateBillingView
@@ -218,6 +226,14 @@ DeleteBillingView
218226

219227
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/billing/command/DeleteBillingViewCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/DeleteBillingViewCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/DeleteBillingViewCommandOutput/)
220228

229+
</details>
230+
<details>
231+
<summary>
232+
DisassociateSourceViews
233+
</summary>
234+
235+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/billing/command/DisassociateSourceViewsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/DisassociateSourceViewsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-billing/Interface/DisassociateSourceViewsCommandOutput/)
236+
221237
</details>
222238
<details>
223239
<summary>

clients/client-billing/src/Billing.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { createAggregatedClient } from "@smithy/smithy-client";
33
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
44

55
import { BillingClient, BillingClientConfig } from "./BillingClient";
6+
import {
7+
AssociateSourceViewsCommand,
8+
AssociateSourceViewsCommandInput,
9+
AssociateSourceViewsCommandOutput,
10+
} from "./commands/AssociateSourceViewsCommand";
611
import {
712
CreateBillingViewCommand,
813
CreateBillingViewCommandInput,
@@ -13,6 +18,11 @@ import {
1318
DeleteBillingViewCommandInput,
1419
DeleteBillingViewCommandOutput,
1520
} from "./commands/DeleteBillingViewCommand";
21+
import {
22+
DisassociateSourceViewsCommand,
23+
DisassociateSourceViewsCommandInput,
24+
DisassociateSourceViewsCommandOutput,
25+
} from "./commands/DisassociateSourceViewsCommand";
1626
import {
1727
GetBillingViewCommand,
1828
GetBillingViewCommandInput,
@@ -51,8 +61,10 @@ import {
5161
} from "./commands/UpdateBillingViewCommand";
5262

5363
const commands = {
64+
AssociateSourceViewsCommand,
5465
CreateBillingViewCommand,
5566
DeleteBillingViewCommand,
67+
DisassociateSourceViewsCommand,
5668
GetBillingViewCommand,
5769
GetResourcePolicyCommand,
5870
ListBillingViewsCommand,
@@ -64,6 +76,23 @@ const commands = {
6476
};
6577

6678
export interface Billing {
79+
/**
80+
* @see {@link AssociateSourceViewsCommand}
81+
*/
82+
associateSourceViews(
83+
args: AssociateSourceViewsCommandInput,
84+
options?: __HttpHandlerOptions
85+
): Promise<AssociateSourceViewsCommandOutput>;
86+
associateSourceViews(
87+
args: AssociateSourceViewsCommandInput,
88+
cb: (err: any, data?: AssociateSourceViewsCommandOutput) => void
89+
): void;
90+
associateSourceViews(
91+
args: AssociateSourceViewsCommandInput,
92+
options: __HttpHandlerOptions,
93+
cb: (err: any, data?: AssociateSourceViewsCommandOutput) => void
94+
): void;
95+
6796
/**
6897
* @see {@link CreateBillingViewCommand}
6998
*/
@@ -98,6 +127,23 @@ export interface Billing {
98127
cb: (err: any, data?: DeleteBillingViewCommandOutput) => void
99128
): void;
100129

130+
/**
131+
* @see {@link DisassociateSourceViewsCommand}
132+
*/
133+
disassociateSourceViews(
134+
args: DisassociateSourceViewsCommandInput,
135+
options?: __HttpHandlerOptions
136+
): Promise<DisassociateSourceViewsCommandOutput>;
137+
disassociateSourceViews(
138+
args: DisassociateSourceViewsCommandInput,
139+
cb: (err: any, data?: DisassociateSourceViewsCommandOutput) => void
140+
): void;
141+
disassociateSourceViews(
142+
args: DisassociateSourceViewsCommandInput,
143+
options: __HttpHandlerOptions,
144+
cb: (err: any, data?: DisassociateSourceViewsCommandOutput) => void
145+
): void;
146+
101147
/**
102148
* @see {@link GetBillingViewCommand}
103149
*/

clients/client-billing/src/BillingClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@ import {
5353
HttpAuthSchemeResolvedConfig,
5454
resolveHttpAuthSchemeConfig,
5555
} from "./auth/httpAuthSchemeProvider";
56+
import {
57+
AssociateSourceViewsCommandInput,
58+
AssociateSourceViewsCommandOutput,
59+
} from "./commands/AssociateSourceViewsCommand";
5660
import { CreateBillingViewCommandInput, CreateBillingViewCommandOutput } from "./commands/CreateBillingViewCommand";
5761
import { DeleteBillingViewCommandInput, DeleteBillingViewCommandOutput } from "./commands/DeleteBillingViewCommand";
62+
import {
63+
DisassociateSourceViewsCommandInput,
64+
DisassociateSourceViewsCommandOutput,
65+
} from "./commands/DisassociateSourceViewsCommand";
5866
import { GetBillingViewCommandInput, GetBillingViewCommandOutput } from "./commands/GetBillingViewCommand";
5967
import { GetResourcePolicyCommandInput, GetResourcePolicyCommandOutput } from "./commands/GetResourcePolicyCommand";
6068
import { ListBillingViewsCommandInput, ListBillingViewsCommandOutput } from "./commands/ListBillingViewsCommand";
@@ -84,8 +92,10 @@ export { __Client };
8492
* @public
8593
*/
8694
export type ServiceInputTypes =
95+
| AssociateSourceViewsCommandInput
8796
| CreateBillingViewCommandInput
8897
| DeleteBillingViewCommandInput
98+
| DisassociateSourceViewsCommandInput
8999
| GetBillingViewCommandInput
90100
| GetResourcePolicyCommandInput
91101
| ListBillingViewsCommandInput
@@ -99,8 +109,10 @@ export type ServiceInputTypes =
99109
* @public
100110
*/
101111
export type ServiceOutputTypes =
112+
| AssociateSourceViewsCommandOutput
102113
| CreateBillingViewCommandOutput
103114
| DeleteBillingViewCommandOutput
115+
| DisassociateSourceViewsCommandOutput
104116
| GetBillingViewCommandOutput
105117
| GetResourcePolicyCommandOutput
106118
| ListBillingViewsCommandOutput
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { BillingClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BillingClient";
8+
import { commonParams } from "../endpoint/EndpointParameters";
9+
import { AssociateSourceViewsRequest, AssociateSourceViewsResponse } from "../models/models_0";
10+
import { de_AssociateSourceViewsCommand, se_AssociateSourceViewsCommand } from "../protocols/Aws_json1_0";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link AssociateSourceViewsCommand}.
21+
*/
22+
export interface AssociateSourceViewsCommandInput extends AssociateSourceViewsRequest {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link AssociateSourceViewsCommand}.
27+
*/
28+
export interface AssociateSourceViewsCommandOutput extends AssociateSourceViewsResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p> Associates one or more source billing views with an existing billing view. This allows creating aggregate billing views that combine data from multiple sources. </p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { BillingClient, AssociateSourceViewsCommand } from "@aws-sdk/client-billing"; // ES Modules import
36+
* // const { BillingClient, AssociateSourceViewsCommand } = require("@aws-sdk/client-billing"); // CommonJS import
37+
* // import type { BillingClientConfig } from "@aws-sdk/client-billing";
38+
* const config = {}; // type is BillingClientConfig
39+
* const client = new BillingClient(config);
40+
* const input = { // AssociateSourceViewsRequest
41+
* arn: "STRING_VALUE", // required
42+
* sourceViews: [ // BillingViewSourceViewsList // required
43+
* "STRING_VALUE",
44+
* ],
45+
* };
46+
* const command = new AssociateSourceViewsCommand(input);
47+
* const response = await client.send(command);
48+
* // { // AssociateSourceViewsResponse
49+
* // arn: "STRING_VALUE", // required
50+
* // };
51+
*
52+
* ```
53+
*
54+
* @param AssociateSourceViewsCommandInput - {@link AssociateSourceViewsCommandInput}
55+
* @returns {@link AssociateSourceViewsCommandOutput}
56+
* @see {@link AssociateSourceViewsCommandInput} for command's `input` shape.
57+
* @see {@link AssociateSourceViewsCommandOutput} for command's `response` shape.
58+
* @see {@link BillingClientResolvedConfig | config} for BillingClient's `config` shape.
59+
*
60+
* @throws {@link AccessDeniedException} (client fault)
61+
* <p>You don't have sufficient access to perform this action.</p>
62+
*
63+
* @throws {@link BillingViewHealthStatusException} (client fault)
64+
* <p> Exception thrown when a billing view's health status prevents an operation from being performed. This may occur if the billing view is in a state other than <code>HEALTHY</code>.</p>
65+
*
66+
* @throws {@link ConflictException} (client fault)
67+
* <p> The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. </p>
68+
*
69+
* @throws {@link InternalServerException} (server fault)
70+
* <p>The request processing failed because of an unknown error, exception, or failure. </p>
71+
*
72+
* @throws {@link ResourceNotFoundException} (client fault)
73+
* <p> The specified ARN in the request doesn't exist. </p>
74+
*
75+
* @throws {@link ServiceQuotaExceededException} (client fault)
76+
* <p> You've reached the limit of resources you can create, or exceeded the size of an individual resource. </p>
77+
*
78+
* @throws {@link ThrottlingException} (client fault)
79+
* <p>The request was denied due to request throttling. </p>
80+
*
81+
* @throws {@link ValidationException} (client fault)
82+
* <p>The input fails to satisfy the constraints specified by an Amazon Web Services service. </p>
83+
*
84+
* @throws {@link BillingServiceException}
85+
* <p>Base exception class for all service exceptions from Billing service.</p>
86+
*
87+
*
88+
* @example Invoke AssociateSourceViews
89+
* ```javascript
90+
* //
91+
* const input = {
92+
* arn: "arn:aws:billing::123456789012:billingview/custom-46f47cb2-a11d-43f3-983d-470b5708a899",
93+
* sourceViews: [
94+
* "arn:aws:billing::123456789012:billingview/primary",
95+
* "arn:aws:billing::123456789012:billingview/custom-d3f9c7e4-8b2f-4a6e-9d3b-2f7c8a1e5f6d"
96+
* ]
97+
* };
98+
* const command = new AssociateSourceViewsCommand(input);
99+
* const response = await client.send(command);
100+
* /* response is
101+
* {
102+
* arn: "arn:aws:billing::123456789012:billingview/custom-46f47cb2-a11d-43f3-983d-470b5708a899"
103+
* }
104+
* *\/
105+
* ```
106+
*
107+
* @public
108+
*/
109+
export class AssociateSourceViewsCommand extends $Command
110+
.classBuilder<
111+
AssociateSourceViewsCommandInput,
112+
AssociateSourceViewsCommandOutput,
113+
BillingClientResolvedConfig,
114+
ServiceInputTypes,
115+
ServiceOutputTypes
116+
>()
117+
.ep(commonParams)
118+
.m(function (this: any, Command: any, cs: any, config: BillingClientResolvedConfig, o: any) {
119+
return [
120+
getSerdePlugin(config, this.serialize, this.deserialize),
121+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
122+
];
123+
})
124+
.s("AWSBilling", "AssociateSourceViews", {})
125+
.n("BillingClient", "AssociateSourceViewsCommand")
126+
.f(void 0, void 0)
127+
.ser(se_AssociateSourceViewsCommand)
128+
.de(de_AssociateSourceViewsCommand)
129+
.build() {
130+
/** @internal type navigation helper, not in runtime. */
131+
protected declare static __types: {
132+
api: {
133+
input: AssociateSourceViewsRequest;
134+
output: AssociateSourceViewsResponse;
135+
};
136+
sdk: {
137+
input: AssociateSourceViewsCommandInput;
138+
output: AssociateSourceViewsCommandOutput;
139+
};
140+
};
141+
}

clients/client-billing/src/commands/CreateBillingViewCommand.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export interface CreateBillingViewCommandOutput extends CreateBillingViewRespons
6060
* "STRING_VALUE",
6161
* ],
6262
* },
63+
* timeRange: { // TimeRange
64+
* beginDateInclusive: new Date("TIMESTAMP"),
65+
* endDateInclusive: new Date("TIMESTAMP"),
66+
* },
6367
* },
6468
* clientToken: "STRING_VALUE",
6569
* resourceTags: [ // ResourceTagList
@@ -87,12 +91,18 @@ export interface CreateBillingViewCommandOutput extends CreateBillingViewRespons
8791
* @throws {@link AccessDeniedException} (client fault)
8892
* <p>You don't have sufficient access to perform this action.</p>
8993
*
94+
* @throws {@link BillingViewHealthStatusException} (client fault)
95+
* <p> Exception thrown when a billing view's health status prevents an operation from being performed. This may occur if the billing view is in a state other than <code>HEALTHY</code>.</p>
96+
*
9097
* @throws {@link ConflictException} (client fault)
9198
* <p> The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. </p>
9299
*
93100
* @throws {@link InternalServerException} (server fault)
94101
* <p>The request processing failed because of an unknown error, exception, or failure. </p>
95102
*
103+
* @throws {@link ResourceNotFoundException} (client fault)
104+
* <p> The specified ARN in the request doesn't exist. </p>
105+
*
96106
* @throws {@link ServiceQuotaExceededException} (client fault)
97107
* <p> You've reached the limit of resources you can create, or exceeded the size of an individual resource. </p>
98108
*

clients/client-billing/src/commands/DeleteBillingViewCommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface DeleteBillingViewCommandOutput extends DeleteBillingViewRespons
3939
* const client = new BillingClient(config);
4040
* const input = { // DeleteBillingViewRequest
4141
* arn: "STRING_VALUE", // required
42+
* force: true || false,
4243
* };
4344
* const command = new DeleteBillingViewCommand(input);
4445
* const response = await client.send(command);

0 commit comments

Comments
 (0)