google-cloud-pubsub 0.33.1 → 2.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +41 -40
- data/CHANGELOG.md +610 -0
- data/CONTRIBUTING.md +328 -116
- data/EMULATOR.md +2 -2
- data/LOGGING.md +95 -3
- data/OVERVIEW.md +183 -90
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google/cloud/pubsub/acknowledge_result.rb +79 -0
- data/lib/google/cloud/pubsub/async_publisher/batch.rb +306 -0
- data/lib/google/cloud/pubsub/async_publisher.rb +270 -161
- data/lib/google/cloud/pubsub/batch_publisher.rb +65 -33
- data/lib/google/cloud/pubsub/convert.rb +36 -8
- data/lib/google/cloud/pubsub/credentials.rb +7 -5
- data/lib/google/cloud/pubsub/errors.rb +93 -0
- data/lib/google/cloud/pubsub/flow_controller.rb +139 -0
- data/lib/google/cloud/pubsub/message.rb +52 -7
- data/lib/google/cloud/pubsub/policy.rb +15 -12
- data/lib/google/cloud/pubsub/project.rb +341 -75
- data/lib/google/cloud/pubsub/publish_result.rb +9 -2
- data/lib/google/cloud/pubsub/received_message.rb +182 -20
- data/lib/google/cloud/pubsub/retry_policy.rb +88 -0
- data/lib/google/cloud/pubsub/schema/list.rb +180 -0
- data/lib/google/cloud/pubsub/schema.rb +310 -0
- data/lib/google/cloud/pubsub/service.rb +285 -258
- data/lib/google/cloud/pubsub/snapshot/list.rb +14 -14
- data/lib/google/cloud/pubsub/snapshot.rb +17 -12
- data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +4 -4
- data/lib/google/cloud/pubsub/subscriber/inventory.rb +74 -33
- data/lib/google/cloud/pubsub/subscriber/sequencer.rb +115 -0
- data/lib/google/cloud/pubsub/subscriber/stream.rb +138 -91
- data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +397 -0
- data/lib/google/cloud/pubsub/subscriber.rb +213 -51
- data/lib/google/cloud/pubsub/subscription/list.rb +16 -16
- data/lib/google/cloud/pubsub/subscription/push_config.rb +268 -0
- data/lib/google/cloud/pubsub/subscription.rb +827 -137
- data/lib/google/cloud/pubsub/topic/list.rb +14 -14
- data/lib/google/cloud/pubsub/topic.rb +565 -93
- data/lib/google/cloud/pubsub/version.rb +4 -2
- data/lib/google/cloud/pubsub.rb +50 -41
- data/lib/google-cloud-pubsub.rb +26 -29
- metadata +59 -53
- data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -222
- data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -270
- data/lib/google/cloud/pubsub/v1/credentials.rb +0 -39
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +0 -63
- data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +0 -128
- 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 -230
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +0 -109
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +0 -628
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +0 -734
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -105
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +0 -1267
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -144
- data/lib/google/cloud/pubsub/v1.rb +0 -17
- data/lib/google/pubsub/v1/pubsub_pb.rb +0 -222
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +0 -192
@@ -1,128 +0,0 @@
|
|
1
|
-
# Copyright 2018 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
|
-
# Defines an Identity and Access Management (IAM) policy. It is used to
|
20
|
-
# specify access control policies for Cloud Platform resources.
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# A `Policy` consists of a list of `bindings`. A `Binding` binds a list of
|
24
|
-
# `members` to a `role`, where the members can be user accounts, Google groups,
|
25
|
-
# Google domains, and service accounts. A `role` is a named list of permissions
|
26
|
-
# defined by IAM.
|
27
|
-
#
|
28
|
-
# **Example**
|
29
|
-
#
|
30
|
-
# {
|
31
|
-
# "bindings": [
|
32
|
-
# {
|
33
|
-
# "role": "roles/owner",
|
34
|
-
# "members": [
|
35
|
-
# "user:mike@example.com",
|
36
|
-
# "group:admins@example.com",
|
37
|
-
# "domain:google.com",
|
38
|
-
# "serviceAccount:my-other-app@appspot.gserviceaccount.com",
|
39
|
-
# ]
|
40
|
-
# },
|
41
|
-
# {
|
42
|
-
# "role": "roles/viewer",
|
43
|
-
# "members": ["user:sean@example.com"]
|
44
|
-
# }
|
45
|
-
# ]
|
46
|
-
# }
|
47
|
-
#
|
48
|
-
# For a description of IAM and its features, see the
|
49
|
-
# [IAM developer's guide](https://cloud.google.com/iam).
|
50
|
-
# @!attribute [rw] version
|
51
|
-
# @return [Integer]
|
52
|
-
# Version of the `Policy`. The default version is 0.
|
53
|
-
# @!attribute [rw] bindings
|
54
|
-
# @return [Array<Google::Iam::V1::Binding>]
|
55
|
-
# Associates a list of `members` to a `role`.
|
56
|
-
# Multiple `bindings` must not be specified for the same `role`.
|
57
|
-
# `bindings` with no members will result in an error.
|
58
|
-
# @!attribute [rw] etag
|
59
|
-
# @return [String]
|
60
|
-
# `etag` is used for optimistic concurrency control as a way to help
|
61
|
-
# prevent simultaneous updates of a policy from overwriting each other.
|
62
|
-
# It is strongly suggested that systems make use of the `etag` in the
|
63
|
-
# read-modify-write cycle to perform policy updates in order to avoid race
|
64
|
-
# conditions: An `etag` is returned in the response to `getIamPolicy`, and
|
65
|
-
# systems are expected to put that etag in the request to `setIamPolicy` to
|
66
|
-
# ensure that their change will be applied to the same version of the policy.
|
67
|
-
#
|
68
|
-
# If no `etag` is provided in the call to `setIamPolicy`, then the existing
|
69
|
-
# policy is overwritten blindly.
|
70
|
-
class Policy; end
|
71
|
-
|
72
|
-
# Associates `members` with a `role`.
|
73
|
-
# @!attribute [rw] role
|
74
|
-
# @return [String]
|
75
|
-
# Role that is assigned to `members`.
|
76
|
-
# For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
|
77
|
-
# Required
|
78
|
-
# @!attribute [rw] members
|
79
|
-
# @return [Array<String>]
|
80
|
-
# Specifies the identities requesting access for a Cloud Platform resource.
|
81
|
-
# `members` can have the following values:
|
82
|
-
#
|
83
|
-
# * `allUsers`: A special identifier that represents anyone who is
|
84
|
-
# on the internet; with or without a Google account.
|
85
|
-
#
|
86
|
-
# * `allAuthenticatedUsers`: A special identifier that represents anyone
|
87
|
-
# who is authenticated with a Google account or a service account.
|
88
|
-
#
|
89
|
-
# * `user:{emailid}`: An email address that represents a specific Google
|
90
|
-
# account. For example, `alice@gmail.com` or `joe@example.com`.
|
91
|
-
#
|
92
|
-
#
|
93
|
-
# * `serviceAccount:{emailid}`: An email address that represents a service
|
94
|
-
# account. For example, `my-other-app@appspot.gserviceaccount.com`.
|
95
|
-
#
|
96
|
-
# * `group:{emailid}`: An email address that represents a Google group.
|
97
|
-
# For example, `admins@example.com`.
|
98
|
-
#
|
99
|
-
# * `domain:{domain}`: A Google Apps domain name that represents all the
|
100
|
-
# users of that domain. For example, `google.com` or `example.com`.
|
101
|
-
class Binding; end
|
102
|
-
|
103
|
-
# The difference delta between two policies.
|
104
|
-
# @!attribute [rw] binding_deltas
|
105
|
-
# @return [Array<Google::Iam::V1::BindingDelta>]
|
106
|
-
# The delta for Bindings between two policies.
|
107
|
-
class PolicyDelta; end
|
108
|
-
|
109
|
-
# One delta entry for Binding. Each individual change (only one member in each
|
110
|
-
# entry) to a binding will be a separate entry.
|
111
|
-
# @!attribute [rw] action
|
112
|
-
# @return [Google::Iam::V1::BindingDelta::Action]
|
113
|
-
# The action that was performed on a Binding.
|
114
|
-
# Required
|
115
|
-
# @!attribute [rw] role
|
116
|
-
# @return [String]
|
117
|
-
# Role that is assigned to `members`.
|
118
|
-
# For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
|
119
|
-
# Required
|
120
|
-
# @!attribute [rw] member
|
121
|
-
# @return [String]
|
122
|
-
# A single identity requesting access for a Cloud Platform resource.
|
123
|
-
# Follows the same format of Binding.members.
|
124
|
-
# Required
|
125
|
-
class BindingDelta; end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
@@ -1,91 +0,0 @@
|
|
1
|
-
# Copyright 2018 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 2018 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
|
@@ -1,230 +0,0 @@
|
|
1
|
-
# Copyright 2018 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
|
-
# `FieldMask` represents a set of symbolic field paths, for example:
|
19
|
-
#
|
20
|
-
# paths: "f.a"
|
21
|
-
# paths: "f.b.d"
|
22
|
-
#
|
23
|
-
# Here `f` represents a field in some root message, `a` and `b`
|
24
|
-
# fields in the message found in `f`, and `d` a field found in the
|
25
|
-
# message in `f.b`.
|
26
|
-
#
|
27
|
-
# Field masks are used to specify a subset of fields that should be
|
28
|
-
# returned by a get operation or modified by an update operation.
|
29
|
-
# Field masks also have a custom JSON encoding (see below).
|
30
|
-
#
|
31
|
-
# = Field Masks in Projections
|
32
|
-
#
|
33
|
-
# When used in the context of a projection, a response message or
|
34
|
-
# sub-message is filtered by the API to only contain those fields as
|
35
|
-
# specified in the mask. For example, if the mask in the previous
|
36
|
-
# example is applied to a response message as follows:
|
37
|
-
#
|
38
|
-
# f {
|
39
|
-
# a : 22
|
40
|
-
# b {
|
41
|
-
# d : 1
|
42
|
-
# x : 2
|
43
|
-
# }
|
44
|
-
# y : 13
|
45
|
-
# }
|
46
|
-
# z: 8
|
47
|
-
#
|
48
|
-
# The result will not contain specific values for fields x,y and z
|
49
|
-
# (their value will be set to the default, and omitted in proto text
|
50
|
-
# output):
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# f {
|
54
|
-
# a : 22
|
55
|
-
# b {
|
56
|
-
# d : 1
|
57
|
-
# }
|
58
|
-
# }
|
59
|
-
#
|
60
|
-
# A repeated field is not allowed except at the last position of a
|
61
|
-
# paths string.
|
62
|
-
#
|
63
|
-
# If a FieldMask object is not present in a get operation, the
|
64
|
-
# operation applies to all fields (as if a FieldMask of all fields
|
65
|
-
# had been specified).
|
66
|
-
#
|
67
|
-
# Note that a field mask does not necessarily apply to the
|
68
|
-
# top-level response message. In case of a REST get operation, the
|
69
|
-
# field mask applies directly to the response, but in case of a REST
|
70
|
-
# list operation, the mask instead applies to each individual message
|
71
|
-
# in the returned resource list. In case of a REST custom method,
|
72
|
-
# other definitions may be used. Where the mask applies will be
|
73
|
-
# clearly documented together with its declaration in the API. In
|
74
|
-
# any case, the effect on the returned resource/resources is required
|
75
|
-
# behavior for APIs.
|
76
|
-
#
|
77
|
-
# = Field Masks in Update Operations
|
78
|
-
#
|
79
|
-
# A field mask in update operations specifies which fields of the
|
80
|
-
# targeted resource are going to be updated. The API is required
|
81
|
-
# to only change the values of the fields as specified in the mask
|
82
|
-
# and leave the others untouched. If a resource is passed in to
|
83
|
-
# describe the updated values, the API ignores the values of all
|
84
|
-
# fields not covered by the mask.
|
85
|
-
#
|
86
|
-
# If a repeated field is specified for an update operation, the existing
|
87
|
-
# repeated values in the target resource will be overwritten by the new values.
|
88
|
-
# Note that a repeated field is only allowed in the last position of a `paths`
|
89
|
-
# string.
|
90
|
-
#
|
91
|
-
# If a sub-message is specified in the last position of the field mask for an
|
92
|
-
# update operation, then the existing sub-message in the target resource is
|
93
|
-
# overwritten. Given the target message:
|
94
|
-
#
|
95
|
-
# f {
|
96
|
-
# b {
|
97
|
-
# d : 1
|
98
|
-
# x : 2
|
99
|
-
# }
|
100
|
-
# c : 1
|
101
|
-
# }
|
102
|
-
#
|
103
|
-
# And an update message:
|
104
|
-
#
|
105
|
-
# f {
|
106
|
-
# b {
|
107
|
-
# d : 10
|
108
|
-
# }
|
109
|
-
# }
|
110
|
-
#
|
111
|
-
# then if the field mask is:
|
112
|
-
#
|
113
|
-
# paths: "f.b"
|
114
|
-
#
|
115
|
-
# then the result will be:
|
116
|
-
#
|
117
|
-
# f {
|
118
|
-
# b {
|
119
|
-
# d : 10
|
120
|
-
# }
|
121
|
-
# c : 1
|
122
|
-
# }
|
123
|
-
#
|
124
|
-
# However, if the update mask was:
|
125
|
-
#
|
126
|
-
# paths: "f.b.d"
|
127
|
-
#
|
128
|
-
# then the result would be:
|
129
|
-
#
|
130
|
-
# f {
|
131
|
-
# b {
|
132
|
-
# d : 10
|
133
|
-
# x : 2
|
134
|
-
# }
|
135
|
-
# c : 1
|
136
|
-
# }
|
137
|
-
#
|
138
|
-
# In order to reset a field's value to the default, the field must
|
139
|
-
# be in the mask and set to the default value in the provided resource.
|
140
|
-
# Hence, in order to reset all fields of a resource, provide a default
|
141
|
-
# instance of the resource and set all fields in the mask, or do
|
142
|
-
# not provide a mask as described below.
|
143
|
-
#
|
144
|
-
# If a field mask is not present on update, the operation applies to
|
145
|
-
# all fields (as if a field mask of all fields has been specified).
|
146
|
-
# Note that in the presence of schema evolution, this may mean that
|
147
|
-
# fields the client does not know and has therefore not filled into
|
148
|
-
# the request will be reset to their default. If this is unwanted
|
149
|
-
# behavior, a specific service may require a client to always specify
|
150
|
-
# a field mask, producing an error if not.
|
151
|
-
#
|
152
|
-
# As with get operations, the location of the resource which
|
153
|
-
# describes the updated values in the request message depends on the
|
154
|
-
# operation kind. In any case, the effect of the field mask is
|
155
|
-
# required to be honored by the API.
|
156
|
-
#
|
157
|
-
# == Considerations for HTTP REST
|
158
|
-
#
|
159
|
-
# The HTTP kind of an update operation which uses a field mask must
|
160
|
-
# be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
161
|
-
# (PUT must only be used for full updates).
|
162
|
-
#
|
163
|
-
# = JSON Encoding of Field Masks
|
164
|
-
#
|
165
|
-
# In JSON, a field mask is encoded as a single string where paths are
|
166
|
-
# separated by a comma. Fields name in each path are converted
|
167
|
-
# to/from lower-camel naming conventions.
|
168
|
-
#
|
169
|
-
# As an example, consider the following message declarations:
|
170
|
-
#
|
171
|
-
# message Profile {
|
172
|
-
# User user = 1;
|
173
|
-
# Photo photo = 2;
|
174
|
-
# }
|
175
|
-
# message User {
|
176
|
-
# string display_name = 1;
|
177
|
-
# string address = 2;
|
178
|
-
# }
|
179
|
-
#
|
180
|
-
# In proto a field mask for `Profile` may look as such:
|
181
|
-
#
|
182
|
-
# mask {
|
183
|
-
# paths: "user.display_name"
|
184
|
-
# paths: "photo"
|
185
|
-
# }
|
186
|
-
#
|
187
|
-
# In JSON, the same mask is represented as below:
|
188
|
-
#
|
189
|
-
# {
|
190
|
-
# mask: "user.displayName,photo"
|
191
|
-
# }
|
192
|
-
#
|
193
|
-
# = Field Masks and Oneof Fields
|
194
|
-
#
|
195
|
-
# Field masks treat fields in oneofs just as regular fields. Consider the
|
196
|
-
# following message:
|
197
|
-
#
|
198
|
-
# message SampleMessage {
|
199
|
-
# oneof test_oneof {
|
200
|
-
# string name = 4;
|
201
|
-
# SubMessage sub_message = 9;
|
202
|
-
# }
|
203
|
-
# }
|
204
|
-
#
|
205
|
-
# The field mask can be:
|
206
|
-
#
|
207
|
-
# mask {
|
208
|
-
# paths: "name"
|
209
|
-
# }
|
210
|
-
#
|
211
|
-
# Or:
|
212
|
-
#
|
213
|
-
# mask {
|
214
|
-
# paths: "sub_message"
|
215
|
-
# }
|
216
|
-
#
|
217
|
-
# Note that oneof type names ("test_oneof" in this case) cannot be used in
|
218
|
-
# paths.
|
219
|
-
#
|
220
|
-
# == Field Mask Verification
|
221
|
-
#
|
222
|
-
# The implementation of any API method which has a FieldMask type field in the
|
223
|
-
# request should verify the included field paths, and return an
|
224
|
-
# `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
|
225
|
-
# @!attribute [rw] paths
|
226
|
-
# @return [Array<String>]
|
227
|
-
# The set of field mask paths.
|
228
|
-
class FieldMask; end
|
229
|
-
end
|
230
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# Copyright 2018 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 Timestamp represents a point in time independent of any time zone
|
19
|
-
# or calendar, represented as seconds and fractions of seconds at
|
20
|
-
# nanosecond resolution in UTC Epoch time. It is encoded using the
|
21
|
-
# Proleptic Gregorian Calendar which extends the Gregorian calendar
|
22
|
-
# backwards to year one. It is encoded assuming all minutes are 60
|
23
|
-
# seconds long, i.e. leap seconds are "smeared" so that no leap second
|
24
|
-
# table is needed for interpretation. Range is from
|
25
|
-
# 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
26
|
-
# By restricting to that range, we ensure that we can convert to
|
27
|
-
# and from RFC 3339 date strings.
|
28
|
-
# See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
29
|
-
#
|
30
|
-
# = Examples
|
31
|
-
#
|
32
|
-
# Example 1: Compute Timestamp from POSIX `time()`.
|
33
|
-
#
|
34
|
-
# Timestamp timestamp;
|
35
|
-
# timestamp.set_seconds(time(NULL));
|
36
|
-
# timestamp.set_nanos(0);
|
37
|
-
#
|
38
|
-
# Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
39
|
-
#
|
40
|
-
# struct timeval tv;
|
41
|
-
# gettimeofday(&tv, NULL);
|
42
|
-
#
|
43
|
-
# Timestamp timestamp;
|
44
|
-
# timestamp.set_seconds(tv.tv_sec);
|
45
|
-
# timestamp.set_nanos(tv.tv_usec * 1000);
|
46
|
-
#
|
47
|
-
# Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
48
|
-
#
|
49
|
-
# FILETIME ft;
|
50
|
-
# GetSystemTimeAsFileTime(&ft);
|
51
|
-
# UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
52
|
-
#
|
53
|
-
# // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
54
|
-
# // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
55
|
-
# Timestamp timestamp;
|
56
|
-
# timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
57
|
-
# timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
58
|
-
#
|
59
|
-
# Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
60
|
-
#
|
61
|
-
# long millis = System.currentTimeMillis();
|
62
|
-
#
|
63
|
-
# Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
64
|
-
# .setNanos((int) ((millis % 1000) * 1000000)).build();
|
65
|
-
#
|
66
|
-
#
|
67
|
-
# Example 5: Compute Timestamp from current time in Python.
|
68
|
-
#
|
69
|
-
# timestamp = Timestamp()
|
70
|
-
# timestamp.GetCurrentTime()
|
71
|
-
#
|
72
|
-
# = JSON Mapping
|
73
|
-
#
|
74
|
-
# In JSON format, the Timestamp type is encoded as a string in the
|
75
|
-
# [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
76
|
-
# format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
|
77
|
-
# where \\{year} is always expressed using four digits while \\{month}, \\{day},
|
78
|
-
# \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
|
79
|
-
# seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
80
|
-
# are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
81
|
-
# is required. A proto3 JSON serializer should always use UTC (as indicated by
|
82
|
-
# "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
83
|
-
# able to accept both UTC and other timezones (as indicated by an offset).
|
84
|
-
#
|
85
|
-
# For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
86
|
-
# 01:30 UTC on January 15, 2017.
|
87
|
-
#
|
88
|
-
# In JavaScript, one can convert a Date object to this format using the
|
89
|
-
# standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString]
|
90
|
-
# method. In Python, a standard `datetime.datetime` object can be converted
|
91
|
-
# to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
|
92
|
-
# with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
|
93
|
-
# can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
94
|
-
# http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
|
95
|
-
# ) to obtain a formatter capable of generating timestamps in this format.
|
96
|
-
# @!attribute [rw] seconds
|
97
|
-
# @return [Integer]
|
98
|
-
# Represents seconds of UTC time since Unix epoch
|
99
|
-
# 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
100
|
-
# 9999-12-31T23:59:59Z inclusive.
|
101
|
-
# @!attribute [rw] nanos
|
102
|
-
# @return [Integer]
|
103
|
-
# Non-negative fractions of a second at nanosecond resolution. Negative
|
104
|
-
# second values with fractions must still have non-negative nanos values
|
105
|
-
# that count forward in time. Must be from 0 to 999,999,999
|
106
|
-
# inclusive.
|
107
|
-
class Timestamp; end
|
108
|
-
end
|
109
|
-
end
|