google-cloud-logging 1.10.5 → 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-logging.rb +14 -15
- data/lib/google/cloud/logging.rb +12 -13
- data/lib/google/cloud/logging/credentials.rb +2 -2
- data/lib/google/cloud/logging/entry.rb +5 -5
- data/lib/google/cloud/logging/entry/http_request.rb +3 -3
- data/lib/google/cloud/logging/entry/list.rb +1 -1
- data/lib/google/cloud/logging/entry/operation.rb +3 -3
- data/lib/google/cloud/logging/entry/source_location.rb +3 -3
- data/lib/google/cloud/logging/log/list.rb +1 -1
- data/lib/google/cloud/logging/metric.rb +2 -2
- data/lib/google/cloud/logging/metric/list.rb +1 -1
- data/lib/google/cloud/logging/resource_descriptor/list.rb +1 -1
- data/lib/google/cloud/logging/service.rb +70 -173
- data/lib/google/cloud/logging/sink.rb +2 -2
- data/lib/google/cloud/logging/sink/list.rb +1 -1
- data/lib/google/cloud/logging/version.rb +1 -1
- metadata +11 -81
- data/lib/google/cloud/logging/v2.rb +0 -18
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +0 -1368
- data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +0 -101
- data/lib/google/cloud/logging/v2/credentials.rb +0 -39
- data/lib/google/cloud/logging/v2/doc/google/api/distribution.rb +0 -164
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +0 -42
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +0 -233
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +0 -85
- data/lib/google/cloud/logging/v2/doc/google/logging/type/http_request.rb +0 -86
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +0 -179
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +0 -238
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +0 -660
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +0 -220
- data/lib/google/cloud/logging/v2/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/logging/v2/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/logging/v2/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/logging/v2/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/logging/v2/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/logging/v2/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +0 -680
- data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +0 -56
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +0 -475
- data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +0 -51
- data/lib/google/logging/v2/log_entry_pb.rb +0 -59
- data/lib/google/logging/v2/logging_config_pb.rb +0 -173
- data/lib/google/logging/v2/logging_config_services_pb.rb +0 -112
- data/lib/google/logging/v2/logging_metrics_pb.rb +0 -72
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +0 -52
- data/lib/google/logging/v2/logging_pb.rb +0 -80
- data/lib/google/logging/v2/logging_services_pb.rb +0 -64
@@ -1,220 +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 Logging
|
18
|
-
module V2
|
19
|
-
# Describes a logs-based metric. The value of the metric is the number of log
|
20
|
-
# entries that match a logs filter in a given time interval.
|
21
|
-
#
|
22
|
-
# Logs-based metric can also be used to extract values from logs and create a
|
23
|
-
# a distribution of the values. The distribution records the statistics of the
|
24
|
-
# extracted values along with an optional histogram of the values as specified
|
25
|
-
# by the bucket options.
|
26
|
-
# @!attribute [rw] name
|
27
|
-
# @return [String]
|
28
|
-
# Required. The client-assigned metric identifier.
|
29
|
-
# Examples: `"error_count"`, `"nginx/requests"`.
|
30
|
-
#
|
31
|
-
# Metric identifiers are limited to 100 characters and can include only the
|
32
|
-
# following characters: `A-Z`, `a-z`, `0-9`, and the special characters
|
33
|
-
# `_-.,+!*',()%/`. The forward-slash character (`/`) denotes a hierarchy of
|
34
|
-
# name pieces, and it cannot be the first character of the name.
|
35
|
-
#
|
36
|
-
# The metric identifier in this field must not be
|
37
|
-
# [URL-encoded](https://en.wikipedia.org/wiki/Percent-encoding).
|
38
|
-
# However, when the metric identifier appears as the `[METRIC_ID]` part of a
|
39
|
-
# `metric_name` API parameter, then the metric identifier must be
|
40
|
-
# URL-encoded. Example: `"projects/my-project/metrics/nginx%2Frequests"`.
|
41
|
-
# @!attribute [rw] description
|
42
|
-
# @return [String]
|
43
|
-
# Optional. A description of this metric, which is used in documentation.
|
44
|
-
# The maximum length of the description is 8000 characters.
|
45
|
-
# @!attribute [rw] filter
|
46
|
-
# @return [String]
|
47
|
-
# Required. An [advanced logs filter](https://cloud.google.com/logging/docs/view/advanced_filters) which is
|
48
|
-
# used to match log entries.
|
49
|
-
# Example:
|
50
|
-
#
|
51
|
-
# "resource.type=gae_app AND severity>=ERROR"
|
52
|
-
#
|
53
|
-
# The maximum length of the filter is 20000 characters.
|
54
|
-
# @!attribute [rw] metric_descriptor
|
55
|
-
# @return [Google::Api::MetricDescriptor]
|
56
|
-
# Optional. The metric descriptor associated with the logs-based metric.
|
57
|
-
# If unspecified, it uses a default metric descriptor with a DELTA metric
|
58
|
-
# kind, INT64 value type, with no labels and a unit of "1". Such a metric
|
59
|
-
# counts the number of log entries matching the `filter` expression.
|
60
|
-
#
|
61
|
-
# The `name`, `type`, and `description` fields in the `metric_descriptor`
|
62
|
-
# are output only, and is constructed using the `name` and `description`
|
63
|
-
# field in the LogMetric.
|
64
|
-
#
|
65
|
-
# To create a logs-based metric that records a distribution of log values, a
|
66
|
-
# DELTA metric kind with a DISTRIBUTION value type must be used along with
|
67
|
-
# a `value_extractor` expression in the LogMetric.
|
68
|
-
#
|
69
|
-
# Each label in the metric descriptor must have a matching label
|
70
|
-
# name as the key and an extractor expression as the value in the
|
71
|
-
# `label_extractors` map.
|
72
|
-
#
|
73
|
-
# The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot
|
74
|
-
# be updated once initially configured. New labels can be added in the
|
75
|
-
# `metric_descriptor`, but existing labels cannot be modified except for
|
76
|
-
# their description.
|
77
|
-
# @!attribute [rw] value_extractor
|
78
|
-
# @return [String]
|
79
|
-
# Optional. A `value_extractor` is required when using a distribution
|
80
|
-
# logs-based metric to extract the values to record from a log entry.
|
81
|
-
# Two functions are supported for value extraction: `EXTRACT(field)` or
|
82
|
-
# `REGEXP_EXTRACT(field, regex)`. The argument are:
|
83
|
-
# 1. field: The name of the log entry field from which the value is to be
|
84
|
-
# extracted.
|
85
|
-
# 2. regex: A regular expression using the Google RE2 syntax
|
86
|
-
# (https://github.com/google/re2/wiki/Syntax) with a single capture
|
87
|
-
# group to extract data from the specified log entry field. The value
|
88
|
-
# of the field is converted to a string before applying the regex.
|
89
|
-
# It is an error to specify a regex that does not include exactly one
|
90
|
-
# capture group.
|
91
|
-
#
|
92
|
-
# The result of the extraction must be convertible to a double type, as the
|
93
|
-
# distribution always records double values. If either the extraction or
|
94
|
-
# the conversion to double fails, then those values are not recorded in the
|
95
|
-
# distribution.
|
96
|
-
#
|
97
|
-
# Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")`
|
98
|
-
# @!attribute [rw] label_extractors
|
99
|
-
# @return [Hash{String => String}]
|
100
|
-
# Optional. A map from a label key string to an extractor expression which is
|
101
|
-
# used to extract data from a log entry field and assign as the label value.
|
102
|
-
# Each label key specified in the LabelDescriptor must have an associated
|
103
|
-
# extractor expression in this map. The syntax of the extractor expression
|
104
|
-
# is the same as for the `value_extractor` field.
|
105
|
-
#
|
106
|
-
# The extracted value is converted to the type defined in the label
|
107
|
-
# descriptor. If the either the extraction or the type conversion fails,
|
108
|
-
# the label will have a default value. The default value for a string
|
109
|
-
# label is an empty string, for an integer label its 0, and for a boolean
|
110
|
-
# label its `false`.
|
111
|
-
#
|
112
|
-
# Note that there are upper bounds on the maximum number of labels and the
|
113
|
-
# number of active time series that are allowed in a project.
|
114
|
-
# @!attribute [rw] bucket_options
|
115
|
-
# @return [Google::Api::Distribution::BucketOptions]
|
116
|
-
# Optional. The `bucket_options` are required when the logs-based metric is
|
117
|
-
# using a DISTRIBUTION value type and it describes the bucket boundaries
|
118
|
-
# used to create a histogram of the extracted values.
|
119
|
-
# @!attribute [rw] create_time
|
120
|
-
# @return [Google::Protobuf::Timestamp]
|
121
|
-
# Output only. The creation timestamp of the metric.
|
122
|
-
#
|
123
|
-
# This field may not be present for older metrics.
|
124
|
-
# @!attribute [rw] update_time
|
125
|
-
# @return [Google::Protobuf::Timestamp]
|
126
|
-
# Output only. The last update timestamp of the metric.
|
127
|
-
#
|
128
|
-
# This field may not be present for older metrics.
|
129
|
-
# @!attribute [rw] version
|
130
|
-
# @return [Google::Logging::V2::LogMetric::ApiVersion]
|
131
|
-
# Deprecated. The API version that created or updated this metric.
|
132
|
-
# The v2 format is used by default and cannot be changed.
|
133
|
-
class LogMetric
|
134
|
-
# Logging API version.
|
135
|
-
module ApiVersion
|
136
|
-
# Logging API v2.
|
137
|
-
V2 = 0
|
138
|
-
|
139
|
-
# Logging API v1.
|
140
|
-
V1 = 1
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
# The parameters to ListLogMetrics.
|
145
|
-
# @!attribute [rw] parent
|
146
|
-
# @return [String]
|
147
|
-
# Required. The name of the project containing the metrics:
|
148
|
-
#
|
149
|
-
# "projects/[PROJECT_ID]"
|
150
|
-
# @!attribute [rw] page_token
|
151
|
-
# @return [String]
|
152
|
-
# Optional. If present, then retrieve the next batch of results from the
|
153
|
-
# preceding call to this method. `pageToken` must be the value of
|
154
|
-
# `nextPageToken` from the previous response. The values of other method
|
155
|
-
# parameters should be identical to those in the previous call.
|
156
|
-
# @!attribute [rw] page_size
|
157
|
-
# @return [Integer]
|
158
|
-
# Optional. The maximum number of results to return from this request.
|
159
|
-
# Non-positive values are ignored. The presence of `nextPageToken` in the
|
160
|
-
# response indicates that more results might be available.
|
161
|
-
class ListLogMetricsRequest; end
|
162
|
-
|
163
|
-
# Result returned from ListLogMetrics.
|
164
|
-
# @!attribute [rw] metrics
|
165
|
-
# @return [Array<Google::Logging::V2::LogMetric>]
|
166
|
-
# A list of logs-based metrics.
|
167
|
-
# @!attribute [rw] next_page_token
|
168
|
-
# @return [String]
|
169
|
-
# If there might be more results than appear in this response, then
|
170
|
-
# `nextPageToken` is included. To get the next set of results, call this
|
171
|
-
# method again using the value of `nextPageToken` as `pageToken`.
|
172
|
-
class ListLogMetricsResponse; end
|
173
|
-
|
174
|
-
# The parameters to GetLogMetric.
|
175
|
-
# @!attribute [rw] metric_name
|
176
|
-
# @return [String]
|
177
|
-
# Required. The resource name of the desired metric:
|
178
|
-
#
|
179
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
180
|
-
class GetLogMetricRequest; end
|
181
|
-
|
182
|
-
# The parameters to CreateLogMetric.
|
183
|
-
# @!attribute [rw] parent
|
184
|
-
# @return [String]
|
185
|
-
# Required. The resource name of the project in which to create the metric:
|
186
|
-
#
|
187
|
-
# "projects/[PROJECT_ID]"
|
188
|
-
#
|
189
|
-
# The new metric must be provided in the request.
|
190
|
-
# @!attribute [rw] metric
|
191
|
-
# @return [Google::Logging::V2::LogMetric]
|
192
|
-
# Required. The new logs-based metric, which must not have an identifier that
|
193
|
-
# already exists.
|
194
|
-
class CreateLogMetricRequest; end
|
195
|
-
|
196
|
-
# The parameters to UpdateLogMetric.
|
197
|
-
# @!attribute [rw] metric_name
|
198
|
-
# @return [String]
|
199
|
-
# Required. The resource name of the metric to update:
|
200
|
-
#
|
201
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
202
|
-
#
|
203
|
-
# The updated metric must be provided in the request and it's
|
204
|
-
# `name` field must be the same as `[METRIC_ID]` If the metric
|
205
|
-
# does not exist in `[PROJECT_ID]`, then a new metric is created.
|
206
|
-
# @!attribute [rw] metric
|
207
|
-
# @return [Google::Logging::V2::LogMetric]
|
208
|
-
# Required. The updated metric.
|
209
|
-
class UpdateLogMetricRequest; end
|
210
|
-
|
211
|
-
# The parameters to DeleteLogMetric.
|
212
|
-
# @!attribute [rw] metric_name
|
213
|
-
# @return [String]
|
214
|
-
# Required. The resource name of the metric to delete:
|
215
|
-
#
|
216
|
-
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
217
|
-
class DeleteLogMetricRequest; end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
@@ -1,131 +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
|
-
# `Any` contains an arbitrary serialized protocol buffer message along with a
|
19
|
-
# URL that describes the type of the serialized message.
|
20
|
-
#
|
21
|
-
# Protobuf library provides support to pack/unpack Any values in the form
|
22
|
-
# of utility functions or additional generated methods of the Any type.
|
23
|
-
#
|
24
|
-
# Example 1: Pack and unpack a message in C++.
|
25
|
-
#
|
26
|
-
# Foo foo = ...;
|
27
|
-
# Any any;
|
28
|
-
# any.PackFrom(foo);
|
29
|
-
# ...
|
30
|
-
# if (any.UnpackTo(&foo)) {
|
31
|
-
# ...
|
32
|
-
# }
|
33
|
-
#
|
34
|
-
# Example 2: Pack and unpack a message in Java.
|
35
|
-
#
|
36
|
-
# Foo foo = ...;
|
37
|
-
# Any any = Any.pack(foo);
|
38
|
-
# ...
|
39
|
-
# if (any.is(Foo.class)) {
|
40
|
-
# foo = any.unpack(Foo.class);
|
41
|
-
# }
|
42
|
-
#
|
43
|
-
# Example 3: Pack and unpack a message in Python.
|
44
|
-
#
|
45
|
-
# foo = Foo(...)
|
46
|
-
# any = Any()
|
47
|
-
# any.Pack(foo)
|
48
|
-
# ...
|
49
|
-
# if any.Is(Foo.DESCRIPTOR):
|
50
|
-
# any.Unpack(foo)
|
51
|
-
# ...
|
52
|
-
#
|
53
|
-
# Example 4: Pack and unpack a message in Go
|
54
|
-
#
|
55
|
-
# foo := &pb.Foo{...}
|
56
|
-
# any, err := ptypes.MarshalAny(foo)
|
57
|
-
# ...
|
58
|
-
# foo := &pb.Foo{}
|
59
|
-
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
60
|
-
# ...
|
61
|
-
# }
|
62
|
-
#
|
63
|
-
# The pack methods provided by protobuf library will by default use
|
64
|
-
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
65
|
-
# methods only use the fully qualified type name after the last '/'
|
66
|
-
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
67
|
-
# name "y.z".
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# = JSON
|
71
|
-
#
|
72
|
-
# The JSON representation of an `Any` value uses the regular
|
73
|
-
# representation of the deserialized, embedded message, with an
|
74
|
-
# additional field `@type` which contains the type URL. Example:
|
75
|
-
#
|
76
|
-
# package google.profile;
|
77
|
-
# message Person {
|
78
|
-
# string first_name = 1;
|
79
|
-
# string last_name = 2;
|
80
|
-
# }
|
81
|
-
#
|
82
|
-
# {
|
83
|
-
# "@type": "type.googleapis.com/google.profile.Person",
|
84
|
-
# "firstName": <string>,
|
85
|
-
# "lastName": <string>
|
86
|
-
# }
|
87
|
-
#
|
88
|
-
# If the embedded message type is well-known and has a custom JSON
|
89
|
-
# representation, that representation will be embedded adding a field
|
90
|
-
# `value` which holds the custom JSON in addition to the `@type`
|
91
|
-
# field. Example (for message {Google::Protobuf::Duration}):
|
92
|
-
#
|
93
|
-
# {
|
94
|
-
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
95
|
-
# "value": "1.212s"
|
96
|
-
# }
|
97
|
-
# @!attribute [rw] type_url
|
98
|
-
# @return [String]
|
99
|
-
# A URL/resource name that uniquely identifies the type of the serialized
|
100
|
-
# protocol buffer message. This string must contain at least
|
101
|
-
# one "/" character. The last segment of the URL's path must represent
|
102
|
-
# the fully qualified name of the type (as in
|
103
|
-
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
104
|
-
# (e.g., leading "." is not accepted).
|
105
|
-
#
|
106
|
-
# In practice, teams usually precompile into the binary all types that they
|
107
|
-
# expect it to use in the context of Any. However, for URLs which use the
|
108
|
-
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
109
|
-
# server that maps type URLs to message definitions as follows:
|
110
|
-
#
|
111
|
-
# * If no scheme is provided, `https` is assumed.
|
112
|
-
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
113
|
-
# value in binary format, or produce an error.
|
114
|
-
# * Applications are allowed to cache lookup results based on the
|
115
|
-
# URL, or have them precompiled into a binary to avoid any
|
116
|
-
# lookup. Therefore, binary compatibility needs to be preserved
|
117
|
-
# on changes to types. (Use versioned type names to manage
|
118
|
-
# breaking changes.)
|
119
|
-
#
|
120
|
-
# Note: this functionality is not currently available in the official
|
121
|
-
# protobuf release, and it is not used for type URLs beginning with
|
122
|
-
# type.googleapis.com.
|
123
|
-
#
|
124
|
-
# Schemes other than `http`, `https` (or the empty scheme) might be
|
125
|
-
# used with implementation specific semantics.
|
126
|
-
# @!attribute [rw] value
|
127
|
-
# @return [String]
|
128
|
-
# Must be a valid serialized protocol buffer of the above specified type.
|
129
|
-
class Any; end
|
130
|
-
end
|
131
|
-
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
|
@@ -1,29 +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 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
|