1// Copyright 2023 Google LLC 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 15syntax = "proto3"; 16 17package google.cloud.billing.budgets.v1beta1; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/billing/budgets/v1beta1/budget_model.proto"; 24import "google/protobuf/empty.proto"; 25import "google/protobuf/field_mask.proto"; 26 27option go_package = "cloud.google.com/go/billing/budgets/apiv1beta1/budgetspb;budgetspb"; 28option java_multiple_files = true; 29option java_package = "com.google.cloud.billing.budgets.v1beta1"; 30 31// BudgetService stores Cloud Billing budgets, which define a 32// budget plan and rules to execute as we track spend against that plan. 33service BudgetService { 34 option (google.api.default_host) = "billingbudgets.googleapis.com"; 35 option (google.api.oauth_scopes) = 36 "https://www.googleapis.com/auth/cloud-billing," 37 "https://www.googleapis.com/auth/cloud-platform"; 38 39 // Creates a new budget. See 40 // [Quotas and limits](https://cloud.google.com/billing/quotas) 41 // for more information on the limits of the number of budgets you can create. 42 rpc CreateBudget(CreateBudgetRequest) returns (Budget) { 43 option (google.api.http) = { 44 post: "/v1beta1/{parent=billingAccounts/*}/budgets" 45 body: "*" 46 }; 47 } 48 49 // Updates a budget and returns the updated budget. 50 // 51 // WARNING: There are some fields exposed on the Google Cloud Console that 52 // aren't available on this API. Budget fields that are not exposed in 53 // this API will not be changed by this method. 54 rpc UpdateBudget(UpdateBudgetRequest) returns (Budget) { 55 option (google.api.http) = { 56 patch: "/v1beta1/{budget.name=billingAccounts/*/budgets/*}" 57 body: "*" 58 }; 59 } 60 61 // Returns a budget. 62 // 63 // WARNING: There are some fields exposed on the Google Cloud Console that 64 // aren't available on this API. When reading from the API, you will not 65 // see these fields in the return value, though they may have been set 66 // in the Cloud Console. 67 rpc GetBudget(GetBudgetRequest) returns (Budget) { 68 option (google.api.http) = { 69 get: "/v1beta1/{name=billingAccounts/*/budgets/*}" 70 }; 71 } 72 73 // Returns a list of budgets for a billing account. 74 // 75 // WARNING: There are some fields exposed on the Google Cloud Console that 76 // aren't available on this API. When reading from the API, you will not 77 // see these fields in the return value, though they may have been set 78 // in the Cloud Console. 79 rpc ListBudgets(ListBudgetsRequest) returns (ListBudgetsResponse) { 80 option (google.api.http) = { 81 get: "/v1beta1/{parent=billingAccounts/*}/budgets" 82 }; 83 } 84 85 // Deletes a budget. Returns successfully if already deleted. 86 rpc DeleteBudget(DeleteBudgetRequest) returns (google.protobuf.Empty) { 87 option (google.api.http) = { 88 delete: "/v1beta1/{name=billingAccounts/*/budgets/*}" 89 }; 90 } 91} 92 93// Request for CreateBudget 94message CreateBudgetRequest { 95 // Required. The name of the billing account to create the budget in. Values 96 // are of the form `billingAccounts/{billingAccountId}`. 97 string parent = 1 [ 98 (google.api.field_behavior) = REQUIRED, 99 (google.api.resource_reference) = { 100 child_type: "billingbudgets.googleapis.com/Budget" 101 } 102 ]; 103 104 // Required. Budget to create. 105 Budget budget = 2 [(google.api.field_behavior) = REQUIRED]; 106} 107 108// Request for UpdateBudget 109message UpdateBudgetRequest { 110 // Required. The updated budget object. 111 // The budget to update is specified by the budget name in the budget. 112 Budget budget = 1 [(google.api.field_behavior) = REQUIRED]; 113 114 // Optional. Indicates which fields in the provided budget to update. 115 // Read-only fields (such as `name`) cannot be changed. If this is not 116 // provided, then only fields with non-default values from the request are 117 // updated. See 118 // https://developers.google.com/protocol-buffers/docs/proto3#default for more 119 // details about default values. 120 google.protobuf.FieldMask update_mask = 2 121 [(google.api.field_behavior) = OPTIONAL]; 122} 123 124// Request for GetBudget 125message GetBudgetRequest { 126 // Required. Name of budget to get. Values are of the form 127 // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. 128 string name = 1 [ 129 (google.api.field_behavior) = REQUIRED, 130 (google.api.resource_reference) = { 131 type: "billingbudgets.googleapis.com/Budget" 132 } 133 ]; 134} 135 136// Request for ListBudgets 137message ListBudgetsRequest { 138 // Required. Name of billing account to list budgets under. Values 139 // are of the form `billingAccounts/{billingAccountId}`. 140 string parent = 1 [ 141 (google.api.field_behavior) = REQUIRED, 142 (google.api.resource_reference) = { 143 child_type: "billingbudgets.googleapis.com/Budget" 144 } 145 ]; 146 147 // Optional. Set the scope of the budgets to be returned, in the format of the 148 // resource name. The scope of a budget is the cost that it tracks, such as 149 // costs for a single project, or the costs for all projects in a folder. Only 150 // project scope (in the format of "projects/project-id" or "projects/123") is 151 // supported in this field. When this field is set to a project's resource 152 // name, the budgets returned are tracking the costs for that project. 153 string scope = 4 [(google.api.field_behavior) = OPTIONAL]; 154 155 // Optional. The maximum number of budgets to return per page. 156 // The default and maximum value are 100. 157 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 158 159 // Optional. The value returned by the last `ListBudgetsResponse` which 160 // indicates that this is a continuation of a prior `ListBudgets` call, 161 // and that the system should return the next page of data. 162 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 163} 164 165// Response for ListBudgets 166message ListBudgetsResponse { 167 // List of the budgets owned by the requested billing account. 168 repeated Budget budgets = 1; 169 170 // If not empty, indicates that there may be more budgets that match the 171 // request; this value should be passed in a new `ListBudgetsRequest`. 172 string next_page_token = 2; 173} 174 175// Request for DeleteBudget 176message DeleteBudgetRequest { 177 // Required. Name of the budget to delete. Values are of the form 178 // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. 179 string name = 1 [ 180 (google.api.field_behavior) = REQUIRED, 181 (google.api.resource_reference) = { 182 type: "billingbudgets.googleapis.com/Budget" 183 } 184 ]; 185} 186