// Copyright 2016 Google Inc. // // 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"; option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; option java_multiple_files = true; option java_outer_classname = "CloudBillingProto"; option java_package = "com.google.cloud.billing.v1"; // Retrieves Google Cloud Console billing accounts and associates them with // projects. service CloudBilling { // Gets information about a billing account. The current authenticated user // must be an [owner of the billing // account](https://support.google.com/cloud/answer/4430947). rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) { option (google.api.http) = { get: "/v1/{name=billingAccounts/*}" }; } // Lists the billing accounts that the current authenticated user // [owns](https://support.google.com/cloud/answer/4430947). rpc ListBillingAccounts(ListBillingAccountsRequest) returns (ListBillingAccountsResponse) { option (google.api.http) = { get: "/v1/billingAccounts" }; } // Lists the projects associated with a billing account. The current // authenticated user must be an [owner of the billing // account](https://support.google.com/cloud/answer/4430947). rpc ListProjectBillingInfo(ListProjectBillingInfoRequest) returns (ListProjectBillingInfoResponse) { option (google.api.http) = { get: "/v1/{name=billingAccounts/*}/projects" }; } // Gets the billing information for a project. The current authenticated user // must have [permission to view the // project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo // ). rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) { option (google.api.http) = { get: "/v1/{name=projects/*}/billingInfo" }; } // 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 may 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://support.google.com/cloud/answer/4430947). // // 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" }; } } // A billing account in [Google Cloud // Console](https://console.cloud.google.com/). You can assign a billing account // to one or more projects. message BillingAccount { // 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; // 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; // 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; } // Encapsulation of billing information for a 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 { // 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`. This field is read-only. string name = 1; // 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. This field is read-only. string project_id = 2; // The resource name of the billing account associated with the project, if // any. For example, `billingAccounts/012345-567890-ABCDEF`. string billing_account_name = 3; // 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. This field is read-only. bool billing_enabled = 4; } // Request message for `GetBillingAccount`. message GetBillingAccountRequest { // The resource name of the billing account to retrieve. For example, // `billingAccounts/012345-567890-ABCDEF`. string name = 1; } // 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; } // 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 `ListProjectBillingInfo`. message ListProjectBillingInfoRequest { // 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; // 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 { // The resource name of the project for which billing information is // retrieved. For example, `projects/tokyo-rain-123`. string name = 1; } // Request message for `UpdateProjectBillingInfo`. message UpdateProjectBillingInfoRequest { // 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; // The new billing information for the project. Read-only fields are ignored; // thus, you may leave empty all fields except `billing_account_name`. ProjectBillingInfo project_billing_info = 2; }