google-cloud-pubsub 1.1.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +2 -1
  3. data/CHANGELOG.md +145 -0
  4. data/EMULATOR.md +1 -1
  5. data/TROUBLESHOOTING.md +2 -8
  6. data/lib/google/cloud/pubsub/async_publisher.rb +16 -21
  7. data/lib/google/cloud/pubsub/credentials.rb +2 -2
  8. data/lib/google/cloud/pubsub/project.rb +18 -26
  9. data/lib/google/cloud/pubsub/received_message.rb +38 -0
  10. data/lib/google/cloud/pubsub/retry_policy.rb +90 -0
  11. data/lib/google/cloud/pubsub/service.rb +125 -252
  12. data/lib/google/cloud/pubsub/subscriber/inventory.rb +43 -15
  13. data/lib/google/cloud/pubsub/subscriber/stream.rb +8 -10
  14. data/lib/google/cloud/pubsub/subscriber.rb +86 -15
  15. data/lib/google/cloud/pubsub/subscription/push_config.rb +2 -2
  16. data/lib/google/cloud/pubsub/subscription.rb +297 -7
  17. data/lib/google/cloud/pubsub/topic.rb +65 -2
  18. data/lib/google/cloud/pubsub/version.rb +1 -1
  19. data/lib/google/cloud/pubsub.rb +15 -18
  20. data/lib/google-cloud-pubsub.rb +13 -13
  21. metadata +11 -81
  22. data/lib/google/cloud/pubsub/v1/credentials.rb +0 -41
  23. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -21
  24. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +0 -21
  25. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -21
  26. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
  27. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
  28. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -222
  29. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -113
  30. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -744
  31. data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +0 -19
  32. data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -786
  33. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -105
  34. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1385
  35. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -144
  36. data/lib/google/cloud/pubsub/v1.rb +0 -17
  37. data/lib/google/pubsub/v1/pubsub_pb.rb +0 -249
  38. data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -211
@@ -19,6 +19,7 @@ require "google/cloud/pubsub/async_publisher"
19
19
  require "google/cloud/pubsub/batch_publisher"
20
20
  require "google/cloud/pubsub/subscription"
21
21
  require "google/cloud/pubsub/policy"
22
+ require "google/cloud/pubsub/retry_policy"
22
23
 
23
24
  module Google
24
25
  module Cloud
@@ -285,6 +286,28 @@ module Google
285
286
  # Managing Labels](https://cloud.google.com/pubsub/docs/labels).
286
287
  # @param [Boolean] message_ordering Whether to enable message ordering
287
288
  # on the subscription.
289
+ # @param [String] filter An expression written in the Cloud Pub/Sub filter language. If non-empty, then only
290
+ # {Message} instances whose `attributes` field matches the filter are delivered on this subscription. If
291
+ # empty, then no messages are filtered out. Optional.
292
+ # @param [Topic] dead_letter_topic The {Topic} to which dead letter messages for the subscription should be
293
+ # published. Dead lettering is done on a best effort basis. The same message might be dead lettered multiple
294
+ # times. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e.,
295
+ # `service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have permission to Publish() to
296
+ # this topic.
297
+ #
298
+ # The operation will fail if the topic does not exist. Users should ensure that there is a subscription
299
+ # attached to this topic since messages published to a topic with no subscriptions are lost.
300
+ # @param [Integer] dead_letter_max_delivery_attempts The maximum number of delivery attempts for any message in
301
+ # the subscription's dead letter policy. Dead lettering is done on a best effort basis. The same message might
302
+ # be dead lettered multiple times. The value must be between 5 and 100. If this parameter is 0, a default
303
+ # value of 5 is used. The `dead_letter_topic` must also be set.
304
+ # @param [RetryPolicy] retry_policy A policy that specifies how Cloud Pub/Sub retries message delivery for
305
+ # this subscription. If not set, the default retry policy is applied. This generally implies that messages
306
+ # will be retried as soon as possible for healthy subscribers. Retry Policy will be triggered on NACKs or
307
+ # acknowledgement deadline exceeded events for a given message.
308
+ #
309
+ # **EXPERIMENTAL:** This API might be changed in backward-incompatible ways and is not recommended for
310
+ # production use. It is not subject to any SLA or deprecation policy.
288
311
  #
289
312
  # @return [Google::Cloud::PubSub::Subscription]
290
313
  #
@@ -307,11 +330,51 @@ module Google
307
330
  # deadline: 120,
308
331
  # endpoint: "https://example.com/push"
309
332
  #
333
+ # @example Configure a Dead Letter Queues policy:
334
+ # require "google/cloud/pubsub"
335
+ #
336
+ # pubsub = Google::Cloud::PubSub.new
337
+ #
338
+ # # Dead Letter Queue (DLQ) testing requires IAM bindings to the Cloud Pub/Sub service account that is
339
+ # # automatically created and managed by the service team in a private project.
340
+ # my_project_number = "000000000000"
341
+ # service_account_email = "serviceAccount:service-#{my_project_number}@gcp-sa-pubsub.iam.gserviceaccount.com"
342
+ #
343
+ # dead_letter_topic = pubsub.topic "my-dead-letter-topic"
344
+ # dead_letter_subscription = dead_letter_topic.subscribe "my-dead-letter-sub"
345
+ #
346
+ # dead_letter_topic.policy { |p| p.add "roles/pubsub.publisher", service_account_email }
347
+ # dead_letter_subscription.policy { |p| p.add "roles/pubsub.subscriber", service_account_email }
348
+ #
349
+ # topic = pubsub.topic "my-topic"
350
+ # sub = topic.subscribe "my-topic-sub",
351
+ # dead_letter_topic: dead_letter_topic,
352
+ # dead_letter_max_delivery_attempts: 10
353
+ #
354
+ # @example Configure a Retry Policy:
355
+ # require "google/cloud/pubsub"
356
+ #
357
+ # pubsub = Google::Cloud::PubSub.new
358
+ #
359
+ # topic = pubsub.topic "my-topic"
360
+ #
361
+ # retry_policy = Google::Cloud::PubSub::RetryPolicy.new minimum_backoff: 5, maximum_backoff: 300
362
+ # sub = topic.subscribe "my-topic-sub", retry_policy: retry_policy
363
+ #
310
364
  def subscribe subscription_name, deadline: nil, retain_acked: false, retention: nil, endpoint: nil, labels: nil,
311
- message_ordering: nil
365
+ message_ordering: nil, filter: nil, dead_letter_topic: nil,
366
+ dead_letter_max_delivery_attempts: nil, retry_policy: nil
312
367
  ensure_service!
313
368
  options = { deadline: deadline, retain_acked: retain_acked, retention: retention, endpoint: endpoint,
314
- labels: labels, message_ordering: message_ordering }
369
+ labels: labels, message_ordering: message_ordering, filter: filter,
370
+ dead_letter_max_delivery_attempts: dead_letter_max_delivery_attempts }
371
+
372
+ options[:dead_letter_topic_name] = dead_letter_topic.name if dead_letter_topic
373
+ if options[:dead_letter_max_delivery_attempts] && !options[:dead_letter_topic_name]
374
+ # Service error message "3:Invalid resource name given (name=)." does not identify param.
375
+ raise ArgumentError, "dead_letter_topic is required with dead_letter_max_delivery_attempts"
376
+ end
377
+ options[:retry_policy] = retry_policy.to_grpc if retry_policy
315
378
  grpc = service.create_subscription name, subscription_name, options
316
379
  Subscription.from_grpc grpc, service
317
380
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "1.1.3".freeze
19
+ VERSION = "2.0.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
@@ -57,8 +57,6 @@ module Google
57
57
  #
58
58
  # * `https://www.googleapis.com/auth/pubsub`
59
59
  # @param [Integer] timeout Default timeout to use in requests. Optional.
60
- # @param [Hash] client_config A hash of values to override the default
61
- # behavior of the API client. Optional.
62
60
  # @param [String] endpoint Override of the endpoint host name. Optional.
63
61
  # If the param is nil, uses the default endpoint.
64
62
  # @param [String] emulator_host Pub/Sub emulator host. Optional.
@@ -77,12 +75,17 @@ module Google
77
75
  # topic = pubsub.topic "my-topic"
78
76
  # topic.publish "task completed"
79
77
  #
80
- def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, client_config: nil, endpoint: nil,
81
- emulator_host: nil, project: nil, keyfile: nil
78
+ def self.new project_id: nil,
79
+ credentials: nil,
80
+ scope: nil,
81
+ timeout: nil,
82
+ endpoint: nil,
83
+ emulator_host: nil,
84
+ project: nil,
85
+ keyfile: nil
82
86
  project_id ||= (project || default_project_id)
83
87
  scope ||= configure.scope
84
88
  timeout ||= configure.timeout
85
- client_config ||= configure.client_config
86
89
  endpoint ||= configure.endpoint
87
90
  emulator_host ||= configure.emulator_host
88
91
 
@@ -90,11 +93,8 @@ module Google
90
93
  project_id = project_id.to_s # Always cast to a string
91
94
  raise ArgumentError, "project_id is missing" if project_id.empty?
92
95
 
93
- return PubSub::Project.new(
94
- PubSub::Service.new(
95
- project_id, :this_channel_is_insecure, host: emulator_host, timeout: timeout, client_config: client_config
96
- )
97
- )
96
+ service = PubSub::Service.new project_id, :this_channel_is_insecure, host: emulator_host, timeout: timeout
97
+ return PubSub::Project.new service
98
98
  end
99
99
 
100
100
  credentials ||= (keyfile || default_credentials(scope: scope))
@@ -106,11 +106,8 @@ module Google
106
106
  project_id = project_id.to_s # Always cast to a string
107
107
  raise ArgumentError, "project_id is missing" if project_id.empty?
108
108
 
109
- PubSub::Project.new(
110
- PubSub::Service.new(
111
- project_id, credentials, timeout: timeout, host: endpoint, client_config: client_config
112
- )
113
- )
109
+ service = PubSub::Service.new project_id, credentials, host: endpoint, timeout: timeout
110
+ PubSub::Project.new service
114
111
  end
115
112
 
116
113
  # rubocop:enable Metrics/AbcSize
@@ -131,8 +128,6 @@ module Google
131
128
  # * `retries` - (Integer) Number of times to retry requests on server
132
129
  # error.
133
130
  # * `timeout` - (Integer) Default timeout to use in requests.
134
- # * `client_config` - (Hash) A hash of values to override the default
135
- # behavior of the API client.
136
131
  # * `endpoint` - (String) Override of the endpoint host name, or `nil`
137
132
  # to use the default endpoint.
138
133
  # * `emulator_host` - (String) Host name of the emulator. Defaults to
@@ -167,7 +162,9 @@ module Google
167
162
  end
168
163
  end
169
164
 
170
- ## Legacy namespace
165
+ ## Legacy veneer namespace
171
166
  Pubsub = PubSub unless const_defined? :Pubsub
172
167
  end
168
+ ## Legacy generated client namespace
169
+ Pubsub = Cloud::PubSub unless const_defined? :Pubsub
173
170
  end
@@ -42,8 +42,6 @@ module Google
42
42
  #
43
43
  # * `https://www.googleapis.com/auth/pubsub`
44
44
  # @param [Integer] timeout Default timeout to use in requests. Optional.
45
- # @param [Hash] client_config A hash of values to override the default
46
- # behavior of the API client. Optional.
47
45
  #
48
46
  # @return [Google::Cloud::PubSub::Project]
49
47
  #
@@ -62,9 +60,9 @@ module Google
62
60
  # platform_scope = "https://www.googleapis.com/auth/cloud-platform"
63
61
  # pubsub = gcloud.pubsub scope: platform_scope
64
62
  #
65
- def pubsub scope: nil, timeout: nil, client_config: nil
63
+ def pubsub scope: nil, timeout: nil
66
64
  timeout ||= @timeout
67
- Google::Cloud.pubsub @project, @keyfile, scope: scope, timeout: timeout, client_config: client_config
65
+ Google::Cloud.pubsub @project, @keyfile, scope: scope, timeout: timeout
68
66
  end
69
67
 
70
68
  ##
@@ -90,8 +88,6 @@ module Google
90
88
  #
91
89
  # * `https://www.googleapis.com/auth/pubsub`
92
90
  # @param [Integer] timeout Default timeout to use in requests. Optional.
93
- # @param [Hash] client_config A hash of values to override the default
94
- # behavior of the API client. Optional.
95
91
  #
96
92
  # @return [Google::Cloud::PubSub::Project]
97
93
  #
@@ -103,11 +99,12 @@ module Google
103
99
  # topic = pubsub.topic "my-topic"
104
100
  # topic.publish "task completed"
105
101
  #
106
- def self.pubsub project_id = nil, credentials = nil, scope: nil,
107
- timeout: nil, client_config: nil
102
+ def self.pubsub project_id = nil,
103
+ credentials = nil,
104
+ scope: nil,
105
+ timeout: nil
108
106
  require "google/cloud/pubsub"
109
- Google::Cloud::PubSub.new project_id: project_id, credentials: credentials,
110
- scope: scope, timeout: timeout, client_config: client_config
107
+ Google::Cloud::PubSub.new project_id: project_id, credentials: credentials, scope: scope, timeout: timeout
111
108
  end
112
109
  end
113
110
  end
@@ -125,15 +122,18 @@ Google::Cloud.configure.add_config! :pubsub do |config|
125
122
  default_emulator = Google::Cloud::Config.deferred do
126
123
  ENV["PUBSUB_EMULATOR_HOST"]
127
124
  end
125
+ default_scopes = [
126
+ "https://www.googleapis.com/auth/cloud-platform",
127
+ "https://www.googleapis.com/auth/pubsub"
128
+ ]
128
129
 
129
130
  config.add_field! :project_id, default_project, match: String, allow_nil: true
130
131
  config.add_alias! :project, :project_id
131
132
  config.add_field! :credentials, default_creds, match: [String, Hash, Google::Auth::Credentials], allow_nil: true
132
133
  config.add_alias! :keyfile, :credentials
133
- config.add_field! :scope, nil, match: [String, Array]
134
+ config.add_field! :scope, default_scopes, match: [String, Array]
134
135
  config.add_field! :timeout, nil, match: Integer
135
- config.add_field! :client_config, nil, match: Hash
136
136
  config.add_field! :emulator_host, default_emulator, match: String, allow_nil: true
137
137
  config.add_field! :on_error, nil, match: Proc
138
- config.add_field! :endpoint, nil, match: String
138
+ config.add_field! :endpoint, "pubsub.googleapis.com", match: String
139
139
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-20 00:00:00.000000000 Z
12
+ date: 2020-08-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -31,82 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.2'
34
+ version: '1.5'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.2'
41
+ version: '1.5'
42
42
  - !ruby/object:Gem::Dependency
43
- name: google-gax
43
+ name: google-cloud-pubsub-v1
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.8'
48
+ version: '0.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '1.8'
56
- - !ruby/object:Gem::Dependency
57
- name: googleapis-common-protos
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 1.3.9
63
- - - "<"
64
- - !ruby/object:Gem::Version
65
- version: '2.0'
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.3.9
73
- - - "<"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- - !ruby/object:Gem::Dependency
77
- name: googleapis-common-protos-types
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 1.0.4
83
- - - "<"
84
- - !ruby/object:Gem::Version
85
- version: '2.0'
86
- type: :runtime
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 1.0.4
93
- - - "<"
94
- - !ruby/object:Gem::Version
95
- version: '2.0'
96
- - !ruby/object:Gem::Dependency
97
- name: grpc-google-iam-v1
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: 0.6.9
103
- type: :runtime
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: 0.6.9
55
+ version: '0.0'
110
56
  - !ruby/object:Gem::Dependency
111
57
  name: autotest-suffix
112
58
  requirement: !ruby/object:Gem::Requirement
@@ -141,14 +87,14 @@ dependencies:
141
87
  requirements:
142
88
  - - "~>"
143
89
  - !ruby/object:Gem::Version
144
- version: '5.10'
90
+ version: '5.14'
145
91
  type: :development
146
92
  prerelease: false
147
93
  version_requirements: !ruby/object:Gem::Requirement
148
94
  requirements:
149
95
  - - "~>"
150
96
  - !ruby/object:Gem::Version
151
- version: '5.10'
97
+ version: '5.14'
152
98
  - !ruby/object:Gem::Dependency
153
99
  name: minitest-autotest
154
100
  requirement: !ruby/object:Gem::Requirement
@@ -278,6 +224,7 @@ files:
278
224
  - lib/google/cloud/pubsub/project.rb
279
225
  - lib/google/cloud/pubsub/publish_result.rb
280
226
  - lib/google/cloud/pubsub/received_message.rb
227
+ - lib/google/cloud/pubsub/retry_policy.rb
281
228
  - lib/google/cloud/pubsub/service.rb
282
229
  - lib/google/cloud/pubsub/snapshot.rb
283
230
  - lib/google/cloud/pubsub/snapshot/list.rb
@@ -292,24 +239,7 @@ files:
292
239
  - lib/google/cloud/pubsub/subscription/push_config.rb
293
240
  - lib/google/cloud/pubsub/topic.rb
294
241
  - lib/google/cloud/pubsub/topic/list.rb
295
- - lib/google/cloud/pubsub/v1.rb
296
- - lib/google/cloud/pubsub/v1/credentials.rb
297
- - lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb
298
- - lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb
299
- - lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb
300
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb
301
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb
302
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb
303
- - lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb
304
- - lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb
305
- - lib/google/cloud/pubsub/v1/doc/google/type/expr.rb
306
- - lib/google/cloud/pubsub/v1/publisher_client.rb
307
- - lib/google/cloud/pubsub/v1/publisher_client_config.json
308
- - lib/google/cloud/pubsub/v1/subscriber_client.rb
309
- - lib/google/cloud/pubsub/v1/subscriber_client_config.json
310
242
  - lib/google/cloud/pubsub/version.rb
311
- - lib/google/pubsub/v1/pubsub_pb.rb
312
- - lib/google/pubsub/v1/pubsub_services_pb.rb
313
243
  homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-pubsub
314
244
  licenses:
315
245
  - Apache-2.0
@@ -329,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
329
259
  - !ruby/object:Gem::Version
330
260
  version: '0'
331
261
  requirements: []
332
- rubygems_version: 3.0.6
262
+ rubygems_version: 3.1.3
333
263
  signing_key:
334
264
  specification_version: 4
335
265
  summary: API Client library for Google Cloud Pub/Sub
@@ -1,41 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- require "googleauth"
17
-
18
- module Google
19
- module Cloud
20
- module PubSub
21
- module V1
22
- class Credentials < Google::Auth::Credentials
23
- SCOPE = ["https://www.googleapis.com/auth/pubsub"].freeze
24
- PATH_ENV_VARS = %w(PUBSUB_CREDENTIALS
25
- PUBSUB_KEYFILE
26
- GOOGLE_CLOUD_CREDENTIALS
27
- GOOGLE_CLOUD_KEYFILE
28
- GCLOUD_KEYFILE)
29
- JSON_ENV_VARS = %w(PUBSUB_CREDENTIALS_JSON
30
- PUBSUB_KEYFILE_JSON
31
- GOOGLE_CLOUD_CREDENTIALS_JSON
32
- GOOGLE_CLOUD_KEYFILE_JSON
33
- GCLOUD_KEYFILE_JSON)
34
- DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
35
- end
36
- end
37
- end
38
-
39
- Pubsub = PubSub unless const_defined? :Pubsub
40
- end
41
- end
@@ -1,21 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Iam
18
- module V1
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Iam
18
- module V1
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Iam
18
- module V1
19
- end
20
- end
21
- end
@@ -1,91 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Duration represents a signed, fixed-length span of time represented
19
- # as a count of seconds and fractions of seconds at nanosecond
20
- # resolution. It is independent of any calendar and concepts like "day"
21
- # or "month". It is related to Timestamp in that the difference between
22
- # two Timestamp values is a Duration and it can be added or subtracted
23
- # from a Timestamp. Range is approximately +-10,000 years.
24
- #
25
- # = Examples
26
- #
27
- # Example 1: Compute Duration from two Timestamps in pseudo code.
28
- #
29
- # Timestamp start = ...;
30
- # Timestamp end = ...;
31
- # Duration duration = ...;
32
- #
33
- # duration.seconds = end.seconds - start.seconds;
34
- # duration.nanos = end.nanos - start.nanos;
35
- #
36
- # if (duration.seconds < 0 && duration.nanos > 0) {
37
- # duration.seconds += 1;
38
- # duration.nanos -= 1000000000;
39
- # } else if (durations.seconds > 0 && duration.nanos < 0) {
40
- # duration.seconds -= 1;
41
- # duration.nanos += 1000000000;
42
- # }
43
- #
44
- # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
45
- #
46
- # Timestamp start = ...;
47
- # Duration duration = ...;
48
- # Timestamp end = ...;
49
- #
50
- # end.seconds = start.seconds + duration.seconds;
51
- # end.nanos = start.nanos + duration.nanos;
52
- #
53
- # if (end.nanos < 0) {
54
- # end.seconds -= 1;
55
- # end.nanos += 1000000000;
56
- # } else if (end.nanos >= 1000000000) {
57
- # end.seconds += 1;
58
- # end.nanos -= 1000000000;
59
- # }
60
- #
61
- # Example 3: Compute Duration from datetime.timedelta in Python.
62
- #
63
- # td = datetime.timedelta(days=3, minutes=10)
64
- # duration = Duration()
65
- # duration.FromTimedelta(td)
66
- #
67
- # = JSON Mapping
68
- #
69
- # In JSON format, the Duration type is encoded as a string rather than an
70
- # object, where the string ends in the suffix "s" (indicating seconds) and
71
- # is preceded by the number of seconds, with nanoseconds expressed as
72
- # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
73
- # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
74
- # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
75
- # microsecond should be expressed in JSON format as "3.000001s".
76
- # @!attribute [rw] seconds
77
- # @return [Integer]
78
- # Signed seconds of the span of time. Must be from -315,576,000,000
79
- # to +315,576,000,000 inclusive. Note: these bounds are computed from:
80
- # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
81
- # @!attribute [rw] nanos
82
- # @return [Integer]
83
- # Signed fractions of a second at nanosecond resolution of the span
84
- # of time. Durations less than one second are represented with a 0
85
- # `seconds` field and a positive or negative `nanos` field. For durations
86
- # of one second or more, a non-zero value for the `nanos` field must be
87
- # of the same sign as the `seconds` field. Must be from -999,999,999
88
- # to +999,999,999 inclusive.
89
- class Duration; end
90
- end
91
- end
@@ -1,29 +0,0 @@
1
- # Copyright 2019 Google LLC
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
-
16
- module Google
17
- module Protobuf
18
- # A generic empty message that you can re-use to avoid defining duplicated
19
- # empty messages in your APIs. A typical example is to use it as the request
20
- # or the response type of an API method. For instance:
21
- #
22
- # service Foo {
23
- # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
- # }
25
- #
26
- # The JSON representation for `Empty` is empty JSON object `{}`.
27
- class Empty; end
28
- end
29
- end