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