-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
cloud_billing.proto
397 lines (355 loc) · 16.4 KB
/
cloud_billing.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package google.cloud.billing.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/iam/v1/iam_policy.proto";
import "google/iam/v1/policy.proto";
import "google/protobuf/field_mask.proto";
option go_package = "cloud.google.com/go/billing/apiv1/billingpb;billingpb";
option java_multiple_files = true;
option java_outer_classname = "CloudBillingProto";
option java_package = "com.google.cloud.billing.v1";
// Retrieves the Google Cloud Console billing accounts and associates them with
// projects.
service CloudBilling {
option (google.api.default_host) = "cloudbilling.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-billing,"
"https://www.googleapis.com/auth/cloud-billing.readonly,"
"https://www.googleapis.com/auth/cloud-platform";
// 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).
rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) {
option (google.api.http) = {
get: "/v1/{name=billingAccounts/*}"
};
option (google.api.method_signature) = "name";
}
// Lists the billing accounts that the current authenticated user has
// permission to
// [view](https://cloud.google.com/billing/docs/how-to/billing-access).
rpc ListBillingAccounts(ListBillingAccountsRequest)
returns (ListBillingAccountsResponse) {
option (google.api.http) = {
get: "/v1/billingAccounts"
};
option (google.api.method_signature) = "";
}
// 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.
rpc UpdateBillingAccount(UpdateBillingAccountRequest)
returns (BillingAccount) {
option (google.api.http) = {
patch: "/v1/{name=billingAccounts/*}"
body: "account"
};
option (google.api.method_signature) = "name,account";
}
// 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.
rpc CreateBillingAccount(CreateBillingAccountRequest)
returns (BillingAccount) {
option (google.api.http) = {
post: "/v1/billingAccounts"
body: "billing_account"
};
option (google.api.method_signature) = "billing_account";
}
// 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 account
// [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
rpc ListProjectBillingInfo(ListProjectBillingInfoRequest)
returns (ListProjectBillingInfoResponse) {
option (google.api.http) = {
get: "/v1/{name=billingAccounts/*}/projects"
};
option (google.api.method_signature) = "name";
}
// 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.
rpc GetProjectBillingInfo(GetProjectBillingInfoRequest)
returns (ProjectBillingInfo) {
option (google.api.http) = {
get: "/v1/{name=projects/*}/billingInfo"
};
option (google.api.method_signature) = "name";
}
// 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.
rpc UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest)
returns (ProjectBillingInfo) {
option (google.api.http) = {
put: "/v1/{name=projects/*}/billingInfo"
body: "project_billing_info"
};
option (google.api.method_signature) = "name,project_billing_info";
}
// 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).
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
returns (google.iam.v1.Policy) {
option (google.api.http) = {
get: "/v1/{resource=billingAccounts/*}:getIamPolicy"
};
option (google.api.method_signature) = "resource";
}
// 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).
rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
returns (google.iam.v1.Policy) {
option (google.api.http) = {
post: "/v1/{resource=billingAccounts/*}:setIamPolicy"
body: "*"
};
option (google.api.method_signature) = "resource,policy";
}
// 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.
rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
returns (google.iam.v1.TestIamPermissionsResponse) {
option (google.api.http) = {
post: "/v1/{resource=billingAccounts/*}:testIamPermissions"
body: "*"
};
option (google.api.method_signature) = "resource,permissions";
}
}
// A billing account in the
// [Google Cloud Console](https://console.cloud.google.com/). You can assign a
// billing account to one or more projects.
message BillingAccount {
// 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` would be the resource name for
// billing account `012345-567890-ABCDEF`.
string name = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.resource_reference) = {
type: "cloudbilling.googleapis.com/BillingAccount"
}
];
// 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 associated with it will be unable to use
// paid services.
bool open = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// The display name given to the billing account, such as `My Billing
// Account`. This name is displayed in the Google Cloud Console.
string display_name = 3;
// 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.
// Otherwise this will be empty.
string master_billing_account = 4;
}
// Encapsulation of billing information for a Google Cloud Console project. A
// project has at most one associated billing account at a time (but a billing
// account can be assigned to multiple projects).
message ProjectBillingInfo {
option (google.api.resource) = {
type: "cloudbilling.googleapis.com/ProjectBillingInfo"
pattern: "projects/{project}/billingInfo"
};
// Output only. The resource name for the `ProjectBillingInfo`; has the form
// `projects/{project_id}/billingInfo`. For example, the resource name for the
// billing information for project `tokyo-rain-123` would be
// `projects/tokyo-rain-123/billingInfo`.
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. 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 project ID.
string project_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// The resource name of the billing account associated with the project, if
// any. For example, `billingAccounts/012345-567890-ABCDEF`.
string billing_account_name = 3;
// Output only. 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 billing account at all, and
// therefore cannot use paid services.
bool billing_enabled = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Request message for `GetBillingAccount`.
message GetBillingAccountRequest {
// Required. The resource name of the billing account to retrieve. For
// example, `billingAccounts/012345-567890-ABCDEF`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudbilling.googleapis.com/BillingAccount"
}
];
}
// Request message for `ListBillingAccounts`.
message ListBillingAccountsRequest {
// Requested page size. The maximum page size is 100; this is also the
// default.
int32 page_size = 1;
// 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 results is returned.
string page_token = 2;
// 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 provided reseller billing account.
// (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
// Boolean algebra and other fields are not currently supported.
string filter = 3;
}
// Response message for `ListBillingAccounts`.
message ListBillingAccountsResponse {
// A list of billing accounts.
repeated BillingAccount billing_accounts = 1;
// 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 are no more results to retrieve.
string next_page_token = 2;
}
// Request message for `CreateBillingAccount`.
message CreateBillingAccountRequest {
// Required. The billing account resource to create.
// Currently CreateBillingAccount only supports subaccount creation, so
// any created billing accounts must be under a provided parent billing
// account.
BillingAccount billing_account = 1 [(google.api.field_behavior) = REQUIRED];
}
// Request message for `UpdateBillingAccount`.
message UpdateBillingAccountRequest {
// Required. The name of the billing account resource to be updated.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudbilling.googleapis.com/BillingAccount"
}
];
// Required. The billing account resource to replace the resource on the
// server.
BillingAccount account = 2 [(google.api.field_behavior) = REQUIRED];
// The update mask applied to the resource.
// Only "display_name" is currently supported.
google.protobuf.FieldMask update_mask = 3;
}
// Request message for `ListProjectBillingInfo`.
message ListProjectBillingInfoRequest {
// Required. The resource name of the billing account associated with the
// projects that you want to list. For example,
// `billingAccounts/012345-567890-ABCDEF`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudbilling.googleapis.com/BillingAccount"
}
];
// Requested page size. The maximum page size is 100; this is also the
// default.
int32 page_size = 2;
// 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 page of results is returned.
string page_token = 3;
}
// Request message for `ListProjectBillingInfoResponse`.
message ListProjectBillingInfoResponse {
// A list of `ProjectBillingInfo` resources representing the projects
// associated with the billing account.
repeated ProjectBillingInfo project_billing_info = 1;
// 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 there are no more results to retrieve.
string next_page_token = 2;
}
// Request message for `GetProjectBillingInfo`.
message GetProjectBillingInfoRequest {
// Required. The resource name of the project for which billing information is
// retrieved. For example, `projects/tokyo-rain-123`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "cloudbilling.googleapis.com/ProjectBillingInfo"
}
];
}
// Request message for `UpdateProjectBillingInfo`.
message UpdateProjectBillingInfoRequest {
// Required. The resource name of the project associated with the billing
// information that you want to update. For example,
// `projects/tokyo-rain-123`.
string name = 1 [(google.api.field_behavior) = REQUIRED];
// The new billing information for the project. Output-only fields are
// ignored; thus, you can leave empty all fields except
// `billing_account_name`.
ProjectBillingInfo project_billing_info = 2;
}