From 8995a8817642b3a209103677012521f953616011 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Mon, 14 Nov 2022 16:01:54 -0800 Subject: [PATCH] feat: added Sku.geo_taxonomy fix: more oauth scopes PiperOrigin-RevId: 488493014 --- google/cloud/billing/v1/BUILD.bazel | 23 ++++++- google/cloud/billing/v1/cloud_billing.proto | 65 ++++++++++++-------- google/cloud/billing/v1/cloud_catalog.proto | 68 +++++++++++++++------ google/cloud/billing/v1/cloudbilling.yaml | 28 ++++++++- 4 files changed, 136 insertions(+), 48 deletions(-) diff --git a/google/cloud/billing/v1/BUILD.bazel b/google/cloud/billing/v1/BUILD.bazel index 129796bcfeedd..0f33332343006 100644 --- a/google/cloud/billing/v1/BUILD.bazel +++ b/google/cloud/billing/v1/BUILD.bazel @@ -1,4 +1,13 @@ # This file was automatically generated by BuildFileGenerator +# https://github.com/googleapis/rules_gapic/tree/master/bazel + +# Most of the manual changes to this file will be overwritten. +# It's **only** allowed to change the following rule attribute values: +# - names of *_gapic_assembly_* rules +# - certain parameters of *_gapic_library rules, including but not limited to: +# * extra_protoc_parameters +# * 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"]) @@ -62,8 +71,10 @@ java_grpc_library( java_gapic_library( name = "billing_java_gapic", srcs = [":billing_proto_with_info"], + gapic_yaml = None, grpc_service_config = "cloud_billing_grpc_service_config.json", rest_numeric_enums = False, + service_yaml = "cloudbilling.yaml", test_deps = [ ":billing_java_grpc", "//google/iam/v1:iam_java_grpc", @@ -71,6 +82,7 @@ java_gapic_library( transport = "grpc+rest", deps = [ ":billing_java_proto", + "//google/api:api_java_proto", "//google/iam/v1:iam_java_proto", ], ) @@ -127,6 +139,7 @@ go_gapic_library( srcs = [":billing_proto_with_info"], grpc_service_config = "cloud_billing_grpc_service_config.json", importpath = "cloud.google.com/go/billing/apiv1;billing", + metadata = True, rest_numeric_enums = False, service_yaml = "cloudbilling.yaml", transport = "grpc+rest", @@ -148,6 +161,7 @@ go_gapic_assembly_pkg( name = "gapi-cloud-billing-v1-go", deps = [ ":billing_go_gapic", + ":billing_go_gapic_srcjar-metadata.srcjar", ":billing_go_gapic_srcjar-test.srcjar", ":billing_go_proto", ], @@ -168,6 +182,7 @@ py_gapic_library( srcs = [":billing_proto"], grpc_service_config = "cloud_billing_grpc_service_config.json", rest_numeric_enums = False, + service_yaml = "cloudbilling.yaml", transport = "grpc", deps = [ "//google/iam/v1:iam_policy_py_proto", @@ -219,6 +234,7 @@ php_gapic_library( srcs = [":billing_proto_with_info"], grpc_service_config = "cloud_billing_grpc_service_config.json", rest_numeric_enums = False, + service_yaml = "cloudbilling.yaml", transport = "grpc+rest", deps = [ ":billing_php_grpc", @@ -292,16 +308,17 @@ ruby_cloud_gapic_library( name = "billing_ruby_gapic", srcs = [":billing_proto_with_info"], extra_protoc_parameters = [ - "ruby-cloud-gem-name=google-cloud-billing-v1", - "ruby-cloud-env-prefix=BILLING", - "ruby-cloud-product-url=https://cloud.google.com/billing", "ruby-cloud-api-id=cloudbilling.googleapis.com", "ruby-cloud-api-shortname=cloudbilling", + "ruby-cloud-env-prefix=BILLING", + "ruby-cloud-gem-name=google-cloud-billing-v1", + "ruby-cloud-product-url=https://cloud.google.com/billing", ], grpc_service_config = "cloud_billing_grpc_service_config.json", rest_numeric_enums = False, ruby_cloud_description = "Allows developers to manage billing for their Google Cloud Platform projects programmatically.", ruby_cloud_title = "Billing V1", + service_yaml = "cloudbilling.yaml", deps = [ ":billing_ruby_grpc", ":billing_ruby_proto", diff --git a/google/cloud/billing/v1/cloud_billing.proto b/google/cloud/billing/v1/cloud_billing.proto index f0b19d14d1364..b98f0fd7c2640 100644 --- a/google/cloud/billing/v1/cloud_billing.proto +++ b/google/cloud/billing/v1/cloud_billing.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // 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"; @@ -30,10 +29,14 @@ option java_multiple_files = true; option java_outer_classname = "CloudBillingProto"; option java_package = "com.google.cloud.billing.v1"; -// Retrieves GCP Console billing accounts and associates them with projects. +// Retrieves the Google Cloud Console billing accounts and associates them with +// projects. service CloudBilling { option (google.api.default_host) = "cloudbilling.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-billing.readonly," + "https://www.googleapis.com/auth/cloud-platform"; // Gets information about a billing account. The current authenticated user // must be a [viewer of the billing @@ -69,15 +72,20 @@ service CloudBilling { option (google.api.method_signature) = "name,account"; } - // Creates a billing account. - // This method can only be used to create - // [billing subaccounts](https://cloud.google.com/billing/docs/concepts) - // by GCP resellers. + // This method creates [billing + // subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts). + // + // Google Cloud resellers should use the + // Channel Services APIs, + // [accounts.customers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers/create) + // and + // [accounts.customers.entitlements.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/create). + // // When creating a subaccount, the current authenticated user must have the - // `billing.accounts.update` IAM permission on the master account, which is + // `billing.accounts.update` IAM permission on the parent account, which is // typically given to billing account // [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). - // This method will return an error if the master account has not been + // This method will return an error if the parent account has not been // provisioned as a reseller account. rpc CreateBillingAccount(CreateBillingAccountRequest) returns (BillingAccount) { option (google.api.http) = { @@ -99,9 +107,10 @@ service CloudBilling { } // 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 - // ). + // must have the `resourcemanager.projects.get` permission for the project, + // which can be granted by assigning the [Project + // Viewer](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles) + // role. rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) { option (google.api.http) = { get: "/v1/{name=projects/*}/billingInfo" @@ -118,7 +127,7 @@ service CloudBilling { // usage charges. // // *Note:* Incurred charges that have not yet been reported in the transaction - // history of the GCP Console might be billed to the new billing + // history of the Google Cloud Console might be billed to the new billing // account, even if the charge occurred before the new billing account was // assigned to the project. // @@ -184,16 +193,20 @@ service CloudBilling { } } -// A billing account in [GCP Console](https://console.cloud.google.com/). -// You can assign a billing account to one or more projects. +// A billing account in the +// [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 + // Output only. 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 [(google.api.resource_reference) = { - type: "cloudbilling.googleapis.com/BillingAccount" - }]; + string name = 1 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; // Output only. 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 @@ -201,20 +214,20 @@ message BillingAccount { bool open = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // The display name given to the billing account, such as `My Billing - // Account`. This name is displayed in the GCP Console. + // Account`. This name is displayed in the Google Cloud Console. string display_name = 3; // If this account is a // [subaccount](https://cloud.google.com/billing/docs/concepts), then this - // will be the resource name of the master billing account that it is being + // will be the resource name of the parent billing account that it is being // resold through. // Otherwise this will be empty. string master_billing_account = 4; } -// Encapsulation of billing information for a GCP Console project. A project -// has at most one associated billing account at a time (but a billing account -// can be assigned to multiple projects). +// Encapsulation of billing information for a Google 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 @@ -285,7 +298,7 @@ message ListBillingAccountsResponse { message CreateBillingAccountRequest { // Required. The billing account resource to create. // Currently CreateBillingAccount only supports subaccount creation, so - // any created billing accounts must be under a provided master billing + // any created billing accounts must be under a provided parent billing // account. BillingAccount billing_account = 1 [(google.api.field_behavior) = REQUIRED]; } diff --git a/google/cloud/billing/v1/cloud_catalog.proto b/google/cloud/billing/v1/cloud_catalog.proto index 7bc2f14e3b109..f3d46e6270835 100644 --- a/google/cloud/billing/v1/cloud_catalog.proto +++ b/google/cloud/billing/v1/cloud_catalog.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // 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"; @@ -36,7 +35,10 @@ option objc_class_prefix = "CLDCTLG"; // and SKUs. service CloudCatalog { option (google.api.default_host) = "cloudbilling.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-billing.readonly," + "https://www.googleapis.com/auth/cloud-platform"; // Lists all public cloud services. rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { @@ -111,6 +113,9 @@ message Sku { // Identifies the service provider. // This is 'Google' for first party services in Google Cloud Platform. string service_provider_name = 7; + + // The geographic taxonomy for this sku. + GeoTaxonomy geo_taxonomy = 8; } // Represents the category hierarchy of a SKU. @@ -187,6 +192,21 @@ message PricingExpression { // Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte". string usage_unit = 1; + // The recommended quantity of units for displaying pricing info. When + // displaying pricing info it is recommended to display: + // (unit_price * display_quantity) per display_quantity usage_unit. + // This field does not affect the pricing formula and is for display purposes + // only. + // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and + // the display_quantity is "1000" then the recommended way of displaying the + // pricing info is "0.10 USD per 1000 GB" + double display_quantity = 2; + + // The list of tiered rates for this pricing. The total cost is computed by + // applying each of the tiered rates on usage. This repeated list is sorted + // by ascending order of start_usage_amount. + repeated TierRate tiered_rates = 3; + // The unit of usage in human readable form. // Example: "gibi byte". string usage_unit_description = 4; @@ -205,21 +225,6 @@ message PricingExpression { // start_usage_amount * base_unit_conversion_factor = start_usage_amount in // base_unit. double base_unit_conversion_factor = 7; - - // The recommended quantity of units for displaying pricing info. When - // displaying pricing info it is recommended to display: - // (unit_price * display_quantity) per display_quantity usage_unit. - // This field does not affect the pricing formula and is for display purposes - // only. - // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and - // the display_quantity is "1000" then the recommended way of displaying the - // pricing info is "0.10 USD per 1000 GB" - double display_quantity = 2; - - // The list of tiered rates for this pricing. The total cost is computed by - // applying each of the tiered rates on usage. This repeated list is sorted - // by ascending order of start_usage_amount. - repeated TierRate tiered_rates = 3; } // Represents the aggregation level and interval for pricing of a single SKU. @@ -256,6 +261,33 @@ message AggregationInfo { int32 aggregation_count = 3; } +// Encapsulates the geographic taxonomy data for a sku. +message GeoTaxonomy { + // The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL. + enum Type { + // The type is not specified. + TYPE_UNSPECIFIED = 0; + + // The sku is global in nature, e.g. a license sku. Global skus are + // available in all regions, and so have an empty region list. + GLOBAL = 1; + + // The sku is available in a specific region, e.g. "us-west2". + REGIONAL = 2; + + // The sku is associated with multiple regions, e.g. "us-west2" and + // "us-east1". + MULTI_REGIONAL = 3; + } + + // The type of Geo Taxonomy: GLOBAL, REGIONAL, or MULTI_REGIONAL. + Type type = 1; + + // The list of regions associated with a sku. Empty for Global skus, which are + // associated with all Google Cloud regions. + repeated string regions = 2; +} + // Request message for `ListServices`. message ListServicesRequest { // Requested page size. Defaults to 5000. diff --git a/google/cloud/billing/v1/cloudbilling.yaml b/google/cloud/billing/v1/cloudbilling.yaml index fb0e32e1b54c6..3f4c56751fd19 100644 --- a/google/cloud/billing/v1/cloudbilling.yaml +++ b/google/cloud/billing/v1/cloudbilling.yaml @@ -1,5 +1,5 @@ type: google.api.Service -config_version: 1 +config_version: 3 name: cloudbilling.googleapis.com title: Cloud Billing API @@ -17,12 +17,38 @@ authentication: - selector: 'google.cloud.billing.v1.CloudBilling.*' oauth: canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-billing.readonly, + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.billing.v1.CloudBilling.CreateBillingAccount + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.billing.v1.CloudBilling.SetIamPolicy + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.billing.v1.CloudBilling.UpdateBillingAccount + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-platform + - selector: google.cloud.billing.v1.CloudBilling.UpdateProjectBillingInfo + oauth: + canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, https://www.googleapis.com/auth/cloud-platform - selector: google.cloud.billing.v1.CloudCatalog.ListServices oauth: canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-billing.readonly, https://www.googleapis.com/auth/cloud-platform - selector: google.cloud.billing.v1.CloudCatalog.ListSkus oauth: canonical_scopes: |- + https://www.googleapis.com/auth/cloud-billing, + https://www.googleapis.com/auth/cloud-billing.readonly, https://www.googleapis.com/auth/cloud-platform