google-cloud-pubsub 1.7.0 → 2.0.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 +2 -1
- data/CHANGELOG.md +47 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google-cloud-pubsub.rb +13 -13
- data/lib/google/cloud/pubsub.rb +15 -18
- data/lib/google/cloud/pubsub/async_publisher.rb +1 -2
- data/lib/google/cloud/pubsub/credentials.rb +2 -2
- data/lib/google/cloud/pubsub/service.rb +110 -255
- data/lib/google/cloud/pubsub/subscriber/stream.rb +3 -2
- data/lib/google/cloud/pubsub/subscription.rb +70 -3
- data/lib/google/cloud/pubsub/topic.rb +7 -3
- data/lib/google/cloud/pubsub/version.rb +1 -1
- metadata +8 -79
- data/lib/google/cloud/pubsub/v1.rb +0 -17
- data/lib/google/cloud/pubsub/v1/credentials.rb +0 -41
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -21
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -796
- data/lib/google/cloud/pubsub/v1/doc/google/type/expr.rb +0 -19
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -869
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -114
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1463
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -153
- data/lib/google/pubsub/v1/pubsub_pb.rb +0 -259
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -210
@@ -271,9 +271,8 @@ module Google
|
|
271
271
|
stop
|
272
272
|
rescue GRPC::Cancelled, GRPC::DeadlineExceeded, GRPC::Internal,
|
273
273
|
GRPC::ResourceExhausted, GRPC::Unauthenticated,
|
274
|
-
GRPC::Unavailable
|
274
|
+
GRPC::Unavailable
|
275
275
|
# Restart the stream with an incremental back for a retriable error.
|
276
|
-
# Also when GRPC raises the internal CallError.
|
277
276
|
|
278
277
|
retry
|
279
278
|
rescue RestartStream
|
@@ -364,6 +363,8 @@ module Google
|
|
364
363
|
req.modify_deadline_ack_ids += @inventory.ack_ids
|
365
364
|
req.modify_deadline_seconds += @inventory.ack_ids.map { @subscriber.deadline }
|
366
365
|
req.client_id = @subscriber.service.client_id
|
366
|
+
req.max_outstanding_messages = @inventory.limit
|
367
|
+
req.max_outstanding_bytes = @inventory.bytesize
|
367
368
|
end
|
368
369
|
end
|
369
370
|
|
@@ -323,7 +323,7 @@ module Google
|
|
323
323
|
# If {#expires_in=} is not set, a *default* value of of 31 days will be
|
324
324
|
# used. The minimum allowed value is 1 day.
|
325
325
|
#
|
326
|
-
# Makes an API call to retrieve the
|
326
|
+
# Makes an API call to retrieve the value when called on a
|
327
327
|
# reference object. See {#reference?}.
|
328
328
|
#
|
329
329
|
# @return [Numeric, nil] The expiration duration, or `nil` if unset.
|
@@ -346,13 +346,25 @@ module Google
|
|
346
346
|
# to unset.
|
347
347
|
#
|
348
348
|
def expires_in= ttl
|
349
|
-
new_expiration_policy = Google::
|
349
|
+
new_expiration_policy = Google::Cloud::PubSub::V1::ExpirationPolicy.new ttl: Convert.number_to_duration(ttl)
|
350
350
|
|
351
351
|
update_grpc = Google::Cloud::PubSub::V1::Subscription.new name: name, expiration_policy: new_expiration_policy
|
352
352
|
@grpc = service.update_subscription update_grpc, :expiration_policy
|
353
353
|
@resource_name = nil
|
354
354
|
end
|
355
355
|
|
356
|
+
##
|
357
|
+
# An expression written in the Cloud Pub/Sub filter language. If non-empty, then only {Message} instances whose
|
358
|
+
# `attributes` field matches the filter are delivered on this subscription. If empty, then no messages are
|
359
|
+
# filtered out.
|
360
|
+
#
|
361
|
+
# @return [String] The frozen filter string.
|
362
|
+
#
|
363
|
+
def filter
|
364
|
+
ensure_grpc!
|
365
|
+
@grpc.filter.freeze
|
366
|
+
end
|
367
|
+
|
356
368
|
##
|
357
369
|
# Returns the {Topic} to which dead letter messages should be published if a dead letter policy is configured,
|
358
370
|
# otherwise `nil`. Dead lettering is done on a best effort basis. The same message might be dead lettered
|
@@ -554,7 +566,7 @@ module Google
|
|
554
566
|
#
|
555
567
|
# See {Topic#publish_async}, {#listen}, and {Message#ordering_key}.
|
556
568
|
#
|
557
|
-
# Makes an API call to retrieve the
|
569
|
+
# Makes an API call to retrieve the enable_message_ordering value when called on a
|
558
570
|
# reference object. See {#reference?}.
|
559
571
|
#
|
560
572
|
# @return [Boolean]
|
@@ -564,6 +576,35 @@ module Google
|
|
564
576
|
@grpc.enable_message_ordering
|
565
577
|
end
|
566
578
|
|
579
|
+
##
|
580
|
+
# Whether the subscription is detached from its topic. Detached subscriptions don't receive messages from their
|
581
|
+
# topic and don't retain any backlog. {#pull} and {#listen} (pull and streaming pull) operations will raise
|
582
|
+
# `FAILED_PRECONDITION`. If the subscription is a push subscription (see {#push_config}), pushes to the endpoint
|
583
|
+
# will not be made. The default value is `false`.
|
584
|
+
#
|
585
|
+
# See {Topic#subscribe} and {#detach}.
|
586
|
+
#
|
587
|
+
# Makes an API call to retrieve the value when called on a
|
588
|
+
# reference object. See {#reference?}.
|
589
|
+
#
|
590
|
+
# @return [Boolean]
|
591
|
+
#
|
592
|
+
# @example
|
593
|
+
# require "google/cloud/pubsub"
|
594
|
+
#
|
595
|
+
# pubsub = Google::Cloud::PubSub.new
|
596
|
+
#
|
597
|
+
# sub = pubsub.subscription "my-topic-sub"
|
598
|
+
# sub.detach
|
599
|
+
#
|
600
|
+
# # sleep 120
|
601
|
+
# sub.detached? #=> true
|
602
|
+
#
|
603
|
+
def detached?
|
604
|
+
ensure_grpc!
|
605
|
+
@grpc.detached
|
606
|
+
end
|
607
|
+
|
567
608
|
##
|
568
609
|
# Determines whether the subscription exists in the Pub/Sub service.
|
569
610
|
#
|
@@ -611,6 +652,32 @@ module Google
|
|
611
652
|
true
|
612
653
|
end
|
613
654
|
|
655
|
+
##
|
656
|
+
# Detaches a subscription from its topic. All messages retained in the subscription are dropped. Detached
|
657
|
+
# subscriptions don't receive messages from their topic and don't retain any backlog. Subsequent {#pull} and
|
658
|
+
# {#listen} (pull and streaming pull) operations will raise `FAILED_PRECONDITION`. If the subscription is a push
|
659
|
+
# subscription (see {#push_config}), pushes to the endpoint will stop. It may take a few minutes for the
|
660
|
+
# subscription's detached state to be reflected in subsequent calls to {#detached?}.
|
661
|
+
#
|
662
|
+
# @return [Boolean] Returns `true` if the detach operation was successful.
|
663
|
+
#
|
664
|
+
# @example
|
665
|
+
# require "google/cloud/pubsub"
|
666
|
+
#
|
667
|
+
# pubsub = Google::Cloud::PubSub.new
|
668
|
+
#
|
669
|
+
# sub = pubsub.subscription "my-topic-sub"
|
670
|
+
# sub.detach
|
671
|
+
#
|
672
|
+
# # sleep 120
|
673
|
+
# sub.detached? #=> true
|
674
|
+
#
|
675
|
+
def detach
|
676
|
+
ensure_service!
|
677
|
+
service.detach_subscription name
|
678
|
+
true
|
679
|
+
end
|
680
|
+
|
614
681
|
##
|
615
682
|
# Pulls messages from the server. Returns an empty list if there are no
|
616
683
|
# messages available in the backlog. Raises an ApiError with status
|
@@ -286,6 +286,9 @@ module Google
|
|
286
286
|
# Managing Labels](https://cloud.google.com/pubsub/docs/labels).
|
287
287
|
# @param [Boolean] message_ordering Whether to enable message ordering
|
288
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.
|
289
292
|
# @param [Topic] dead_letter_topic The {Topic} to which dead letter messages for the subscription should be
|
290
293
|
# published. Dead lettering is done on a best effort basis. The same message might be dead lettered multiple
|
291
294
|
# times. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e.,
|
@@ -359,12 +362,13 @@ module Google
|
|
359
362
|
# sub = topic.subscribe "my-topic-sub", retry_policy: retry_policy
|
360
363
|
#
|
361
364
|
def subscribe subscription_name, deadline: nil, retain_acked: false, retention: nil, endpoint: nil, labels: nil,
|
362
|
-
message_ordering: nil,
|
363
|
-
retry_policy: nil
|
365
|
+
message_ordering: nil, filter: nil, dead_letter_topic: nil,
|
366
|
+
dead_letter_max_delivery_attempts: nil, retry_policy: nil
|
364
367
|
ensure_service!
|
365
368
|
options = { deadline: deadline, retain_acked: retain_acked, retention: retention, endpoint: endpoint,
|
366
|
-
labels: labels, message_ordering: message_ordering,
|
369
|
+
labels: labels, message_ordering: message_ordering, filter: filter,
|
367
370
|
dead_letter_max_delivery_attempts: dead_letter_max_delivery_attempts }
|
371
|
+
|
368
372
|
options[:dead_letter_topic_name] = dead_letter_topic.name if dead_letter_topic
|
369
373
|
if options[:dead_letter_max_delivery_attempts] && !options[:dead_letter_topic_name]
|
370
374
|
# Service error message "3:Invalid resource name given (name=)." does not identify param.
|
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:
|
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: 2020-
|
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.
|
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.
|
41
|
+
version: '1.5'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: google-
|
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: '
|
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: '
|
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
|
@@ -293,24 +239,7 @@ files:
|
|
293
239
|
- lib/google/cloud/pubsub/subscription/push_config.rb
|
294
240
|
- lib/google/cloud/pubsub/topic.rb
|
295
241
|
- lib/google/cloud/pubsub/topic/list.rb
|
296
|
-
- lib/google/cloud/pubsub/v1.rb
|
297
|
-
- lib/google/cloud/pubsub/v1/credentials.rb
|
298
|
-
- lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb
|
299
|
-
- lib/google/cloud/pubsub/v1/doc/google/iam/v1/options.rb
|
300
|
-
- lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb
|
301
|
-
- lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb
|
302
|
-
- lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb
|
303
|
-
- lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb
|
304
|
-
- lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb
|
305
|
-
- lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb
|
306
|
-
- lib/google/cloud/pubsub/v1/doc/google/type/expr.rb
|
307
|
-
- lib/google/cloud/pubsub/v1/publisher_client.rb
|
308
|
-
- lib/google/cloud/pubsub/v1/publisher_client_config.json
|
309
|
-
- lib/google/cloud/pubsub/v1/subscriber_client.rb
|
310
|
-
- lib/google/cloud/pubsub/v1/subscriber_client_config.json
|
311
242
|
- lib/google/cloud/pubsub/version.rb
|
312
|
-
- lib/google/pubsub/v1/pubsub_pb.rb
|
313
|
-
- lib/google/pubsub/v1/pubsub_services_pb.rb
|
314
243
|
homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-pubsub
|
315
244
|
licenses:
|
316
245
|
- Apache-2.0
|
@@ -330,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
259
|
- !ruby/object:Gem::Version
|
331
260
|
version: '0'
|
332
261
|
requirements: []
|
333
|
-
rubygems_version: 3.
|
262
|
+
rubygems_version: 3.1.3
|
334
263
|
signing_key:
|
335
264
|
specification_version: 4
|
336
265
|
summary: API Client library for Google Cloud Pub/Sub
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Copyright 2015 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 "google/cloud/pubsub/v1/publisher_client"
|
17
|
-
require "google/cloud/pubsub/v1/subscriber_client"
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# Copyright 2020 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 2020 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 2020 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 2020 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 2020 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
|