google-cloud-billing-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +166 -0
- data/LICENSE.md +201 -0
- data/README.md +24 -0
- data/lib/google/cloud/billing/v1/cloud_billing/client.rb +955 -0
- data/lib/google/cloud/billing/v1/cloud_billing/credentials.rb +52 -0
- data/lib/google/cloud/billing/v1/cloud_billing/paths.rb +45 -0
- data/lib/google/cloud/billing/v1/cloud_billing.rb +20 -0
- data/lib/google/cloud/billing/v1/cloud_billing_pb.rb +84 -0
- data/lib/google/cloud/billing/v1/cloud_billing_services_pb.rb +127 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/client.rb +326 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/credentials.rb +52 -0
- data/lib/google/cloud/billing/v1/cloud_catalog/paths.rb +45 -0
- data/lib/google/cloud/billing/v1/cloud_catalog.rb +20 -0
- data/lib/google/cloud/billing/v1/cloud_catalog_pb.rb +113 -0
- data/lib/google/cloud/billing/v1/cloud_catalog_services_pb.rb +50 -0
- data/lib/google/cloud/billing/v1/version.rb +28 -0
- data/lib/google/cloud/billing/v1.rb +20 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google-cloud-billing-v1.rb +1 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/billing/v1/cloud_billing.rb +217 -0
- data/proto_docs/google/cloud/billing/v1/cloud_catalog.rb +319 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +79 -0
- data/proto_docs/google/iam/v1/policy.rb +156 -0
- data/proto_docs/google/protobuf/field_mask.rb +237 -0
- data/proto_docs/google/protobuf/timestamp.rb +116 -0
- data/proto_docs/google/type/money.rb +43 -0
- metadata +199 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Billing
|
25
|
+
module V1
|
26
|
+
module CloudBilling
|
27
|
+
# Credentials for the CloudBilling API.
|
28
|
+
class Credentials < Google::Auth::Credentials
|
29
|
+
self.scope = [
|
30
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
31
|
+
]
|
32
|
+
self.env_vars = [
|
33
|
+
"BILLING_CREDENTIALS",
|
34
|
+
"BILLING_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE",
|
37
|
+
"GCLOUD_KEYFILE",
|
38
|
+
"BILLING_CREDENTIALS_JSON",
|
39
|
+
"BILLING_KEYFILE_JSON",
|
40
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
41
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
42
|
+
"GCLOUD_KEYFILE_JSON"
|
43
|
+
]
|
44
|
+
self.paths = [
|
45
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
46
|
+
]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module Billing
|
23
|
+
module V1
|
24
|
+
module CloudBilling
|
25
|
+
# Path helper methods for the CloudBilling API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified BillingAccount resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `billingAccounts/{billing_account}`
|
33
|
+
#
|
34
|
+
# @param billing_account [String]
|
35
|
+
#
|
36
|
+
# @return [String]
|
37
|
+
def billing_account_path billing_account:
|
38
|
+
"billingAccounts/#{billing_account}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/billing/v1/cloud_billing/client"
|
20
|
+
require "google/cloud/billing/v1/cloud_billing/credentials"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/billing/v1/cloud_billing.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/iam/v1/iam_policy_pb'
|
11
|
+
require 'google/iam/v1/policy_pb'
|
12
|
+
require 'google/protobuf/field_mask_pb'
|
13
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
14
|
+
add_file("google/cloud/billing/v1/cloud_billing.proto", :syntax => :proto3) do
|
15
|
+
add_message "google.cloud.billing.v1.BillingAccount" do
|
16
|
+
optional :name, :string, 1
|
17
|
+
optional :open, :bool, 2
|
18
|
+
optional :display_name, :string, 3
|
19
|
+
optional :master_billing_account, :string, 4
|
20
|
+
end
|
21
|
+
add_message "google.cloud.billing.v1.ProjectBillingInfo" do
|
22
|
+
optional :name, :string, 1
|
23
|
+
optional :project_id, :string, 2
|
24
|
+
optional :billing_account_name, :string, 3
|
25
|
+
optional :billing_enabled, :bool, 4
|
26
|
+
end
|
27
|
+
add_message "google.cloud.billing.v1.GetBillingAccountRequest" do
|
28
|
+
optional :name, :string, 1
|
29
|
+
end
|
30
|
+
add_message "google.cloud.billing.v1.ListBillingAccountsRequest" do
|
31
|
+
optional :page_size, :int32, 1
|
32
|
+
optional :page_token, :string, 2
|
33
|
+
optional :filter, :string, 3
|
34
|
+
end
|
35
|
+
add_message "google.cloud.billing.v1.ListBillingAccountsResponse" do
|
36
|
+
repeated :billing_accounts, :message, 1, "google.cloud.billing.v1.BillingAccount"
|
37
|
+
optional :next_page_token, :string, 2
|
38
|
+
end
|
39
|
+
add_message "google.cloud.billing.v1.CreateBillingAccountRequest" do
|
40
|
+
optional :billing_account, :message, 1, "google.cloud.billing.v1.BillingAccount"
|
41
|
+
end
|
42
|
+
add_message "google.cloud.billing.v1.UpdateBillingAccountRequest" do
|
43
|
+
optional :name, :string, 1
|
44
|
+
optional :account, :message, 2, "google.cloud.billing.v1.BillingAccount"
|
45
|
+
optional :update_mask, :message, 3, "google.protobuf.FieldMask"
|
46
|
+
end
|
47
|
+
add_message "google.cloud.billing.v1.ListProjectBillingInfoRequest" do
|
48
|
+
optional :name, :string, 1
|
49
|
+
optional :page_size, :int32, 2
|
50
|
+
optional :page_token, :string, 3
|
51
|
+
end
|
52
|
+
add_message "google.cloud.billing.v1.ListProjectBillingInfoResponse" do
|
53
|
+
repeated :project_billing_info, :message, 1, "google.cloud.billing.v1.ProjectBillingInfo"
|
54
|
+
optional :next_page_token, :string, 2
|
55
|
+
end
|
56
|
+
add_message "google.cloud.billing.v1.GetProjectBillingInfoRequest" do
|
57
|
+
optional :name, :string, 1
|
58
|
+
end
|
59
|
+
add_message "google.cloud.billing.v1.UpdateProjectBillingInfoRequest" do
|
60
|
+
optional :name, :string, 1
|
61
|
+
optional :project_billing_info, :message, 2, "google.cloud.billing.v1.ProjectBillingInfo"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
module Google
|
67
|
+
module Cloud
|
68
|
+
module Billing
|
69
|
+
module V1
|
70
|
+
BillingAccount = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.BillingAccount").msgclass
|
71
|
+
ProjectBillingInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ProjectBillingInfo").msgclass
|
72
|
+
GetBillingAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.GetBillingAccountRequest").msgclass
|
73
|
+
ListBillingAccountsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ListBillingAccountsRequest").msgclass
|
74
|
+
ListBillingAccountsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ListBillingAccountsResponse").msgclass
|
75
|
+
CreateBillingAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.CreateBillingAccountRequest").msgclass
|
76
|
+
UpdateBillingAccountRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.UpdateBillingAccountRequest").msgclass
|
77
|
+
ListProjectBillingInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ListProjectBillingInfoRequest").msgclass
|
78
|
+
ListProjectBillingInfoResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.ListProjectBillingInfoResponse").msgclass
|
79
|
+
GetProjectBillingInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.GetProjectBillingInfoRequest").msgclass
|
80
|
+
UpdateProjectBillingInfoRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.billing.v1.UpdateProjectBillingInfoRequest").msgclass
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/billing/v1/cloud_billing.proto for package 'google.cloud.billing.v1'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2019 Google LLC.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'grpc'
|
21
|
+
require 'google/cloud/billing/v1/cloud_billing_pb'
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Cloud
|
25
|
+
module Billing
|
26
|
+
module V1
|
27
|
+
module CloudBilling
|
28
|
+
# Retrieves GCP Console billing accounts and associates them with projects.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.billing.v1.CloudBilling'
|
36
|
+
|
37
|
+
# Gets information about a billing account. The current authenticated user
|
38
|
+
# must be a [viewer of the billing
|
39
|
+
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
40
|
+
rpc :GetBillingAccount, GetBillingAccountRequest, BillingAccount
|
41
|
+
# Lists the billing accounts that the current authenticated user has
|
42
|
+
# permission to
|
43
|
+
# [view](https://cloud.google.com/billing/docs/how-to/billing-access).
|
44
|
+
rpc :ListBillingAccounts, ListBillingAccountsRequest, ListBillingAccountsResponse
|
45
|
+
# Updates a billing account's fields.
|
46
|
+
# Currently the only field that can be edited is `display_name`.
|
47
|
+
# The current authenticated user must have the `billing.accounts.update`
|
48
|
+
# IAM permission, which is typically given to the
|
49
|
+
# [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
|
50
|
+
# of the billing account.
|
51
|
+
rpc :UpdateBillingAccount, UpdateBillingAccountRequest, BillingAccount
|
52
|
+
# Creates a billing account.
|
53
|
+
# This method can only be used to create
|
54
|
+
# [billing subaccounts](https://cloud.google.com/billing/docs/concepts)
|
55
|
+
# by GCP resellers.
|
56
|
+
# When creating a subaccount, the current authenticated user must have the
|
57
|
+
# `billing.accounts.update` IAM permission on the master account, which is
|
58
|
+
# typically given to billing account
|
59
|
+
# [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
|
60
|
+
# This method will return an error if the master account has not been
|
61
|
+
# provisioned as a reseller account.
|
62
|
+
rpc :CreateBillingAccount, CreateBillingAccountRequest, BillingAccount
|
63
|
+
# Lists the projects associated with a billing account. The current
|
64
|
+
# authenticated user must have the `billing.resourceAssociations.list` IAM
|
65
|
+
# permission, which is often given to billing account
|
66
|
+
# [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
|
67
|
+
rpc :ListProjectBillingInfo, ListProjectBillingInfoRequest, ListProjectBillingInfoResponse
|
68
|
+
# Gets the billing information for a project. The current authenticated user
|
69
|
+
# must have [permission to view the
|
70
|
+
# project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
71
|
+
# ).
|
72
|
+
rpc :GetProjectBillingInfo, GetProjectBillingInfoRequest, ProjectBillingInfo
|
73
|
+
# Sets or updates the billing account associated with a project. You specify
|
74
|
+
# the new billing account by setting the `billing_account_name` in the
|
75
|
+
# `ProjectBillingInfo` resource to the resource name of a billing account.
|
76
|
+
# Associating a project with an open billing account enables billing on the
|
77
|
+
# project and allows charges for resource usage. If the project already had a
|
78
|
+
# billing account, this method changes the billing account used for resource
|
79
|
+
# usage charges.
|
80
|
+
#
|
81
|
+
# *Note:* Incurred charges that have not yet been reported in the transaction
|
82
|
+
# history of the GCP Console might be billed to the new billing
|
83
|
+
# account, even if the charge occurred before the new billing account was
|
84
|
+
# assigned to the project.
|
85
|
+
#
|
86
|
+
# The current authenticated user must have ownership privileges for both the
|
87
|
+
# [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
|
88
|
+
# ) and the [billing
|
89
|
+
# account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
90
|
+
#
|
91
|
+
# You can disable billing on the project by setting the
|
92
|
+
# `billing_account_name` field to empty. This action disassociates the
|
93
|
+
# current billing account from the project. Any billable activity of your
|
94
|
+
# in-use services will stop, and your application could stop functioning as
|
95
|
+
# expected. Any unbilled charges to date will be billed to the previously
|
96
|
+
# associated account. The current authenticated user must be either an owner
|
97
|
+
# of the project or an owner of the billing account for the project.
|
98
|
+
#
|
99
|
+
# Note that associating a project with a *closed* billing account will have
|
100
|
+
# much the same effect as disabling billing on the project: any paid
|
101
|
+
# resources used by the project will be shut down. Thus, unless you wish to
|
102
|
+
# disable billing, you should always call this method with the name of an
|
103
|
+
# *open* billing account.
|
104
|
+
rpc :UpdateProjectBillingInfo, UpdateProjectBillingInfoRequest, ProjectBillingInfo
|
105
|
+
# Gets the access control policy for a billing account.
|
106
|
+
# The caller must have the `billing.accounts.getIamPolicy` permission on the
|
107
|
+
# account, which is often given to billing account
|
108
|
+
# [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
|
109
|
+
rpc :GetIamPolicy, Google::Iam::V1::GetIamPolicyRequest, Google::Iam::V1::Policy
|
110
|
+
# Sets the access control policy for a billing account. Replaces any existing
|
111
|
+
# policy.
|
112
|
+
# The caller must have the `billing.accounts.setIamPolicy` permission on the
|
113
|
+
# account, which is often given to billing account
|
114
|
+
# [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
|
115
|
+
rpc :SetIamPolicy, Google::Iam::V1::SetIamPolicyRequest, Google::Iam::V1::Policy
|
116
|
+
# Tests the access control policy for a billing account. This method takes
|
117
|
+
# the resource and a set of permissions as input and returns the subset of
|
118
|
+
# the input permissions that the caller is allowed for that resource.
|
119
|
+
rpc :TestIamPermissions, Google::Iam::V1::TestIamPermissionsRequest, Google::Iam::V1::TestIamPermissionsResponse
|
120
|
+
end
|
121
|
+
|
122
|
+
Stub = Service.rpc_stub_class
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,326 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/errors"
|
24
|
+
require "google/cloud/billing/v1/version"
|
25
|
+
require "google/cloud/billing/v1/cloud_catalog_pb"
|
26
|
+
require "google/cloud/billing/v1/cloud_catalog/credentials"
|
27
|
+
require "google/cloud/billing/v1/cloud_catalog/paths"
|
28
|
+
|
29
|
+
|
30
|
+
module Google
|
31
|
+
module Cloud
|
32
|
+
module Billing
|
33
|
+
module V1
|
34
|
+
module CloudCatalog
|
35
|
+
# Service that implements CloudCatalog API.
|
36
|
+
class Client
|
37
|
+
include Paths
|
38
|
+
|
39
|
+
# @private
|
40
|
+
attr_reader :cloud_catalog_stub
|
41
|
+
|
42
|
+
##
|
43
|
+
# Configuration for the CloudCatalog Client API.
|
44
|
+
#
|
45
|
+
# @yield [config] Configure the Client client.
|
46
|
+
# @yieldparam config [Client::Configuration]
|
47
|
+
#
|
48
|
+
# @return [Client::Configuration]
|
49
|
+
#
|
50
|
+
def self.configure
|
51
|
+
@configure ||= begin
|
52
|
+
namespace = ["Google", "Cloud", "Billing", "V1"]
|
53
|
+
parent_config = while namespace.any?
|
54
|
+
parent_name = namespace.join "::"
|
55
|
+
parent_const = const_get parent_name
|
56
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
57
|
+
namespace.pop
|
58
|
+
end
|
59
|
+
Client::Configuration.new parent_config
|
60
|
+
end
|
61
|
+
yield @configure if block_given?
|
62
|
+
@configure
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Configure the CloudCatalog Client instance.
|
67
|
+
#
|
68
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
69
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
70
|
+
# should be made on {Client.configure}.
|
71
|
+
#
|
72
|
+
# @yield [config] Configure the Client client.
|
73
|
+
# @yieldparam config [Client::Configuration]
|
74
|
+
#
|
75
|
+
# @return [Client::Configuration]
|
76
|
+
#
|
77
|
+
def configure
|
78
|
+
yield @config if block_given?
|
79
|
+
@config
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Create a new Client client object.
|
84
|
+
#
|
85
|
+
# @yield [config] Configure the Client client.
|
86
|
+
# @yieldparam config [Client::Configuration]
|
87
|
+
#
|
88
|
+
def initialize
|
89
|
+
# These require statements are intentionally placed here to initialize
|
90
|
+
# the gRPC module only when it's required.
|
91
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
92
|
+
require "gapic/grpc"
|
93
|
+
require "google/cloud/billing/v1/cloud_catalog_services_pb"
|
94
|
+
|
95
|
+
# Create the configuration object
|
96
|
+
@config = Configuration.new Client.configure
|
97
|
+
|
98
|
+
# Yield the configuration if needed
|
99
|
+
yield @config if block_given?
|
100
|
+
|
101
|
+
# Create credentials
|
102
|
+
credentials = @config.credentials
|
103
|
+
credentials ||= Credentials.default scope: @config.scope
|
104
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
105
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
@cloud_catalog_stub = Gapic::ServiceStub.new(
|
110
|
+
Google::Cloud::Billing::V1::CloudCatalog::Stub,
|
111
|
+
credentials: credentials,
|
112
|
+
endpoint: @config.endpoint,
|
113
|
+
channel_args: @config.channel_args,
|
114
|
+
interceptors: @config.interceptors
|
115
|
+
)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Service calls
|
119
|
+
|
120
|
+
##
|
121
|
+
# Lists all public cloud services.
|
122
|
+
#
|
123
|
+
# @overload list_services(request, options = nil)
|
124
|
+
# @param request [Google::Cloud::Billing::V1::ListServicesRequest | Hash]
|
125
|
+
# Lists all public cloud services.
|
126
|
+
# @param options [Gapic::CallOptions, Hash]
|
127
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
128
|
+
#
|
129
|
+
# @overload list_services(page_size: nil, page_token: nil)
|
130
|
+
# @param page_size [Integer]
|
131
|
+
# Requested page size. Defaults to 5000.
|
132
|
+
# @param page_token [String]
|
133
|
+
# A token identifying a page of results to return. This should be a
|
134
|
+
# `next_page_token` value returned from a previous `ListServices`
|
135
|
+
# call. If unspecified, the first page of results is returned.
|
136
|
+
#
|
137
|
+
#
|
138
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
139
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::Billing::V1::Service>]
|
140
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
141
|
+
#
|
142
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Billing::V1::Service>]
|
143
|
+
#
|
144
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
145
|
+
#
|
146
|
+
def list_services request, options = nil
|
147
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
148
|
+
|
149
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::ListServicesRequest
|
150
|
+
|
151
|
+
# Converts hash and nil to an options object
|
152
|
+
options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
|
153
|
+
|
154
|
+
# Customize the options with defaults
|
155
|
+
metadata = @config.rpcs.list_services.metadata.to_h
|
156
|
+
|
157
|
+
# Set x-goog-api-client header
|
158
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
159
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
160
|
+
gapic_version: Google::Cloud::Billing::V1::VERSION
|
161
|
+
|
162
|
+
options.apply_defaults timeout: @config.rpcs.list_services.timeout,
|
163
|
+
metadata: metadata,
|
164
|
+
retry_policy: @config.rpcs.list_services.retry_policy
|
165
|
+
options.apply_defaults metadata: @config.metadata,
|
166
|
+
retry_policy: @config.retry_policy
|
167
|
+
|
168
|
+
@cloud_catalog_stub.call_rpc :list_services, request, options: options do |response, operation|
|
169
|
+
response = Gapic::PagedEnumerable.new @cloud_catalog_stub, :list_services, request, response, operation, options
|
170
|
+
yield response, operation if block_given?
|
171
|
+
return response
|
172
|
+
end
|
173
|
+
rescue GRPC::BadStatus => e
|
174
|
+
raise Google::Cloud::Error.from_error(e)
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Lists all publicly available SKUs for a given cloud service.
|
179
|
+
#
|
180
|
+
# @overload list_skus(request, options = nil)
|
181
|
+
# @param request [Google::Cloud::Billing::V1::ListSkusRequest | Hash]
|
182
|
+
# Lists all publicly available SKUs for a given cloud service.
|
183
|
+
# @param options [Gapic::CallOptions, Hash]
|
184
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
185
|
+
#
|
186
|
+
# @overload list_skus(parent: nil, start_time: nil, end_time: nil, currency_code: nil, page_size: nil, page_token: nil)
|
187
|
+
# @param parent [String]
|
188
|
+
# Required. The name of the service.
|
189
|
+
# Example: "services/DA34-426B-A397"
|
190
|
+
# @param start_time [Google::Protobuf::Timestamp | Hash]
|
191
|
+
# Optional inclusive start time of the time range for which the pricing
|
192
|
+
# versions will be returned. Timestamps in the future are not allowed.
|
193
|
+
# The time range has to be within a single calendar month in
|
194
|
+
# America/Los_Angeles timezone. Time range as a whole is optional. If not
|
195
|
+
# specified, the latest pricing will be returned (up to 12 hours old at
|
196
|
+
# most).
|
197
|
+
# @param end_time [Google::Protobuf::Timestamp | Hash]
|
198
|
+
# Optional exclusive end time of the time range for which the pricing
|
199
|
+
# versions will be returned. Timestamps in the future are not allowed.
|
200
|
+
# The time range has to be within a single calendar month in
|
201
|
+
# America/Los_Angeles timezone. Time range as a whole is optional. If not
|
202
|
+
# specified, the latest pricing will be returned (up to 12 hours old at
|
203
|
+
# most).
|
204
|
+
# @param currency_code [String]
|
205
|
+
# The ISO 4217 currency code for the pricing info in the response proto.
|
206
|
+
# Will use the conversion rate as of start_time.
|
207
|
+
# Optional. If not specified USD will be used.
|
208
|
+
# @param page_size [Integer]
|
209
|
+
# Requested page size. Defaults to 5000.
|
210
|
+
# @param page_token [String]
|
211
|
+
# A token identifying a page of results to return. This should be a
|
212
|
+
# `next_page_token` value returned from a previous `ListSkus`
|
213
|
+
# call. If unspecified, the first page of results is returned.
|
214
|
+
#
|
215
|
+
#
|
216
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
217
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::Billing::V1::Sku>]
|
218
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
219
|
+
#
|
220
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::Billing::V1::Sku>]
|
221
|
+
#
|
222
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
223
|
+
#
|
224
|
+
def list_skus request, options = nil
|
225
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
226
|
+
|
227
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Billing::V1::ListSkusRequest
|
228
|
+
|
229
|
+
# Converts hash and nil to an options object
|
230
|
+
options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h
|
231
|
+
|
232
|
+
# Customize the options with defaults
|
233
|
+
metadata = @config.rpcs.list_skus.metadata.to_h
|
234
|
+
|
235
|
+
# Set x-goog-api-client header
|
236
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
237
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
238
|
+
gapic_version: Google::Cloud::Billing::V1::VERSION
|
239
|
+
|
240
|
+
header_params = {
|
241
|
+
"parent" => request.parent
|
242
|
+
}
|
243
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
244
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
245
|
+
|
246
|
+
options.apply_defaults timeout: @config.rpcs.list_skus.timeout,
|
247
|
+
metadata: metadata,
|
248
|
+
retry_policy: @config.rpcs.list_skus.retry_policy
|
249
|
+
options.apply_defaults metadata: @config.metadata,
|
250
|
+
retry_policy: @config.retry_policy
|
251
|
+
|
252
|
+
@cloud_catalog_stub.call_rpc :list_skus, request, options: options do |response, operation|
|
253
|
+
response = Gapic::PagedEnumerable.new @cloud_catalog_stub, :list_skus, request, response, operation, options
|
254
|
+
yield response, operation if block_given?
|
255
|
+
return response
|
256
|
+
end
|
257
|
+
rescue GRPC::BadStatus => e
|
258
|
+
raise Google::Cloud::Error.from_error(e)
|
259
|
+
end
|
260
|
+
|
261
|
+
##
|
262
|
+
# Configuration class for the CloudCatalog API.
|
263
|
+
class Configuration
|
264
|
+
extend Gapic::Config
|
265
|
+
|
266
|
+
config_attr :endpoint, "cloudbilling.googleapis.com", String
|
267
|
+
config_attr :credentials, nil do |value|
|
268
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
269
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
270
|
+
allowed.any? { |klass| klass === value }
|
271
|
+
end
|
272
|
+
config_attr :scope, nil, String, Array, nil
|
273
|
+
config_attr :lib_name, nil, String, nil
|
274
|
+
config_attr :lib_version, nil, String, nil
|
275
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
276
|
+
config_attr :interceptors, nil, Array, nil
|
277
|
+
config_attr :timeout, nil, Numeric, nil
|
278
|
+
config_attr :metadata, nil, Hash, nil
|
279
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
280
|
+
|
281
|
+
def initialize parent_config = nil
|
282
|
+
@parent_config = parent_config unless parent_config.nil?
|
283
|
+
|
284
|
+
yield self if block_given?
|
285
|
+
end
|
286
|
+
|
287
|
+
def rpcs
|
288
|
+
@rpcs ||= begin
|
289
|
+
parent_rpcs = nil
|
290
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
291
|
+
Rpcs.new parent_rpcs
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Configuration RPC class for the CloudCatalog API.
|
297
|
+
class Rpcs
|
298
|
+
attr_reader :list_services
|
299
|
+
attr_reader :list_skus
|
300
|
+
|
301
|
+
def initialize parent_rpcs = nil
|
302
|
+
list_services_config = parent_rpcs&.list_services if parent_rpcs&.respond_to? :list_services
|
303
|
+
@list_services = Gapic::Config::Method.new list_services_config
|
304
|
+
list_skus_config = parent_rpcs&.list_skus if parent_rpcs&.respond_to? :list_skus
|
305
|
+
@list_skus = Gapic::Config::Method.new list_skus_config
|
306
|
+
|
307
|
+
yield self if block_given?
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
# rubocop:disable Lint/HandleExceptions
|
319
|
+
|
320
|
+
# Once client is loaded, load helpers.rb if it exists.
|
321
|
+
begin
|
322
|
+
require "google/cloud/billing/v1/cloud_catalog/helpers"
|
323
|
+
rescue LoadError
|
324
|
+
end
|
325
|
+
|
326
|
+
# rubocop:enable Lint/HandleExceptions
|