google-cloud-billing-budgets-v1 0.2.0 → 0.4.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 +4 -4
- data/AUTHENTICATION.md +1 -1
- data/README.md +3 -3
- data/lib/google/cloud/billing/budgets/v1/budget_model_pb.rb +27 -61
- data/lib/google/cloud/billing/budgets/v1/budget_service/client.rb +10 -10
- data/lib/google/cloud/billing/budgets/v1/budget_service/rest/client.rb +685 -0
- data/lib/google/cloud/billing/budgets/v1/budget_service/rest/service_stub.rb +347 -0
- data/lib/google/cloud/billing/budgets/v1/budget_service/rest.rb +55 -0
- data/lib/google/cloud/billing/budgets/v1/budget_service.rb +7 -1
- data/lib/google/cloud/billing/budgets/v1/budget_service_pb.rb +26 -24
- data/lib/google/cloud/billing/budgets/v1/rest.rb +39 -0
- data/lib/google/cloud/billing/budgets/v1/version.rb +1 -1
- data/lib/google/cloud/billing/budgets/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/cloud/billing/budgets/v1/budget_model.rb +99 -40
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/protobuf/struct.rb +1 -1
- metadata +16 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d24b2d9db95d65bfb26770cfc3dc94753e2bbe4ee3e3910f06cbe8ac78f925c
|
|
4
|
+
data.tar.gz: 7b068aade41ea66977e11cdd11d4211cf8fc4387b8faedf4ec4ce49d241682aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38364c8a2c5cc3879bd7bb1b8408b36fd9868dcbbbb9134d53abb2efc66464fc9be4731764417e8f4177a47e63af8b38803843639acc3a0e13528c28c2ef3d5f
|
|
7
|
+
data.tar.gz: 317d44dade417a1c089cb9abed8637f5db674d31dd3a2bacfd54e19817a2a177eec7a40ccf045a427f20455b7643a87fbdd549597e1c9926ecb9f1e992044475
|
data/AUTHENTICATION.md
CHANGED
|
@@ -114,7 +114,7 @@ credentials are discovered.
|
|
|
114
114
|
To configure your system for this, simply:
|
|
115
115
|
|
|
116
116
|
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
|
117
|
+
2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
|
|
118
118
|
3. Write code as if already authenticated.
|
|
119
119
|
|
|
120
120
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Ruby Client for the Billing Budgets V1 API
|
|
2
2
|
|
|
3
|
-
API
|
|
3
|
+
The Cloud Billing Budget API stores Cloud Billing budgets, which define a budget plan and the rules to execute as spend is tracked against that plan.
|
|
4
4
|
|
|
5
5
|
Provides methods to view, create, and manage Cloud Billing budgets programmatically at scale.
|
|
6
6
|
|
|
@@ -46,8 +46,8 @@ for general usage information.
|
|
|
46
46
|
## Enabling Logging
|
|
47
47
|
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
|
50
|
-
or a [`Google::Cloud::Logging::Logger`](https://
|
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
|
50
|
+
or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
|
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
|
53
53
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
3
|
# source: google/cloud/billing/budgets/v1/budget_model.proto
|
|
3
4
|
|
|
@@ -9,69 +10,34 @@ require 'google/protobuf/struct_pb'
|
|
|
9
10
|
require 'google/type/date_pb'
|
|
10
11
|
require 'google/type/money_pb'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
value :BASIS_UNSPECIFIED, 0
|
|
37
|
-
value :CURRENT_SPEND, 1
|
|
38
|
-
value :FORECASTED_SPEND, 2
|
|
39
|
-
end
|
|
40
|
-
add_message "google.cloud.billing.budgets.v1.NotificationsRule" do
|
|
41
|
-
optional :pubsub_topic, :string, 1
|
|
42
|
-
optional :schema_version, :string, 2
|
|
43
|
-
repeated :monitoring_notification_channels, :string, 3
|
|
44
|
-
optional :disable_default_iam_recipients, :bool, 4
|
|
45
|
-
end
|
|
46
|
-
add_message "google.cloud.billing.budgets.v1.Filter" do
|
|
47
|
-
repeated :projects, :string, 1
|
|
48
|
-
repeated :credit_types, :string, 7
|
|
49
|
-
optional :credit_types_treatment, :enum, 4, "google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment"
|
|
50
|
-
repeated :services, :string, 3
|
|
51
|
-
repeated :subaccounts, :string, 5
|
|
52
|
-
map :labels, :string, :message, 6, "google.protobuf.ListValue"
|
|
53
|
-
oneof :usage_period do
|
|
54
|
-
optional :calendar_period, :enum, 8, "google.cloud.billing.budgets.v1.CalendarPeriod"
|
|
55
|
-
optional :custom_period, :message, 9, "google.cloud.billing.budgets.v1.CustomPeriod"
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
add_enum "google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment" do
|
|
59
|
-
value :CREDIT_TYPES_TREATMENT_UNSPECIFIED, 0
|
|
60
|
-
value :INCLUDE_ALL_CREDITS, 1
|
|
61
|
-
value :EXCLUDE_ALL_CREDITS, 2
|
|
62
|
-
value :INCLUDE_SPECIFIED_CREDITS, 3
|
|
63
|
-
end
|
|
64
|
-
add_message "google.cloud.billing.budgets.v1.CustomPeriod" do
|
|
65
|
-
optional :start_date, :message, 1, "google.type.Date"
|
|
66
|
-
optional :end_date, :message, 2, "google.type.Date"
|
|
67
|
-
end
|
|
68
|
-
add_enum "google.cloud.billing.budgets.v1.CalendarPeriod" do
|
|
69
|
-
value :CALENDAR_PERIOD_UNSPECIFIED, 0
|
|
70
|
-
value :MONTH, 1
|
|
71
|
-
value :QUARTER, 2
|
|
72
|
-
value :YEAR, 3
|
|
13
|
+
|
|
14
|
+
descriptor_data = "\n2google/cloud/billing/budgets/v1/budget_model.proto\x12\x1fgoogle.cloud.billing.budgets.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x16google/type/date.proto\x1a\x17google/type/money.proto\"\xcf\x03\n\x06\x42udget\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x14\n\x0c\x64isplay_name\x18\x02 \x01(\t\x12\x43\n\rbudget_filter\x18\x03 \x01(\x0b\x32\'.google.cloud.billing.budgets.v1.FilterB\x03\xe0\x41\x01\x12\x42\n\x06\x61mount\x18\x04 \x01(\x0b\x32-.google.cloud.billing.budgets.v1.BudgetAmountB\x03\xe0\x41\x02\x12L\n\x0fthreshold_rules\x18\x05 \x03(\x0b\x32..google.cloud.billing.budgets.v1.ThresholdRuleB\x03\xe0\x41\x01\x12S\n\x12notifications_rule\x18\x06 \x01(\x0b\x32\x32.google.cloud.billing.budgets.v1.NotificationsRuleB\x03\xe0\x41\x01\x12\x11\n\x04\x65tag\x18\x07 \x01(\tB\x03\xe0\x41\x01:]\xea\x41Z\n$billingbudgets.googleapis.com/Budget\x12\x32\x62illingAccounts/{billing_account}/budgets/{budget}\"\xa0\x01\n\x0c\x42udgetAmount\x12.\n\x10specified_amount\x18\x01 \x01(\x0b\x32\x12.google.type.MoneyH\x00\x12O\n\x12last_period_amount\x18\x02 \x01(\x0b\x32\x31.google.cloud.billing.budgets.v1.LastPeriodAmountH\x00\x42\x0f\n\rbudget_amount\"\x12\n\x10LastPeriodAmount\"\xc8\x01\n\rThresholdRule\x12\x1e\n\x11threshold_percent\x18\x01 \x01(\x01\x42\x03\xe0\x41\x02\x12N\n\x0bspend_basis\x18\x02 \x01(\x0e\x32\x34.google.cloud.billing.budgets.v1.ThresholdRule.BasisB\x03\xe0\x41\x01\"G\n\x05\x42\x61sis\x12\x15\n\x11\x42\x41SIS_UNSPECIFIED\x10\x00\x12\x11\n\rCURRENT_SPEND\x10\x01\x12\x14\n\x10\x46ORECASTED_SPEND\x10\x02\"\xa7\x01\n\x11NotificationsRule\x12\x19\n\x0cpubsub_topic\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0eschema_version\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12-\n monitoring_notification_channels\x18\x03 \x03(\tB\x03\xe0\x41\x01\x12+\n\x1e\x64isable_default_iam_recipients\x18\x04 \x01(\x08\x42\x03\xe0\x41\x01\"\xc4\x05\n\x06\x46ilter\x12\x15\n\x08projects\x18\x01 \x03(\tB\x03\xe0\x41\x01\x12\x1f\n\x12resource_ancestors\x18\x02 \x03(\tB\x03\xe0\x41\x01\x12\x19\n\x0c\x63redit_types\x18\x07 \x03(\tB\x03\xe0\x41\x01\x12\x61\n\x16\x63redit_types_treatment\x18\x04 \x01(\x0e\x32<.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatmentB\x03\xe0\x41\x01\x12\x15\n\x08services\x18\x03 \x03(\tB\x03\xe0\x41\x01\x12\x18\n\x0bsubaccounts\x18\x05 \x03(\tB\x03\xe0\x41\x01\x12H\n\x06labels\x18\x06 \x03(\x0b\x32\x33.google.cloud.billing.budgets.v1.Filter.LabelsEntryB\x03\xe0\x41\x01\x12O\n\x0f\x63\x61lendar_period\x18\x08 \x01(\x0e\x32/.google.cloud.billing.budgets.v1.CalendarPeriodB\x03\xe0\x41\x01H\x00\x12K\n\rcustom_period\x18\t \x01(\x0b\x32-.google.cloud.billing.budgets.v1.CustomPeriodB\x03\xe0\x41\x01H\x00\x1aI\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12)\n\x05value\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.ListValue:\x02\x38\x01\"\x8f\x01\n\x14\x43reditTypesTreatment\x12&\n\"CREDIT_TYPES_TREATMENT_UNSPECIFIED\x10\x00\x12\x17\n\x13INCLUDE_ALL_CREDITS\x10\x01\x12\x17\n\x13\x45XCLUDE_ALL_CREDITS\x10\x02\x12\x1d\n\x19INCLUDE_SPECIFIED_CREDITS\x10\x03\x42\x0e\n\x0cusage_period\"d\n\x0c\x43ustomPeriod\x12*\n\nstart_date\x18\x01 \x01(\x0b\x32\x11.google.type.DateB\x03\xe0\x41\x02\x12(\n\x08\x65nd_date\x18\x02 \x01(\x0b\x32\x11.google.type.DateB\x03\xe0\x41\x01*S\n\x0e\x43\x61lendarPeriod\x12\x1f\n\x1b\x43\x41LENDAR_PERIOD_UNSPECIFIED\x10\x00\x12\t\n\x05MONTH\x10\x01\x12\x0b\n\x07QUARTER\x10\x02\x12\x08\n\x04YEAR\x10\x03\x42x\n#com.google.cloud.billing.budgets.v1B\x10\x42udgetModelProtoP\x01Z=cloud.google.com/go/billing/budgets/apiv1/budgetspb;budgetspbb\x06proto3"
|
|
15
|
+
|
|
16
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
|
17
|
+
|
|
18
|
+
begin
|
|
19
|
+
pool.add_serialized_file(descriptor_data)
|
|
20
|
+
rescue TypeError => e
|
|
21
|
+
# Compatibility code: will be removed in the next major version.
|
|
22
|
+
require 'google/protobuf/descriptor_pb'
|
|
23
|
+
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
|
24
|
+
parsed.clear_dependency
|
|
25
|
+
serialized = parsed.class.encode(parsed)
|
|
26
|
+
file = pool.add_serialized_file(serialized)
|
|
27
|
+
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
|
28
|
+
imports = [
|
|
29
|
+
["google.type.Money", "google/type/money.proto"],
|
|
30
|
+
["google.protobuf.ListValue", "google/protobuf/struct.proto"],
|
|
31
|
+
["google.type.Date", "google/type/date.proto"],
|
|
32
|
+
]
|
|
33
|
+
imports.each do |type_name, expected_filename|
|
|
34
|
+
import_file = pool.lookup(type_name).file_descriptor
|
|
35
|
+
if import_file.name != expected_filename
|
|
36
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
|
73
37
|
end
|
|
74
38
|
end
|
|
39
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
|
40
|
+
warn "This will become an error in the next major version."
|
|
75
41
|
end
|
|
76
42
|
|
|
77
43
|
module Google
|
|
@@ -147,7 +147,7 @@ module Google
|
|
|
147
147
|
credentials = @config.credentials
|
|
148
148
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
149
149
|
# but only if the default endpoint does not have a region prefix.
|
|
150
|
-
enable_self_signed_jwt = @config.endpoint ==
|
|
150
|
+
enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
151
151
|
!@config.endpoint.split(".").first.include?("-")
|
|
152
152
|
credentials ||= Credentials.default scope: @config.scope,
|
|
153
153
|
enable_self_signed_jwt: enable_self_signed_jwt
|
|
@@ -500,13 +500,11 @@ module Google
|
|
|
500
500
|
# # Call the list_budgets method.
|
|
501
501
|
# result = client.list_budgets request
|
|
502
502
|
#
|
|
503
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
|
504
|
-
# #
|
|
505
|
-
#
|
|
506
|
-
# # methods are also available for managing paging directly.
|
|
507
|
-
# result.each do |response|
|
|
503
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
504
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
505
|
+
# result.each do |item|
|
|
508
506
|
# # Each element is of type ::Google::Cloud::Billing::Budgets::V1::Budget.
|
|
509
|
-
# p
|
|
507
|
+
# p item
|
|
510
508
|
# end
|
|
511
509
|
#
|
|
512
510
|
def list_budgets request, options = nil
|
|
@@ -675,9 +673,9 @@ module Google
|
|
|
675
673
|
# * (`String`) The path to a service account key file in JSON format
|
|
676
674
|
# * (`Hash`) A service account key as a Hash
|
|
677
675
|
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
678
|
-
# (see the [googleauth docs](https://
|
|
676
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
679
677
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
680
|
-
# (see the [signet docs](https://
|
|
678
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
681
679
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
682
680
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
683
681
|
# * (`nil`) indicating no credentials
|
|
@@ -719,7 +717,9 @@ module Google
|
|
|
719
717
|
class Configuration
|
|
720
718
|
extend ::Gapic::Config
|
|
721
719
|
|
|
722
|
-
|
|
720
|
+
DEFAULT_ENDPOINT = "billingbudgets.googleapis.com"
|
|
721
|
+
|
|
722
|
+
config_attr :endpoint, DEFAULT_ENDPOINT, ::String
|
|
723
723
|
config_attr :credentials, nil do |value|
|
|
724
724
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
725
725
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|