cloud_billing.proto 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. // Copyright 2016 Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.billing.v1;
  16. import "google/api/annotations.proto";
  17. option java_multiple_files = true;
  18. option java_outer_classname = "CloudBillingProto";
  19. option java_package = "com.google.cloud.billing.v1";
  20. // Retrieves Google Cloud Console billing accounts and associates them with
  21. // projects.
  22. service CloudBilling {
  23. // Gets information about a billing account. The current authenticated user
  24. // must be an [owner of the billing
  25. // account](https://support.google.com/cloud/answer/4430947).
  26. rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) {
  27. option (google.api.http) = { get: "/v1/{name=billingAccounts/*}" };
  28. }
  29. // Lists the billing accounts that the current authenticated user
  30. // [owns](https://support.google.com/cloud/answer/4430947).
  31. rpc ListBillingAccounts(ListBillingAccountsRequest) returns (ListBillingAccountsResponse) {
  32. option (google.api.http) = { get: "/v1/billingAccounts" };
  33. }
  34. // Lists the projects associated with a billing account. The current
  35. // authenticated user must be an [owner of the billing
  36. // account](https://support.google.com/cloud/answer/4430947).
  37. rpc ListProjectBillingInfo(ListProjectBillingInfoRequest) returns (ListProjectBillingInfoResponse) {
  38. option (google.api.http) = { get: "/v1/{name=billingAccounts/*}/projects" };
  39. }
  40. // Gets the billing information for a project. The current authenticated user
  41. // must have [permission to view the
  42. // project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
  43. // ).
  44. rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) {
  45. option (google.api.http) = { get: "/v1/{name=projects/*}/billingInfo" };
  46. }
  47. // Sets or updates the billing account associated with a project. You specify
  48. // the new billing account by setting the `billing_account_name` in the
  49. // `ProjectBillingInfo` resource to the resource name of a billing account.
  50. // Associating a project with an open billing account enables billing on the
  51. // project and allows charges for resource usage. If the project already had a
  52. // billing account, this method changes the billing account used for resource
  53. // usage charges.
  54. //
  55. // *Note:* Incurred charges that have not yet been reported in the transaction
  56. // history of the Google Cloud Console may be billed to the new billing
  57. // account, even if the charge occurred before the new billing account was
  58. // assigned to the project.
  59. //
  60. // The current authenticated user must have ownership privileges for both the
  61. // [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
  62. // ) and the [billing
  63. // account](https://support.google.com/cloud/answer/4430947).
  64. //
  65. // You can disable billing on the project by setting the
  66. // `billing_account_name` field to empty. This action disassociates the
  67. // current billing account from the project. Any billable activity of your
  68. // in-use services will stop, and your application could stop functioning as
  69. // expected. Any unbilled charges to date will be billed to the previously
  70. // associated account. The current authenticated user must be either an owner
  71. // of the project or an owner of the billing account for the project.
  72. //
  73. // Note that associating a project with a *closed* billing account will have
  74. // much the same effect as disabling billing on the project: any paid
  75. // resources used by the project will be shut down. Thus, unless you wish to
  76. // disable billing, you should always call this method with the name of an
  77. // *open* billing account.
  78. rpc UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest) returns (ProjectBillingInfo) {
  79. option (google.api.http) = { put: "/v1/{name=projects/*}/billingInfo" body: "project_billing_info" };
  80. }
  81. }
  82. // A billing account in [Google Cloud
  83. // Console](https://console.cloud.google.com/). You can assign a billing account
  84. // to one or more projects.
  85. message BillingAccount {
  86. // The resource name of the billing account. The resource name has the form
  87. // `billingAccounts/{billing_account_id}`. For example,
  88. // `billingAccounts/012345-567890-ABCDEF` would be the resource name for
  89. // billing account `012345-567890-ABCDEF`.
  90. string name = 1;
  91. // True if the billing account is open, and will therefore be charged for any
  92. // usage on associated projects. False if the billing account is closed, and
  93. // therefore projects associated with it will be unable to use paid services.
  94. bool open = 2;
  95. // The display name given to the billing account, such as `My Billing
  96. // Account`. This name is displayed in the Google Cloud Console.
  97. string display_name = 3;
  98. }
  99. // Encapsulation of billing information for a Cloud Console project. A project
  100. // has at most one associated billing account at a time (but a billing account
  101. // can be assigned to multiple projects).
  102. message ProjectBillingInfo {
  103. // The resource name for the `ProjectBillingInfo`; has the form
  104. // `projects/{project_id}/billingInfo`. For example, the resource name for the
  105. // billing information for project `tokyo-rain-123` would be
  106. // `projects/tokyo-rain-123/billingInfo`. This field is read-only.
  107. string name = 1;
  108. // The ID of the project that this `ProjectBillingInfo` represents, such as
  109. // `tokyo-rain-123`. This is a convenience field so that you don't need to
  110. // parse the `name` field to obtain a project ID. This field is read-only.
  111. string project_id = 2;
  112. // The resource name of the billing account associated with the project, if
  113. // any. For example, `billingAccounts/012345-567890-ABCDEF`.
  114. string billing_account_name = 3;
  115. // True if the project is associated with an open billing account, to which
  116. // usage on the project is charged. False if the project is associated with a
  117. // closed billing account, or no billing account at all, and therefore cannot
  118. // use paid services. This field is read-only.
  119. bool billing_enabled = 4;
  120. }
  121. // Request message for `GetBillingAccount`.
  122. message GetBillingAccountRequest {
  123. // The resource name of the billing account to retrieve. For example,
  124. // `billingAccounts/012345-567890-ABCDEF`.
  125. string name = 1;
  126. }
  127. // Request message for `ListBillingAccounts`.
  128. message ListBillingAccountsRequest {
  129. // Requested page size. The maximum page size is 100; this is also the
  130. // default.
  131. int32 page_size = 1;
  132. // A token identifying a page of results to return. This should be a
  133. // `next_page_token` value returned from a previous `ListBillingAccounts`
  134. // call. If unspecified, the first page of results is returned.
  135. string page_token = 2;
  136. }
  137. // Response message for `ListBillingAccounts`.
  138. message ListBillingAccountsResponse {
  139. // A list of billing accounts.
  140. repeated BillingAccount billing_accounts = 1;
  141. // A token to retrieve the next page of results. To retrieve the next page,
  142. // call `ListBillingAccounts` again with the `page_token` field set to this
  143. // value. This field is empty if there are no more results to retrieve.
  144. string next_page_token = 2;
  145. }
  146. // Request message for `ListProjectBillingInfo`.
  147. message ListProjectBillingInfoRequest {
  148. // The resource name of the billing account associated with the projects that
  149. // you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
  150. string name = 1;
  151. // Requested page size. The maximum page size is 100; this is also the
  152. // default.
  153. int32 page_size = 2;
  154. // A token identifying a page of results to be returned. This should be a
  155. // `next_page_token` value returned from a previous `ListProjectBillingInfo`
  156. // call. If unspecified, the first page of results is returned.
  157. string page_token = 3;
  158. }
  159. // Request message for `ListProjectBillingInfoResponse`.
  160. message ListProjectBillingInfoResponse {
  161. // A list of `ProjectBillingInfo` resources representing the projects
  162. // associated with the billing account.
  163. repeated ProjectBillingInfo project_billing_info = 1;
  164. // A token to retrieve the next page of results. To retrieve the next page,
  165. // call `ListProjectBillingInfo` again with the `page_token` field set to this
  166. // value. This field is empty if there are no more results to retrieve.
  167. string next_page_token = 2;
  168. }
  169. // Request message for `GetProjectBillingInfo`.
  170. message GetProjectBillingInfoRequest {
  171. // The resource name of the project for which billing information is
  172. // retrieved. For example, `projects/tokyo-rain-123`.
  173. string name = 1;
  174. }
  175. // Request message for `UpdateProjectBillingInfo`.
  176. message UpdateProjectBillingInfoRequest {
  177. // The resource name of the project associated with the billing information
  178. // that you want to update. For example, `projects/tokyo-rain-123`.
  179. string name = 1;
  180. // The new billing information for the project. Read-only fields are ignored;
  181. // thus, you may leave empty all fields except `billing_account_name`.
  182. ProjectBillingInfo project_billing_info = 2;
  183. }