feat: Added support for field to disable default budget alerts to IAM recipients.

fix: Pub/Sub fields in AllUpdatesRule are now optional.
fix: Added cloud-billing OAuth scope.

PiperOrigin-RevId: 331675651
This commit is contained in:
Google APIs 2020-09-14 18:43:01 -07:00 committed by Copybara-Service
parent 791be5a400
commit 921ce41f94
4 changed files with 101 additions and 97 deletions

View File

@ -9,14 +9,45 @@
# * extra_protoc_file_parameters
# The complete list of preserved parameters can be found in the source code.
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
"csharp_gapic_library",
"csharp_grpc_library",
"csharp_proto_library",
"go_gapic_assembly_pkg",
"go_gapic_library",
"go_proto_library",
"go_test",
"java_gapic_assembly_gradle_pkg",
"java_gapic_library",
"java_gapic_test",
"java_grpc_library",
"java_proto_library",
"moved_proto_library",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
"proto_library_with_info",
"py_gapic_assembly_pkg",
"py_gapic_library",
"py_grpc_library",
"py_proto_library",
"ruby_gapic_assembly_pkg",
"ruby_gapic_library",
"ruby_grpc_library",
"ruby_proto_library",
)
# This is an API workspace, having public visibility by default makes perfect sense.
package(default_visibility = ["//visibility:public"])
proto_library(
name = "budgets_proto",
@ -44,18 +75,6 @@ proto_library_with_info(
],
)
##############################################################################
# Java
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"java_gapic_assembly_gradle_pkg",
"java_gapic_library",
"java_gapic_test",
"java_grpc_library",
"java_proto_library",
)
java_proto_library(
name = "budgets_java_proto",
deps = [":budgets_proto"],
@ -101,17 +120,6 @@ java_gapic_assembly_gradle_pkg(
],
)
##############################################################################
# Go
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"go_gapic_assembly_pkg",
"go_gapic_library",
"go_proto_library",
"go_test",
)
go_proto_library(
name = "budgets_go_proto",
compilers = ["@io_bazel_rules_go//proto:go_grpc"],
@ -151,41 +159,56 @@ go_gapic_assembly_pkg(
],
)
##############################################################################
# Python
##############################################################################
# This library is using Python microgenerator.
# DO NOT OVERRIDE this Python section with autogenerated rules.
load(
"@com_google_googleapis_imports//:imports.bzl",
py_gapic_assembly_pkg = "py_gapic_assembly_pkg2",
py_gapic_library = "py_gapic_library2",
moved_proto_library(
name = "budgets_moved_proto",
srcs = [":budgets_proto"],
deps = [
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/type:money_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:struct_proto",
],
)
py_proto_library(
name = "budgets_py_proto",
plugin = "@protoc_docs_plugin//:docs_plugin",
deps = [":budgets_moved_proto"],
)
py_grpc_library(
name = "budgets_py_grpc",
srcs = [":budgets_moved_proto"],
deps = [":budgets_py_proto"],
)
py_gapic_library(
name = "budgets_py_gapic",
srcs = [":budgets_proto"],
src = ":budgets_proto_with_info",
gapic_yaml = "billingbudgets_gapic.yaml",
grpc_service_config = "billingbudgets_grpc_service_config.json",
package = "google.cloud.billing.budgets.v1beta1",
service_yaml = "billingbudgets.yaml",
deps = [
":budgets_py_grpc",
":budgets_py_proto",
],
)
# Open Source Packages
py_gapic_assembly_pkg(
name = "billing-budgets-v1beta1-py",
deps = [
":budgets_py_gapic",
":budgets_py_grpc",
":budgets_py_proto",
],
)
##############################################################################
# PHP
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"php_gapic_assembly_pkg",
"php_gapic_library",
"php_grpc_library",
"php_proto_library",
)
php_proto_library(
name = "budgets_php_proto",
deps = [":budgets_proto"],
@ -220,15 +243,6 @@ php_gapic_assembly_pkg(
],
)
##############################################################################
# Node.js
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"nodejs_gapic_assembly_pkg",
"nodejs_gapic_library",
)
nodejs_gapic_library(
name = "budgets_nodejs_gapic",
package_name = "@google-cloud/billing-budgets",
@ -247,17 +261,6 @@ nodejs_gapic_assembly_pkg(
],
)
##############################################################################
# Ruby
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"ruby_gapic_assembly_pkg",
"ruby_gapic_library",
"ruby_grpc_library",
"ruby_proto_library",
)
ruby_proto_library(
name = "budgets_ruby_proto",
deps = [":budgets_proto"],
@ -292,17 +295,6 @@ ruby_gapic_assembly_pkg(
],
)
##############################################################################
# C#
##############################################################################
load(
"@com_google_googleapis_imports//:imports.bzl",
"csharp_gapic_assembly_pkg",
"csharp_gapic_library",
"csharp_grpc_library",
"csharp_proto_library",
)
csharp_proto_library(
name = "budgets_csharp_proto",
deps = [":budgets_proto"],

View File

@ -17,4 +17,5 @@ authentication:
- selector: 'google.cloud.billing.budgets.v1beta1.BudgetService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-billing,
https://www.googleapis.com/auth/cloud-platform

View File

@ -123,8 +123,8 @@ message ThresholdRule {
// AllUpdatesRule defines notifications that are sent based on budget spend
// and thresholds.
message AllUpdatesRule {
// Required. The name of the Cloud Pub/Sub topic where budget related messages
// will be published, in the form `projects/{project_id}/topics/{topic_id}`.
// Optional. The name of the Pub/Sub topic where budget related messages will
// be published, in the form `projects/{project_id}/topics/{topic_id}`.
// Updates are sent at regular intervals to the topic. The topic needs to be
// created before the budget is created; see
// https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
@ -132,23 +132,31 @@ message AllUpdatesRule {
// Caller is expected to have
// `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
// budget, otherwise, the API call will fail with PERMISSION_DENIED. See
// https://cloud.google.com/pubsub/docs/access-control for more details on
// Pub/Sub roles and permissions.
string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED];
// https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
// for more details on Pub/Sub roles and permissions.
string pubsub_topic = 1 [(google.api.field_behavior) = OPTIONAL];
// Required. The schema version of the notification sent to `pubsub_topic`.
// Optional. The schema version of the notification sent to `pubsub_topic`.
// Only "1.0" is accepted. It represents the JSON schema as defined in
// https://cloud.google.com/billing/docs/how-to/budgets#notification_format
string schema_version = 2 [(google.api.field_behavior) = REQUIRED];
// https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
string schema_version = 2 [(google.api.field_behavior) = OPTIONAL];
// Optional. Targets to send notifications to when a threshold is exceeded.
// This is in addition to default recipients who have billing account roles.
// The value is the full REST resource name of a monitoring notification
// channel with the form
// This is in addition to default recipients who have billing account IAM
// roles. The value is the full REST resource name of a monitoring
// notification channel with the form
// `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
// channels are allowed.
// channels are allowed. See
// https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
// for more details.
repeated string monitoring_notification_channels = 3
[(google.api.field_behavior) = OPTIONAL];
// Optional. When set to true, disables default notifications sent when a
// threshold is exceeded. Recipients are those with Billing Account
// Administrators and Billing Account Users IAM roles for the target account.
bool disable_default_iam_recipients = 4
[(google.api.field_behavior) = OPTIONAL];
}
// A filter for a budget, limiting the scope of the cost to calculate.
@ -188,10 +196,10 @@ message Filter {
// Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
// specifying that usage from only this set of subaccounts should be included
// in the budget. If a subaccount is set to the name of the reseller account,
// usage from the reseller account will be included. If omitted, the report
// will include usage from the reseller account and all subaccounts, if they
// exist.
// in the budget. If a subaccount is set to the name of the parent account,
// usage from the parent account will be included. If omitted, the
// report will include usage from the parent account and all
// subaccounts, if they exist.
repeated string subaccounts = 5 [(google.api.field_behavior) = OPTIONAL];
// Optional. A single label and value pair specifying that usage from only

View File

@ -32,7 +32,9 @@ option java_package = "com.google.cloud.billing.budgets.v1beta1";
// budget plan and rules to execute as we track spend against that plan.
service BudgetService {
option (google.api.default_host) = "billingbudgets.googleapis.com";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-billing,"
"https://www.googleapis.com/auth/cloud-platform";
// Creates a new budget. See
// <a href="https://cloud.google.com/billing/quotas">Quotas and limits</a>
@ -115,7 +117,8 @@ message UpdateBudgetRequest {
// updated. See
// https://developers.google.com/protocol-buffers/docs/proto3#default for more
// details about default values.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
google.protobuf.FieldMask update_mask = 2
[(google.api.field_behavior) = OPTIONAL];
}
// Request for GetBudget