@maxim_mazurok/gapi.client.cloudbilling-v1 0.0.20220722

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,838 @@
1
+ /* Type definitions for non-npm package Cloud Billing API v1 0.0 */
2
+ // Project: https://cloud.google.com/billing/
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+ // TypeScript Version: 2.8
8
+
9
+ // IMPORTANT
10
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
11
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
12
+ // Generated from: https://cloudbilling.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220722
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Cloud Billing API v1 */
19
+ function load(urlOrObject: "https://cloudbilling.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "cloudbilling", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "cloudbilling", version: "v1", callback: () => any): void;
24
+
25
+ namespace cloudbilling {
26
+ interface AggregationInfo {
27
+ /** The number of intervals to aggregate over. Example: If aggregation_level is "DAILY" and aggregation_count is 14, aggregation will be over 14 days. */
28
+ aggregationCount?: number;
29
+ aggregationInterval?: string;
30
+ aggregationLevel?: string;
31
+ }
32
+ interface AuditConfig {
33
+ /** The configuration for logging of each type of permission. */
34
+ auditLogConfigs?: AuditLogConfig[];
35
+ /**
36
+ * Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all
37
+ * services.
38
+ */
39
+ service?: string;
40
+ }
41
+ interface AuditLogConfig {
42
+ /** Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members. */
43
+ exemptedMembers?: string[];
44
+ /** The log type that this config enables. */
45
+ logType?: string;
46
+ }
47
+ interface BillingAccount {
48
+ /** The display name given to the billing account, such as `My Billing Account`. This name is displayed in the Google Cloud Console. */
49
+ displayName?: string;
50
+ /**
51
+ * If this account is a [subaccount](https://cloud.google.com/billing/docs/concepts), then this will be the resource name of the parent billing account that it is being resold through.
52
+ * Otherwise this will be empty.
53
+ */
54
+ masterBillingAccount?: string;
55
+ /**
56
+ * Output only. The resource name of the billing account. The resource name has the form `billingAccounts/{billing_account_id}`. For example, `billingAccounts/012345-567890-ABCDEF`
57
+ * would be the resource name for billing account `012345-567890-ABCDEF`.
58
+ */
59
+ name?: string;
60
+ /**
61
+ * Output only. True if the billing account is open, and will therefore be charged for any usage on associated projects. False if the billing account is closed, and therefore projects
62
+ * associated with it will be unable to use paid services.
63
+ */
64
+ open?: boolean;
65
+ }
66
+ interface Binding {
67
+ /**
68
+ * The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`,
69
+ * then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which
70
+ * resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
71
+ */
72
+ condition?: Expr;
73
+ /**
74
+ * Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on
75
+ * the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service
76
+ * account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that
77
+ * represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example,
78
+ * `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example,
79
+ * `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. *
80
+ * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example,
81
+ * `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service
82
+ * account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently
83
+ * deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in
84
+ * the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`.
85
+ */
86
+ members?: string[];
87
+ /** Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. */
88
+ role?: string;
89
+ }
90
+ interface Category {
91
+ /** The type of product the SKU refers to. Example: "Compute", "Storage", "Network", "ApplicationServices" etc. */
92
+ resourceFamily?: string;
93
+ /** A group classification for related SKUs. Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc. */
94
+ resourceGroup?: string;
95
+ /** The display name of the service this SKU belongs to. */
96
+ serviceDisplayName?: string;
97
+ /** Represents how the SKU is consumed. Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc. */
98
+ usageType?: string;
99
+ }
100
+ interface Expr {
101
+ /** Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. */
102
+ description?: string;
103
+ /** Textual representation of an expression in Common Expression Language syntax. */
104
+ expression?: string;
105
+ /** Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. */
106
+ location?: string;
107
+ /** Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. */
108
+ title?: string;
109
+ }
110
+ interface GeoTaxonomy {
111
+ /** The list of regions associated with a sku. Empty for Global skus, which are associated with all Google Cloud regions. */
112
+ regions?: string[];
113
+ /** The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL. */
114
+ type?: string;
115
+ }
116
+ interface ListBillingAccountsResponse {
117
+ /** A list of billing accounts. */
118
+ billingAccounts?: BillingAccount[];
119
+ /**
120
+ * A token to retrieve the next page of results. To retrieve the next page, call `ListBillingAccounts` again with the `page_token` field set to this value. This field is empty if there
121
+ * are no more results to retrieve.
122
+ */
123
+ nextPageToken?: string;
124
+ }
125
+ interface ListProjectBillingInfoResponse {
126
+ /**
127
+ * A token to retrieve the next page of results. To retrieve the next page, call `ListProjectBillingInfo` again with the `page_token` field set to this value. This field is empty if
128
+ * there are no more results to retrieve.
129
+ */
130
+ nextPageToken?: string;
131
+ /** A list of `ProjectBillingInfo` resources representing the projects associated with the billing account. */
132
+ projectBillingInfo?: ProjectBillingInfo[];
133
+ }
134
+ interface ListServicesResponse {
135
+ /**
136
+ * A token to retrieve the next page of results. To retrieve the next page, call `ListServices` again with the `page_token` field set to this value. This field is empty if there are no
137
+ * more results to retrieve.
138
+ */
139
+ nextPageToken?: string;
140
+ /** A list of services. */
141
+ services?: Service[];
142
+ }
143
+ interface ListSkusResponse {
144
+ /**
145
+ * A token to retrieve the next page of results. To retrieve the next page, call `ListSkus` again with the `page_token` field set to this value. This field is empty if there are no
146
+ * more results to retrieve.
147
+ */
148
+ nextPageToken?: string;
149
+ /** The list of public SKUs of the given service. */
150
+ skus?: Sku[];
151
+ }
152
+ interface Money {
153
+ /** The three-letter currency code defined in ISO 4217. */
154
+ currencyCode?: string;
155
+ /**
156
+ * Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units`
157
+ * is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and
158
+ * `nanos`=-750,000,000.
159
+ */
160
+ nanos?: number;
161
+ /** The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. */
162
+ units?: string;
163
+ }
164
+ interface Policy {
165
+ /** Specifies cloud audit logging configuration for this policy. */
166
+ auditConfigs?: AuditConfig[];
167
+ /**
168
+ * Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings`
169
+ * must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a
170
+ * principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another
171
+ * 1,450 principals to the `bindings` in the `Policy`.
172
+ */
173
+ bindings?: Binding[];
174
+ /**
175
+ * `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make
176
+ * use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems
177
+ * are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM
178
+ * Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1`
179
+ * policy, and all of the conditions in the version `3` policy are lost.
180
+ */
181
+ etag?: string;
182
+ /**
183
+ * Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings
184
+ * must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a
185
+ * policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use
186
+ * IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1`
187
+ * policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave
188
+ * the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
189
+ */
190
+ version?: number;
191
+ }
192
+ interface PricingExpression {
193
+ /** The base unit for the SKU which is the unit used in usage exports. Example: "By" */
194
+ baseUnit?: string;
195
+ /**
196
+ * Conversion factor for converting from price per usage_unit to price per base_unit, and start_usage_amount to start_usage_amount in base_unit. unit_price /
197
+ * base_unit_conversion_factor = price per base_unit. start_usage_amount * base_unit_conversion_factor = start_usage_amount in base_unit.
198
+ */
199
+ baseUnitConversionFactor?: number;
200
+ /** The base unit in human readable form. Example: "byte". */
201
+ baseUnitDescription?: string;
202
+ /**
203
+ * The recommended quantity of units for displaying pricing info. When displaying pricing info it is recommended to display: (unit_price * display_quantity) per display_quantity
204
+ * usage_unit. This field does not affect the pricing formula and is for display purposes only. Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and the
205
+ * display_quantity is "1000" then the recommended way of displaying the pricing info is "0.10 USD per 1000 GB"
206
+ */
207
+ displayQuantity?: number;
208
+ /**
209
+ * The list of tiered rates for this pricing. The total cost is computed by applying each of the tiered rates on usage. This repeated list is sorted by ascending order of
210
+ * start_usage_amount.
211
+ */
212
+ tieredRates?: TierRate[];
213
+ /** The short hand for unit of usage this pricing is specified in. Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte". */
214
+ usageUnit?: string;
215
+ /** The unit of usage in human readable form. Example: "gibi byte". */
216
+ usageUnitDescription?: string;
217
+ }
218
+ interface PricingInfo {
219
+ /** Aggregation Info. This can be left unspecified if the pricing expression doesn't require aggregation. */
220
+ aggregationInfo?: AggregationInfo;
221
+ /**
222
+ * Conversion rate used for currency conversion, from USD to the currency specified in the request. This includes any surcharge collected for billing in non USD currency. If a currency
223
+ * is not specified in the request this defaults to 1.0. Example: USD * currency_conversion_rate = JPY
224
+ */
225
+ currencyConversionRate?: number;
226
+ /**
227
+ * The timestamp from which this pricing was effective within the requested time range. This is guaranteed to be greater than or equal to the start_time field in the request and less
228
+ * than the end_time field in the request. If a time range was not specified in the request this field will be equivalent to a time within the last 12 hours, indicating the latest
229
+ * pricing info.
230
+ */
231
+ effectiveTime?: string;
232
+ /** Expresses the pricing formula. See `PricingExpression` for an example. */
233
+ pricingExpression?: PricingExpression;
234
+ /** An optional human readable summary of the pricing information, has a maximum length of 256 characters. */
235
+ summary?: string;
236
+ }
237
+ interface ProjectBillingInfo {
238
+ /** The resource name of the billing account associated with the project, if any. For example, `billingAccounts/012345-567890-ABCDEF`. */
239
+ billingAccountName?: string;
240
+ /**
241
+ * True if the project is associated with an open billing account, to which usage on the project is charged. False if the project is associated with a closed billing account, or no
242
+ * billing account at all, and therefore cannot use paid services. This field is read-only.
243
+ */
244
+ billingEnabled?: boolean;
245
+ /**
246
+ * The resource name for the `ProjectBillingInfo`; has the form `projects/{project_id}/billingInfo`. For example, the resource name for the billing information for project
247
+ * `tokyo-rain-123` would be `projects/tokyo-rain-123/billingInfo`. This field is read-only.
248
+ */
249
+ name?: string;
250
+ /**
251
+ * The ID of the project that this `ProjectBillingInfo` represents, such as `tokyo-rain-123`. This is a convenience field so that you don't need to parse the `name` field to obtain a
252
+ * project ID. This field is read-only.
253
+ */
254
+ projectId?: string;
255
+ }
256
+ interface Service {
257
+ /** The business under which the service is offered. Ex. "businessEntities/GCP", "businessEntities/Maps" */
258
+ businessEntityName?: string;
259
+ /** A human readable display name for this service. */
260
+ displayName?: string;
261
+ /** The resource name for the service. Example: "services/DA34-426B-A397" */
262
+ name?: string;
263
+ /** The identifier for the service. Example: "DA34-426B-A397" */
264
+ serviceId?: string;
265
+ }
266
+ interface SetIamPolicyRequest {
267
+ /**
268
+ * REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud
269
+ * services (such as Projects) might reject them.
270
+ */
271
+ policy?: Policy;
272
+ /**
273
+ * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:
274
+ * `paths: "bindings, etag"`
275
+ */
276
+ updateMask?: string;
277
+ }
278
+ interface Sku {
279
+ /** The category hierarchy of this SKU, purely for organizational purpose. */
280
+ category?: Category;
281
+ /** A human readable description of the SKU, has a maximum length of 256 characters. */
282
+ description?: string;
283
+ /** The geographic taxonomy for this sku. */
284
+ geoTaxonomy?: GeoTaxonomy;
285
+ /** The resource name for the SKU. Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE" */
286
+ name?: string;
287
+ /** A timeline of pricing info for this SKU in chronological order. */
288
+ pricingInfo?: PricingInfo[];
289
+ /** Identifies the service provider. This is 'Google' for first party services in Google Cloud Platform. */
290
+ serviceProviderName?: string;
291
+ /** List of service regions this SKU is offered at. Example: "asia-east1" Service regions can be found at https://cloud.google.com/about/locations/ */
292
+ serviceRegions?: string[];
293
+ /** The identifier for the SKU. Example: "AA95-CD31-42FE" */
294
+ skuId?: string;
295
+ }
296
+ interface TestIamPermissionsRequest {
297
+ /**
298
+ * The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM
299
+ * Overview](https://cloud.google.com/iam/docs/overview#permissions).
300
+ */
301
+ permissions?: string[];
302
+ }
303
+ interface TestIamPermissionsResponse {
304
+ /** A subset of `TestPermissionsRequest.permissions` that the caller is allowed. */
305
+ permissions?: string[];
306
+ }
307
+ interface TierRate {
308
+ /** Usage is priced at this rate only after this amount. Example: start_usage_amount of 10 indicates that the usage will be priced at the unit_price after the first 10 usage_units. */
309
+ startUsageAmount?: number;
310
+ /** The price per unit of usage. Example: unit_price of amount $10 indicates that each unit will cost $10. */
311
+ unitPrice?: Money;
312
+ }
313
+ interface ProjectsResource {
314
+ /**
315
+ * Lists the projects associated with a billing account. The current authenticated user must have the `billing.resourceAssociations.list` IAM permission, which is often given to
316
+ * billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
317
+ */
318
+ list(request?: {
319
+ /** V1 error format. */
320
+ "$.xgafv"?: string;
321
+ /** OAuth access token. */
322
+ access_token?: string;
323
+ /** Data format for response. */
324
+ alt?: string;
325
+ /** JSONP */
326
+ callback?: string;
327
+ /** Selector specifying which fields to include in a partial response. */
328
+ fields?: string;
329
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
330
+ key?: string;
331
+ /** Required. The resource name of the billing account associated with the projects that you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. */
332
+ name: string;
333
+ /** OAuth 2.0 token for the current user. */
334
+ oauth_token?: string;
335
+ /** Requested page size. The maximum page size is 100; this is also the default. */
336
+ pageSize?: number;
337
+ /**
338
+ * A token identifying a page of results to be returned. This should be a `next_page_token` value returned from a previous `ListProjectBillingInfo` call. If unspecified, the first
339
+ * page of results is returned.
340
+ */
341
+ pageToken?: string;
342
+ /** Returns response with indentations and line breaks. */
343
+ prettyPrint?: boolean;
344
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
345
+ quotaUser?: string;
346
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
347
+ upload_protocol?: string;
348
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
349
+ uploadType?: string;
350
+ }): Request<ListProjectBillingInfoResponse>;
351
+ }
352
+ interface BillingAccountsResource {
353
+ /**
354
+ * This method creates [billing subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts). Google Cloud resellers should use the Channel Services APIs,
355
+ * [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create) and
356
+ * [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create). When creating a subaccount, the current
357
+ * authenticated user must have the `billing.accounts.update` IAM permission on the parent account, which is typically given to billing account
358
+ * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the parent account has not been provisioned as a reseller account.
359
+ */
360
+ create(request: {
361
+ /** V1 error format. */
362
+ "$.xgafv"?: string;
363
+ /** OAuth access token. */
364
+ access_token?: string;
365
+ /** Data format for response. */
366
+ alt?: string;
367
+ /** JSONP */
368
+ callback?: string;
369
+ /** Selector specifying which fields to include in a partial response. */
370
+ fields?: string;
371
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
372
+ key?: string;
373
+ /** OAuth 2.0 token for the current user. */
374
+ oauth_token?: string;
375
+ /** Returns response with indentations and line breaks. */
376
+ prettyPrint?: boolean;
377
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
378
+ quotaUser?: string;
379
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
380
+ upload_protocol?: string;
381
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
382
+ uploadType?: string;
383
+ /** Request body */
384
+ resource: BillingAccount;
385
+ }): Request<BillingAccount>;
386
+ create(request: {
387
+ /** V1 error format. */
388
+ "$.xgafv"?: string;
389
+ /** OAuth access token. */
390
+ access_token?: string;
391
+ /** Data format for response. */
392
+ alt?: string;
393
+ /** JSONP */
394
+ callback?: string;
395
+ /** Selector specifying which fields to include in a partial response. */
396
+ fields?: string;
397
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
398
+ key?: string;
399
+ /** OAuth 2.0 token for the current user. */
400
+ oauth_token?: string;
401
+ /** Returns response with indentations and line breaks. */
402
+ prettyPrint?: boolean;
403
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
404
+ quotaUser?: string;
405
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
406
+ upload_protocol?: string;
407
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
408
+ uploadType?: string;
409
+ },
410
+ body: BillingAccount): Request<BillingAccount>;
411
+ /** Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). */
412
+ get(request?: {
413
+ /** V1 error format. */
414
+ "$.xgafv"?: string;
415
+ /** OAuth access token. */
416
+ access_token?: string;
417
+ /** Data format for response. */
418
+ alt?: string;
419
+ /** JSONP */
420
+ callback?: string;
421
+ /** Selector specifying which fields to include in a partial response. */
422
+ fields?: string;
423
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
424
+ key?: string;
425
+ /** Required. The resource name of the billing account to retrieve. For example, `billingAccounts/012345-567890-ABCDEF`. */
426
+ name: string;
427
+ /** OAuth 2.0 token for the current user. */
428
+ oauth_token?: string;
429
+ /** Returns response with indentations and line breaks. */
430
+ prettyPrint?: boolean;
431
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
432
+ quotaUser?: string;
433
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
434
+ upload_protocol?: string;
435
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
436
+ uploadType?: string;
437
+ }): Request<BillingAccount>;
438
+ /**
439
+ * Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account
440
+ * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
441
+ */
442
+ getIamPolicy(request?: {
443
+ /** V1 error format. */
444
+ "$.xgafv"?: string;
445
+ /** OAuth access token. */
446
+ access_token?: string;
447
+ /** Data format for response. */
448
+ alt?: string;
449
+ /** JSONP */
450
+ callback?: string;
451
+ /** Selector specifying which fields to include in a partial response. */
452
+ fields?: string;
453
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
454
+ key?: string;
455
+ /** OAuth 2.0 token for the current user. */
456
+ oauth_token?: string;
457
+ /**
458
+ * Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for
459
+ * policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy
460
+ * in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional
461
+ * role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM
462
+ * documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
463
+ */
464
+ "options.requestedPolicyVersion"?: number;
465
+ /** Returns response with indentations and line breaks. */
466
+ prettyPrint?: boolean;
467
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
468
+ quotaUser?: string;
469
+ /**
470
+ * REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this
471
+ * field.
472
+ */
473
+ resource: string;
474
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
475
+ upload_protocol?: string;
476
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
477
+ uploadType?: string;
478
+ }): Request<Policy>;
479
+ /** Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access). */
480
+ list(request?: {
481
+ /** V1 error format. */
482
+ "$.xgafv"?: string;
483
+ /** OAuth access token. */
484
+ access_token?: string;
485
+ /** Data format for response. */
486
+ alt?: string;
487
+ /** JSONP */
488
+ callback?: string;
489
+ /** Selector specifying which fields to include in a partial response. */
490
+ fields?: string;
491
+ /**
492
+ * Options for how to filter the returned billing accounts. Currently this only supports filtering for [subaccounts](https://cloud.google.com/billing/docs/concepts) under a single
493
+ * provided reseller billing account. (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). Boolean algebra and other fields are not currently supported.
494
+ */
495
+ filter?: string;
496
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
497
+ key?: string;
498
+ /** OAuth 2.0 token for the current user. */
499
+ oauth_token?: string;
500
+ /** Requested page size. The maximum page size is 100; this is also the default. */
501
+ pageSize?: number;
502
+ /**
503
+ * A token identifying a page of results to return. This should be a `next_page_token` value returned from a previous `ListBillingAccounts` call. If unspecified, the first page of
504
+ * results is returned.
505
+ */
506
+ pageToken?: string;
507
+ /** Returns response with indentations and line breaks. */
508
+ prettyPrint?: boolean;
509
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
510
+ quotaUser?: string;
511
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
512
+ upload_protocol?: string;
513
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
514
+ uploadType?: string;
515
+ }): Request<ListBillingAccountsResponse>;
516
+ /**
517
+ * Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM
518
+ * permission, which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.
519
+ */
520
+ patch(request: {
521
+ /** V1 error format. */
522
+ "$.xgafv"?: string;
523
+ /** OAuth access token. */
524
+ access_token?: string;
525
+ /** Data format for response. */
526
+ alt?: string;
527
+ /** JSONP */
528
+ callback?: string;
529
+ /** Selector specifying which fields to include in a partial response. */
530
+ fields?: string;
531
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
532
+ key?: string;
533
+ /** Required. The name of the billing account resource to be updated. */
534
+ name: string;
535
+ /** OAuth 2.0 token for the current user. */
536
+ oauth_token?: string;
537
+ /** Returns response with indentations and line breaks. */
538
+ prettyPrint?: boolean;
539
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
540
+ quotaUser?: string;
541
+ /** The update mask applied to the resource. Only "display_name" is currently supported. */
542
+ updateMask?: string;
543
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
544
+ upload_protocol?: string;
545
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
546
+ uploadType?: string;
547
+ /** Request body */
548
+ resource: BillingAccount;
549
+ }): Request<BillingAccount>;
550
+ patch(request: {
551
+ /** V1 error format. */
552
+ "$.xgafv"?: string;
553
+ /** OAuth access token. */
554
+ access_token?: string;
555
+ /** Data format for response. */
556
+ alt?: string;
557
+ /** JSONP */
558
+ callback?: string;
559
+ /** Selector specifying which fields to include in a partial response. */
560
+ fields?: string;
561
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
562
+ key?: string;
563
+ /** Required. The name of the billing account resource to be updated. */
564
+ name: string;
565
+ /** OAuth 2.0 token for the current user. */
566
+ oauth_token?: string;
567
+ /** Returns response with indentations and line breaks. */
568
+ prettyPrint?: boolean;
569
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
570
+ quotaUser?: string;
571
+ /** The update mask applied to the resource. Only "display_name" is currently supported. */
572
+ updateMask?: string;
573
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
574
+ upload_protocol?: string;
575
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
576
+ uploadType?: string;
577
+ },
578
+ body: BillingAccount): Request<BillingAccount>;
579
+ /**
580
+ * Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is
581
+ * often given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
582
+ */
583
+ setIamPolicy(request: {
584
+ /** V1 error format. */
585
+ "$.xgafv"?: string;
586
+ /** OAuth access token. */
587
+ access_token?: string;
588
+ /** Data format for response. */
589
+ alt?: string;
590
+ /** JSONP */
591
+ callback?: string;
592
+ /** Selector specifying which fields to include in a partial response. */
593
+ fields?: string;
594
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
595
+ key?: string;
596
+ /** OAuth 2.0 token for the current user. */
597
+ oauth_token?: string;
598
+ /** Returns response with indentations and line breaks. */
599
+ prettyPrint?: boolean;
600
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
601
+ quotaUser?: string;
602
+ /**
603
+ * REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this
604
+ * field.
605
+ */
606
+ resource: string;
607
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
608
+ upload_protocol?: string;
609
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
610
+ uploadType?: string;
611
+ },
612
+ body: SetIamPolicyRequest): Request<Policy>;
613
+ /**
614
+ * Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the
615
+ * caller is allowed for that resource.
616
+ */
617
+ testIamPermissions(request: {
618
+ /** V1 error format. */
619
+ "$.xgafv"?: string;
620
+ /** OAuth access token. */
621
+ access_token?: string;
622
+ /** Data format for response. */
623
+ alt?: string;
624
+ /** JSONP */
625
+ callback?: string;
626
+ /** Selector specifying which fields to include in a partial response. */
627
+ fields?: string;
628
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
629
+ key?: string;
630
+ /** OAuth 2.0 token for the current user. */
631
+ oauth_token?: string;
632
+ /** Returns response with indentations and line breaks. */
633
+ prettyPrint?: boolean;
634
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
635
+ quotaUser?: string;
636
+ /**
637
+ * REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for
638
+ * this field.
639
+ */
640
+ resource: string;
641
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
642
+ upload_protocol?: string;
643
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
644
+ uploadType?: string;
645
+ },
646
+ body: TestIamPermissionsRequest): Request<TestIamPermissionsResponse>;
647
+ projects: ProjectsResource;
648
+ }
649
+ interface ProjectsResource {
650
+ /**
651
+ * Gets the billing information for a project. The current authenticated user must have the `resourcemanager.projects.get` permission for the project, which can be granted by assigning
652
+ * the [Project Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) role.
653
+ */
654
+ getBillingInfo(request?: {
655
+ /** V1 error format. */
656
+ "$.xgafv"?: string;
657
+ /** OAuth access token. */
658
+ access_token?: string;
659
+ /** Data format for response. */
660
+ alt?: string;
661
+ /** JSONP */
662
+ callback?: string;
663
+ /** Selector specifying which fields to include in a partial response. */
664
+ fields?: string;
665
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
666
+ key?: string;
667
+ /** Required. The resource name of the project for which billing information is retrieved. For example, `projects/tokyo-rain-123`. */
668
+ name: string;
669
+ /** OAuth 2.0 token for the current user. */
670
+ oauth_token?: string;
671
+ /** Returns response with indentations and line breaks. */
672
+ prettyPrint?: boolean;
673
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
674
+ quotaUser?: string;
675
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
676
+ upload_protocol?: string;
677
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
678
+ uploadType?: string;
679
+ }): Request<ProjectBillingInfo>;
680
+ /**
681
+ * Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the
682
+ * resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already
683
+ * had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history
684
+ * of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current
685
+ * authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing
686
+ * account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action
687
+ * disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any
688
+ * unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing
689
+ * account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used
690
+ * by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.
691
+ */
692
+ updateBillingInfo(request: {
693
+ /** V1 error format. */
694
+ "$.xgafv"?: string;
695
+ /** OAuth access token. */
696
+ access_token?: string;
697
+ /** Data format for response. */
698
+ alt?: string;
699
+ /** JSONP */
700
+ callback?: string;
701
+ /** Selector specifying which fields to include in a partial response. */
702
+ fields?: string;
703
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
704
+ key?: string;
705
+ /** Required. The resource name of the project associated with the billing information that you want to update. For example, `projects/tokyo-rain-123`. */
706
+ name: string;
707
+ /** OAuth 2.0 token for the current user. */
708
+ oauth_token?: string;
709
+ /** Returns response with indentations and line breaks. */
710
+ prettyPrint?: boolean;
711
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
712
+ quotaUser?: string;
713
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
714
+ upload_protocol?: string;
715
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
716
+ uploadType?: string;
717
+ /** Request body */
718
+ resource: ProjectBillingInfo;
719
+ }): Request<ProjectBillingInfo>;
720
+ updateBillingInfo(request: {
721
+ /** V1 error format. */
722
+ "$.xgafv"?: string;
723
+ /** OAuth access token. */
724
+ access_token?: string;
725
+ /** Data format for response. */
726
+ alt?: string;
727
+ /** JSONP */
728
+ callback?: string;
729
+ /** Selector specifying which fields to include in a partial response. */
730
+ fields?: string;
731
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
732
+ key?: string;
733
+ /** Required. The resource name of the project associated with the billing information that you want to update. For example, `projects/tokyo-rain-123`. */
734
+ name: string;
735
+ /** OAuth 2.0 token for the current user. */
736
+ oauth_token?: string;
737
+ /** Returns response with indentations and line breaks. */
738
+ prettyPrint?: boolean;
739
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
740
+ quotaUser?: string;
741
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
742
+ upload_protocol?: string;
743
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
744
+ uploadType?: string;
745
+ },
746
+ body: ProjectBillingInfo): Request<ProjectBillingInfo>;
747
+ }
748
+ interface SkusResource {
749
+ /** Lists all publicly available SKUs for a given cloud service. */
750
+ list(request?: {
751
+ /** V1 error format. */
752
+ "$.xgafv"?: string;
753
+ /** OAuth access token. */
754
+ access_token?: string;
755
+ /** Data format for response. */
756
+ alt?: string;
757
+ /** JSONP */
758
+ callback?: string;
759
+ /** The ISO 4217 currency code for the pricing info in the response proto. Will use the conversion rate as of start_time. Optional. If not specified USD will be used. */
760
+ currencyCode?: string;
761
+ /**
762
+ * Optional exclusive end time of the time range for which the pricing versions will be returned. Timestamps in the future are not allowed. The time range has to be within a single
763
+ * calendar month in America/Los_Angeles timezone. Time range as a whole is optional. If not specified, the latest pricing will be returned (up to 12 hours old at most).
764
+ */
765
+ endTime?: string;
766
+ /** Selector specifying which fields to include in a partial response. */
767
+ fields?: string;
768
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
769
+ key?: string;
770
+ /** OAuth 2.0 token for the current user. */
771
+ oauth_token?: string;
772
+ /** Requested page size. Defaults to 5000. */
773
+ pageSize?: number;
774
+ /**
775
+ * A token identifying a page of results to return. This should be a `next_page_token` value returned from a previous `ListSkus` call. If unspecified, the first page of results is
776
+ * returned.
777
+ */
778
+ pageToken?: string;
779
+ /** Required. The name of the service. Example: "services/DA34-426B-A397" */
780
+ parent: string;
781
+ /** Returns response with indentations and line breaks. */
782
+ prettyPrint?: boolean;
783
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
784
+ quotaUser?: string;
785
+ /**
786
+ * Optional inclusive start time of the time range for which the pricing versions will be returned. Timestamps in the future are not allowed. The time range has to be within a
787
+ * single calendar month in America/Los_Angeles timezone. Time range as a whole is optional. If not specified, the latest pricing will be returned (up to 12 hours old at most).
788
+ */
789
+ startTime?: string;
790
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
791
+ upload_protocol?: string;
792
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
793
+ uploadType?: string;
794
+ }): Request<ListSkusResponse>;
795
+ }
796
+ interface ServicesResource {
797
+ /** Lists all public cloud services. */
798
+ list(request?: {
799
+ /** V1 error format. */
800
+ "$.xgafv"?: string;
801
+ /** OAuth access token. */
802
+ access_token?: string;
803
+ /** Data format for response. */
804
+ alt?: string;
805
+ /** JSONP */
806
+ callback?: string;
807
+ /** Selector specifying which fields to include in a partial response. */
808
+ fields?: string;
809
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
810
+ key?: string;
811
+ /** OAuth 2.0 token for the current user. */
812
+ oauth_token?: string;
813
+ /** Requested page size. Defaults to 5000. */
814
+ pageSize?: number;
815
+ /**
816
+ * A token identifying a page of results to return. This should be a `next_page_token` value returned from a previous `ListServices` call. If unspecified, the first page of results
817
+ * is returned.
818
+ */
819
+ pageToken?: string;
820
+ /** Returns response with indentations and line breaks. */
821
+ prettyPrint?: boolean;
822
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
823
+ quotaUser?: string;
824
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
825
+ upload_protocol?: string;
826
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
827
+ uploadType?: string;
828
+ }): Request<ListServicesResponse>;
829
+ skus: SkusResource;
830
+ }
831
+
832
+ const billingAccounts: BillingAccountsResource;
833
+
834
+ const projects: ProjectsResource;
835
+
836
+ const services: ServicesResource;
837
+ }
838
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.cloudbilling-v1",
3
+ "version": "0.0.20220722",
4
+ "description": "TypeScript typings for Cloud Billing API v1",
5
+ "license": "MIT",
6
+ "author": {
7
+ "email": "maxim@mazurok.com",
8
+ "name": "Maxim Mazurok",
9
+ "url": "https://maxim.mazurok.com"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,124 @@
1
+ # TypeScript typings for Cloud Billing API v1
2
+
3
+ Allows developers to manage billing for their Google Cloud Platform projects programmatically.
4
+ For detailed description please check [documentation](https://cloud.google.com/billing/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Cloud Billing API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.cloudbilling-v1 --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load('https://cloudbilling.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.cloudbilling
31
+ });
32
+ ```
33
+
34
+ ```typescript
35
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
36
+ gapi.client.load('cloudbilling', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.cloudbilling
39
+ });
40
+ ```
41
+
42
+ Don't forget to authenticate your client before sending any request to resources:
43
+
44
+ ```typescript
45
+ // declare client_id registered in Google Developers Console
46
+ var client_id = '',
47
+ scope = [
48
+ // View and manage your Google Cloud Platform billing accounts
49
+ 'https://www.googleapis.com/auth/cloud-billing',
50
+
51
+ // View your Google Cloud Platform billing accounts
52
+ 'https://www.googleapis.com/auth/cloud-billing.readonly',
53
+
54
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
55
+ 'https://www.googleapis.com/auth/cloud-platform',
56
+ ],
57
+ immediate = true;
58
+ // ...
59
+
60
+ gapi.auth.authorize(
61
+ { client_id: client_id, scope: scope, immediate: immediate },
62
+ authResult => {
63
+ if (authResult && !authResult.error) {
64
+ /* handle successful authorization */
65
+ } else {
66
+ /* handle authorization error */
67
+ }
68
+ });
69
+ ```
70
+
71
+ After that you can use Cloud Billing API resources: <!-- TODO: make this work for multiple namespaces -->
72
+
73
+ ```typescript
74
+
75
+ /*
76
+ This method creates [billing subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts). Google Cloud resellers should use the Channel Services APIs, [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create) and [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create). When creating a subaccount, the current authenticated user must have the `billing.accounts.update` IAM permission on the parent account, which is typically given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the parent account has not been provisioned as a reseller account.
77
+ */
78
+ await gapi.client.cloudbilling.billingAccounts.create({ });
79
+
80
+ /*
81
+ Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access).
82
+ */
83
+ await gapi.client.cloudbilling.billingAccounts.get({ name: "name", });
84
+
85
+ /*
86
+ Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
87
+ */
88
+ await gapi.client.cloudbilling.billingAccounts.getIamPolicy({ resource: "resource", });
89
+
90
+ /*
91
+ Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access).
92
+ */
93
+ await gapi.client.cloudbilling.billingAccounts.list({ });
94
+
95
+ /*
96
+ Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM permission, which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.
97
+ */
98
+ await gapi.client.cloudbilling.billingAccounts.patch({ name: "name", });
99
+
100
+ /*
101
+ Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is often given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
102
+ */
103
+ await gapi.client.cloudbilling.billingAccounts.setIamPolicy({ resource: "resource", });
104
+
105
+ /*
106
+ Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.
107
+ */
108
+ await gapi.client.cloudbilling.billingAccounts.testIamPermissions({ resource: "resource", });
109
+
110
+ /*
111
+ Gets the billing information for a project. The current authenticated user must have the `resourcemanager.projects.get` permission for the project, which can be granted by assigning the [Project Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) role.
112
+ */
113
+ await gapi.client.cloudbilling.projects.getBillingInfo({ name: "name", });
114
+
115
+ /*
116
+ Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.
117
+ */
118
+ await gapi.client.cloudbilling.projects.updateBillingInfo({ name: "name", });
119
+
120
+ /*
121
+ Lists all public cloud services.
122
+ */
123
+ await gapi.client.cloudbilling.services.list({ });
124
+ ```
package/tests.ts ADDED
@@ -0,0 +1,183 @@
1
+ /* This is stub file for gapi.client.cloudbilling-v1 definition tests */
2
+ // IMPORTANT
3
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
+
6
+ // Revision: 20220722
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://cloudbilling.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.cloudbilling */
13
+
14
+ /** don't forget to authenticate your client before sending any request to resources: */
15
+ /** declare client_id registered in Google Developers Console */
16
+ const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
+ const scope = [
18
+ /** View and manage your Google Cloud Platform billing accounts */
19
+ 'https://www.googleapis.com/auth/cloud-billing',
20
+ /** View your Google Cloud Platform billing accounts */
21
+ 'https://www.googleapis.com/auth/cloud-billing.readonly',
22
+ /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
23
+ 'https://www.googleapis.com/auth/cloud-platform',
24
+ ];
25
+ const immediate = false;
26
+ gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
27
+ if (authResult && !authResult.error) {
28
+ /** handle successful authorization */
29
+ run();
30
+ } else {
31
+ /** handle authorization error */
32
+ }
33
+ });
34
+
35
+ async function run() {
36
+ /**
37
+ * This method creates [billing subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts). Google Cloud resellers should use the Channel Services APIs,
38
+ * [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create) and
39
+ * [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create). When creating a subaccount, the current
40
+ * authenticated user must have the `billing.accounts.update` IAM permission on the parent account, which is typically given to billing account
41
+ * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will return an error if the parent account has not been provisioned as a reseller account.
42
+ */
43
+ await gapi.client.cloudbilling.billingAccounts.create({
44
+ }, {
45
+ displayName: "Test string",
46
+ masterBillingAccount: "Test string",
47
+ name: "Test string",
48
+ open: true,
49
+ });
50
+ /** Gets information about a billing account. The current authenticated user must be a [viewer of the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). */
51
+ await gapi.client.cloudbilling.billingAccounts.get({
52
+ name: "Test string",
53
+ });
54
+ /**
55
+ * Gets the access control policy for a billing account. The caller must have the `billing.accounts.getIamPolicy` permission on the account, which is often given to billing account
56
+ * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
57
+ */
58
+ await gapi.client.cloudbilling.billingAccounts.getIamPolicy({
59
+ "options.requestedPolicyVersion": 42,
60
+ resource: "Test string",
61
+ });
62
+ /** Lists the billing accounts that the current authenticated user has permission to [view](https://cloud.google.com/billing/docs/how-to/billing-access). */
63
+ await gapi.client.cloudbilling.billingAccounts.list({
64
+ filter: "Test string",
65
+ pageSize: 42,
66
+ pageToken: "Test string",
67
+ });
68
+ /**
69
+ * Updates a billing account's fields. Currently the only field that can be edited is `display_name`. The current authenticated user must have the `billing.accounts.update` IAM permission,
70
+ * which is typically given to the [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing account.
71
+ */
72
+ await gapi.client.cloudbilling.billingAccounts.patch({
73
+ name: "Test string",
74
+ updateMask: "Test string",
75
+ }, {
76
+ displayName: "Test string",
77
+ masterBillingAccount: "Test string",
78
+ name: "Test string",
79
+ open: true,
80
+ });
81
+ /**
82
+ * Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the `billing.accounts.setIamPolicy` permission on the account, which is often
83
+ * given to billing account [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
84
+ */
85
+ await gapi.client.cloudbilling.billingAccounts.setIamPolicy({
86
+ resource: "Test string",
87
+ }, {
88
+ policy: {
89
+ auditConfigs: [
90
+ {
91
+ auditLogConfigs: [
92
+ {
93
+ exemptedMembers: [
94
+ "Test string"
95
+ ],
96
+ logType: "Test string",
97
+ }
98
+ ],
99
+ service: "Test string",
100
+ }
101
+ ],
102
+ bindings: [
103
+ {
104
+ condition: {
105
+ description: "Test string",
106
+ expression: "Test string",
107
+ location: "Test string",
108
+ title: "Test string",
109
+ },
110
+ members: [
111
+ "Test string"
112
+ ],
113
+ role: "Test string",
114
+ }
115
+ ],
116
+ etag: "Test string",
117
+ version: 42,
118
+ },
119
+ updateMask: "Test string",
120
+ });
121
+ /**
122
+ * Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller
123
+ * is allowed for that resource.
124
+ */
125
+ await gapi.client.cloudbilling.billingAccounts.testIamPermissions({
126
+ resource: "Test string",
127
+ }, {
128
+ permissions: [
129
+ "Test string"
130
+ ],
131
+ });
132
+ /**
133
+ * Lists the projects associated with a billing account. The current authenticated user must have the `billing.resourceAssociations.list` IAM permission, which is often given to billing
134
+ * account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
135
+ */
136
+ await gapi.client.cloudbilling.billingAccounts.projects.list({
137
+ name: "Test string",
138
+ pageSize: 42,
139
+ pageToken: "Test string",
140
+ });
141
+ /**
142
+ * Gets the billing information for a project. The current authenticated user must have the `resourcemanager.projects.get` permission for the project, which can be granted by assigning the
143
+ * [Project Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) role.
144
+ */
145
+ await gapi.client.cloudbilling.projects.getBillingInfo({
146
+ name: "Test string",
147
+ });
148
+ /**
149
+ * Sets or updates the billing account associated with a project. You specify the new billing account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the
150
+ * resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a
151
+ * billing account, this method changes the billing account used for resource usage charges. *Note:* Incurred charges that have not yet been reported in the transaction history of the
152
+ * Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project. The current authenticated user
153
+ * must have ownership privileges for both the [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing
154
+ * account](https://cloud.google.com/billing/docs/how-to/billing-access). You can disable billing on the project by setting the `billing_account_name` field to empty. This action
155
+ * disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any
156
+ * unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account
157
+ * for the project. Note that associating a project with a *closed* billing account will have much the same effect as disabling billing on the project: any paid resources used by the
158
+ * project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an *open* billing account.
159
+ */
160
+ await gapi.client.cloudbilling.projects.updateBillingInfo({
161
+ name: "Test string",
162
+ }, {
163
+ billingAccountName: "Test string",
164
+ billingEnabled: true,
165
+ name: "Test string",
166
+ projectId: "Test string",
167
+ });
168
+ /** Lists all public cloud services. */
169
+ await gapi.client.cloudbilling.services.list({
170
+ pageSize: 42,
171
+ pageToken: "Test string",
172
+ });
173
+ /** Lists all publicly available SKUs for a given cloud service. */
174
+ await gapi.client.cloudbilling.services.skus.list({
175
+ currencyCode: "Test string",
176
+ endTime: "Test string",
177
+ pageSize: 42,
178
+ pageToken: "Test string",
179
+ parent: "Test string",
180
+ startTime: "Test string",
181
+ });
182
+ }
183
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "lib": ["es6", "dom"],
5
+ "noImplicitAny": true,
6
+ "noImplicitThis": true,
7
+ "strictNullChecks": true,
8
+ "baseUrl": "../",
9
+ "typeRoots": [
10
+ "../"
11
+ ],
12
+ "types": [],
13
+ "noEmit": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "strictFunctionTypes": true
16
+ },
17
+ "files": ["index.d.ts", "tests.ts"]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }