Skip to content

Commit

Permalink
feat: added Sku.geo_taxonomy
Browse files Browse the repository at this point in the history
fix: more oauth scopes

PiperOrigin-RevId: 488493014
  • Loading branch information
Google APIs authored and Copybara-Service committed Nov 15, 2022
1 parent 452324b commit 8995a88
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 48 deletions.
23 changes: 20 additions & 3 deletions 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"])
Expand Down Expand Up @@ -62,15 +71,18 @@ 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",
],
transport = "grpc+rest",
deps = [
":billing_java_proto",
"//google/api:api_java_proto",
"//google/iam/v1:iam_java_proto",
],
)
Expand Down Expand Up @@ -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",
Expand All @@ -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",
],
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
65 changes: 39 additions & 26 deletions 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.
Expand All @@ -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";

Expand All @@ -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
Expand Down Expand Up @@ -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) = {
Expand All @@ -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"
Expand All @@ -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.
//
Expand Down Expand Up @@ -184,37 +193,41 @@ 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
// therefore projects associated with it will be unable to use paid services.
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
Expand Down Expand Up @@ -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];
}
Expand Down
68 changes: 50 additions & 18 deletions 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.
Expand All @@ -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";

Expand All @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
28 changes: 27 additions & 1 deletion 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

Expand All @@ -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

0 comments on commit 8995a88

Please sign in to comment.