google-cloud-scheduler-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,385 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module Scheduler
23
+ module V1
24
+ # Http target. The job will be pushed to the job handler by means of
25
+ # an HTTP request via an {::Google::Cloud::Scheduler::V1::HttpTarget#http_method http_method} such as HTTP
26
+ # POST, HTTP GET, etc. The job is acknowledged by means of an HTTP
27
+ # response code in the range [200 - 299]. A failure to receive a response
28
+ # constitutes a failed execution. For a redirected request, the response
29
+ # returned by the redirected request is considered.
30
+ # @!attribute [rw] uri
31
+ # @return [::String]
32
+ # Required. The full URI path that the request will be sent to. This string
33
+ # must begin with either "http://" or "https://". Some examples of
34
+ # valid values for {::Google::Cloud::Scheduler::V1::HttpTarget#uri uri} are:
35
+ # `http://acme.com` and `https://acme.com/sales:8080`. Cloud Scheduler will
36
+ # encode some characters for safety and compatibility. The maximum allowed
37
+ # URL length is 2083 characters after encoding.
38
+ # @!attribute [rw] http_method
39
+ # @return [::Google::Cloud::Scheduler::V1::HttpMethod]
40
+ # Which HTTP method to use for the request.
41
+ # @!attribute [rw] headers
42
+ # @return [::Google::Protobuf::Map{::String => ::String}]
43
+ # The user can specify HTTP request headers to send with the job's
44
+ # HTTP request. This map contains the header field names and
45
+ # values. Repeated headers are not supported, but a header value can
46
+ # contain commas. These headers represent a subset of the headers
47
+ # that will accompany the job's HTTP request. Some HTTP request
48
+ # headers will be ignored or replaced. A partial list of headers that
49
+ # will be ignored or replaced is below:
50
+ # - Host: This will be computed by Cloud Scheduler and derived from
51
+ # {::Google::Cloud::Scheduler::V1::HttpTarget#uri uri}.
52
+ # * `Content-Length`: This will be computed by Cloud Scheduler.
53
+ # * `User-Agent`: This will be set to `"Google-Cloud-Scheduler"`.
54
+ # * `X-Google-*`: Google internal use only.
55
+ # * `X-AppEngine-*`: Google internal use only.
56
+ #
57
+ # The total size of headers must be less than 80KB.
58
+ # @!attribute [rw] body
59
+ # @return [::String]
60
+ # HTTP request body. A request body is allowed only if the HTTP
61
+ # method is POST, PUT, or PATCH. It is an error to set body on a job with an
62
+ # incompatible {::Google::Cloud::Scheduler::V1::HttpMethod HttpMethod}.
63
+ # @!attribute [rw] oauth_token
64
+ # @return [::Google::Cloud::Scheduler::V1::OAuthToken]
65
+ # If specified, an
66
+ # [OAuth token](https://developers.google.com/identity/protocols/OAuth2)
67
+ # will be generated and attached as an `Authorization` header in the HTTP
68
+ # request.
69
+ #
70
+ # This type of authorization should generally only be used when calling
71
+ # Google APIs hosted on *.googleapis.com.
72
+ # @!attribute [rw] oidc_token
73
+ # @return [::Google::Cloud::Scheduler::V1::OidcToken]
74
+ # If specified, an
75
+ # [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect)
76
+ # token will be generated and attached as an `Authorization` header in the
77
+ # HTTP request.
78
+ #
79
+ # This type of authorization can be used for many scenarios, including
80
+ # calling Cloud Run, or endpoints where you intend to validate the token
81
+ # yourself.
82
+ class HttpTarget
83
+ include ::Google::Protobuf::MessageExts
84
+ extend ::Google::Protobuf::MessageExts::ClassMethods
85
+
86
+ # @!attribute [rw] key
87
+ # @return [::String]
88
+ # @!attribute [rw] value
89
+ # @return [::String]
90
+ class HeadersEntry
91
+ include ::Google::Protobuf::MessageExts
92
+ extend ::Google::Protobuf::MessageExts::ClassMethods
93
+ end
94
+ end
95
+
96
+ # App Engine target. The job will be pushed to a job handler by means
97
+ # of an HTTP request via an {::Google::Cloud::Scheduler::V1::AppEngineHttpTarget#http_method http_method} such
98
+ # as HTTP POST, HTTP GET, etc. The job is acknowledged by means of an
99
+ # HTTP response code in the range [200 - 299]. Error 503 is
100
+ # considered an App Engine system error instead of an application
101
+ # error. Requests returning error 503 will be retried regardless of
102
+ # retry configuration and not counted against retry counts. Any other
103
+ # response code, or a failure to receive a response before the
104
+ # deadline, constitutes a failed attempt.
105
+ # @!attribute [rw] http_method
106
+ # @return [::Google::Cloud::Scheduler::V1::HttpMethod]
107
+ # The HTTP method to use for the request. PATCH and OPTIONS are not
108
+ # permitted.
109
+ # @!attribute [rw] app_engine_routing
110
+ # @return [::Google::Cloud::Scheduler::V1::AppEngineRouting]
111
+ # App Engine Routing setting for the job.
112
+ # @!attribute [rw] relative_uri
113
+ # @return [::String]
114
+ # The relative URI.
115
+ #
116
+ # The relative URL must begin with "/" and must be a valid HTTP relative URL.
117
+ # It can contain a path, query string arguments, and `#` fragments.
118
+ # If the relative URL is empty, then the root path "/" will be used.
119
+ # No spaces are allowed, and the maximum length allowed is 2083 characters.
120
+ # @!attribute [rw] headers
121
+ # @return [::Google::Protobuf::Map{::String => ::String}]
122
+ # HTTP request headers.
123
+ #
124
+ # This map contains the header field names and values. Headers can be set
125
+ # when the job is created.
126
+ #
127
+ # Cloud Scheduler sets some headers to default values:
128
+ #
129
+ # * `User-Agent`: By default, this header is
130
+ # `"AppEngine-Google; (+http://code.google.com/appengine)"`.
131
+ # This header can be modified, but Cloud Scheduler will append
132
+ # `"AppEngine-Google; (+http://code.google.com/appengine)"` to the
133
+ # modified `User-Agent`.
134
+ # * `X-CloudScheduler`: This header will be set to true.
135
+ #
136
+ # If the job has an {::Google::Cloud::Scheduler::V1::AppEngineHttpTarget#body body}, Cloud Scheduler sets
137
+ # the following headers:
138
+ #
139
+ # * `Content-Type`: By default, the `Content-Type` header is set to
140
+ # `"application/octet-stream"`. The default can be overridden by explictly
141
+ # setting `Content-Type` to a particular media type when the job is
142
+ # created.
143
+ # For example, `Content-Type` can be set to `"application/json"`.
144
+ # * `Content-Length`: This is computed by Cloud Scheduler. This value is
145
+ # output only. It cannot be changed.
146
+ #
147
+ # The headers below are output only. They cannot be set or overridden:
148
+ #
149
+ # * `X-Google-*`: For Google internal use only.
150
+ # * `X-AppEngine-*`: For Google internal use only.
151
+ #
152
+ # In addition, some App Engine headers, which contain
153
+ # job-specific information, are also be sent to the job handler.
154
+ # @!attribute [rw] body
155
+ # @return [::String]
156
+ # Body.
157
+ #
158
+ # HTTP request body. A request body is allowed only if the HTTP method is
159
+ # POST or PUT. It will result in invalid argument error to set a body on a
160
+ # job with an incompatible {::Google::Cloud::Scheduler::V1::HttpMethod HttpMethod}.
161
+ class AppEngineHttpTarget
162
+ include ::Google::Protobuf::MessageExts
163
+ extend ::Google::Protobuf::MessageExts::ClassMethods
164
+
165
+ # @!attribute [rw] key
166
+ # @return [::String]
167
+ # @!attribute [rw] value
168
+ # @return [::String]
169
+ class HeadersEntry
170
+ include ::Google::Protobuf::MessageExts
171
+ extend ::Google::Protobuf::MessageExts::ClassMethods
172
+ end
173
+ end
174
+
175
+ # Pub/Sub target. The job will be delivered by publishing a message to
176
+ # the given Pub/Sub topic.
177
+ # @!attribute [rw] topic_name
178
+ # @return [::String]
179
+ # Required. The name of the Cloud Pub/Sub topic to which messages will
180
+ # be published when a job is delivered. The topic name must be in the
181
+ # same format as required by PubSub's
182
+ # [PublishRequest.name](https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#publishrequest),
183
+ # for example `projects/PROJECT_ID/topics/TOPIC_ID`.
184
+ #
185
+ # The topic must be in the same project as the Cloud Scheduler job.
186
+ # @!attribute [rw] data
187
+ # @return [::String]
188
+ # The message payload for PubsubMessage.
189
+ #
190
+ # Pubsub message must contain either non-empty data, or at least one
191
+ # attribute.
192
+ # @!attribute [rw] attributes
193
+ # @return [::Google::Protobuf::Map{::String => ::String}]
194
+ # Attributes for PubsubMessage.
195
+ #
196
+ # Pubsub message must contain either non-empty data, or at least one
197
+ # attribute.
198
+ class PubsubTarget
199
+ include ::Google::Protobuf::MessageExts
200
+ extend ::Google::Protobuf::MessageExts::ClassMethods
201
+
202
+ # @!attribute [rw] key
203
+ # @return [::String]
204
+ # @!attribute [rw] value
205
+ # @return [::String]
206
+ class AttributesEntry
207
+ include ::Google::Protobuf::MessageExts
208
+ extend ::Google::Protobuf::MessageExts::ClassMethods
209
+ end
210
+ end
211
+
212
+ # App Engine Routing.
213
+ #
214
+ # For more information about services, versions, and instances see
215
+ # [An Overview of App
216
+ # Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine),
217
+ # [Microservices Architecture on Google App
218
+ # Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine),
219
+ # [App Engine Standard request
220
+ # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed),
221
+ # and [App Engine Flex request
222
+ # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
223
+ # @!attribute [rw] service
224
+ # @return [::String]
225
+ # App service.
226
+ #
227
+ # By default, the job is sent to the service which is the default
228
+ # service when the job is attempted.
229
+ # @!attribute [rw] version
230
+ # @return [::String]
231
+ # App version.
232
+ #
233
+ # By default, the job is sent to the version which is the default
234
+ # version when the job is attempted.
235
+ # @!attribute [rw] instance
236
+ # @return [::String]
237
+ # App instance.
238
+ #
239
+ # By default, the job is sent to an instance which is available when
240
+ # the job is attempted.
241
+ #
242
+ # Requests can only be sent to a specific instance if
243
+ # [manual scaling is used in App Engine
244
+ # Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes).
245
+ # App Engine Flex does not support instances. For more information, see
246
+ # [App Engine Standard request
247
+ # routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed)
248
+ # and [App Engine Flex request
249
+ # routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed).
250
+ # @!attribute [rw] host
251
+ # @return [::String]
252
+ # Output only. The host that the job is sent to.
253
+ #
254
+ # For more information about how App Engine requests are routed, see
255
+ # [here](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed).
256
+ #
257
+ # The host is constructed as:
258
+ #
259
+ #
260
+ # * `host = [application_domain_name]`</br>
261
+ # `| [service] + '.' + [application_domain_name]`</br>
262
+ # `| [version] + '.' + [application_domain_name]`</br>
263
+ # `| [version_dot_service]+ '.' + [application_domain_name]`</br>
264
+ # `| [instance] + '.' + [application_domain_name]`</br>
265
+ # `| [instance_dot_service] + '.' + [application_domain_name]`</br>
266
+ # `| [instance_dot_version] + '.' + [application_domain_name]`</br>
267
+ # `| [instance_dot_version_dot_service] + '.' + [application_domain_name]`
268
+ #
269
+ # * `application_domain_name` = The domain name of the app, for
270
+ # example <app-id>.appspot.com, which is associated with the
271
+ # job's project ID.
272
+ #
273
+ # * `service =` {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service}
274
+ #
275
+ # * `version =` {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version}
276
+ #
277
+ # * `version_dot_service =`
278
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version} `+ '.' +`
279
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service}
280
+ #
281
+ # * `instance =` {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance}
282
+ #
283
+ # * `instance_dot_service =`
284
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance} `+ '.' +`
285
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service}
286
+ #
287
+ # * `instance_dot_version =`
288
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance} `+ '.' +`
289
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version}
290
+ #
291
+ # * `instance_dot_version_dot_service =`
292
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance} `+ '.' +`
293
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version} `+ '.' +`
294
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service}
295
+ #
296
+ #
297
+ # If {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service} is empty, then the job will be sent
298
+ # to the service which is the default service when the job is attempted.
299
+ #
300
+ # If {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version} is empty, then the job will be sent
301
+ # to the version which is the default version when the job is attempted.
302
+ #
303
+ # If {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance} is empty, then the job will be
304
+ # sent to an instance which is available when the job is attempted.
305
+ #
306
+ # If {::Google::Cloud::Scheduler::V1::AppEngineRouting#service service},
307
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#version version}, or
308
+ # {::Google::Cloud::Scheduler::V1::AppEngineRouting#instance instance} is invalid, then the job will be sent
309
+ # to the default version of the default service when the job is attempted.
310
+ class AppEngineRouting
311
+ include ::Google::Protobuf::MessageExts
312
+ extend ::Google::Protobuf::MessageExts::ClassMethods
313
+ end
314
+
315
+ # Contains information needed for generating an
316
+ # [OAuth token](https://developers.google.com/identity/protocols/OAuth2).
317
+ # This type of authorization should generally only be used when calling Google
318
+ # APIs hosted on *.googleapis.com.
319
+ # @!attribute [rw] service_account_email
320
+ # @return [::String]
321
+ # [Service account email](https://cloud.google.com/iam/docs/service-accounts)
322
+ # to be used for generating OAuth token.
323
+ # The service account must be within the same project as the job. The caller
324
+ # must have iam.serviceAccounts.actAs permission for the service account.
325
+ # @!attribute [rw] scope
326
+ # @return [::String]
327
+ # OAuth scope to be used for generating OAuth access token.
328
+ # If not specified, "https://www.googleapis.com/auth/cloud-platform"
329
+ # will be used.
330
+ class OAuthToken
331
+ include ::Google::Protobuf::MessageExts
332
+ extend ::Google::Protobuf::MessageExts::ClassMethods
333
+ end
334
+
335
+ # Contains information needed for generating an
336
+ # [OpenID Connect
337
+ # token](https://developers.google.com/identity/protocols/OpenIDConnect).
338
+ # This type of authorization can be used for many scenarios, including
339
+ # calling Cloud Run, or endpoints where you intend to validate the token
340
+ # yourself.
341
+ # @!attribute [rw] service_account_email
342
+ # @return [::String]
343
+ # [Service account email](https://cloud.google.com/iam/docs/service-accounts)
344
+ # to be used for generating OIDC token.
345
+ # The service account must be within the same project as the job. The caller
346
+ # must have iam.serviceAccounts.actAs permission for the service account.
347
+ # @!attribute [rw] audience
348
+ # @return [::String]
349
+ # Audience to be used when generating OIDC token. If not specified, the URI
350
+ # specified in target will be used.
351
+ class OidcToken
352
+ include ::Google::Protobuf::MessageExts
353
+ extend ::Google::Protobuf::MessageExts::ClassMethods
354
+ end
355
+
356
+ # The HTTP method used to execute the job.
357
+ module HttpMethod
358
+ # HTTP method unspecified. Defaults to POST.
359
+ HTTP_METHOD_UNSPECIFIED = 0
360
+
361
+ # HTTP POST
362
+ POST = 1
363
+
364
+ # HTTP GET
365
+ GET = 2
366
+
367
+ # HTTP HEAD
368
+ HEAD = 3
369
+
370
+ # HTTP PUT
371
+ PUT = 4
372
+
373
+ # HTTP DELETE
374
+ DELETE = 5
375
+
376
+ # HTTP PATCH
377
+ PATCH = 6
378
+
379
+ # HTTP OPTIONS
380
+ OPTIONS = 7
381
+ end
382
+ end
383
+ end
384
+ end
385
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Protobuf
22
+ # `Any` contains an arbitrary serialized protocol buffer message along with a
23
+ # URL that describes the type of the serialized message.
24
+ #
25
+ # Protobuf library provides support to pack/unpack Any values in the form
26
+ # of utility functions or additional generated methods of the Any type.
27
+ #
28
+ # Example 1: Pack and unpack a message in C++.
29
+ #
30
+ # Foo foo = ...;
31
+ # Any any;
32
+ # any.PackFrom(foo);
33
+ # ...
34
+ # if (any.UnpackTo(&foo)) {
35
+ # ...
36
+ # }
37
+ #
38
+ # Example 2: Pack and unpack a message in Java.
39
+ #
40
+ # Foo foo = ...;
41
+ # Any any = Any.pack(foo);
42
+ # ...
43
+ # if (any.is(Foo.class)) {
44
+ # foo = any.unpack(Foo.class);
45
+ # }
46
+ #
47
+ # Example 3: Pack and unpack a message in Python.
48
+ #
49
+ # foo = Foo(...)
50
+ # any = Any()
51
+ # any.Pack(foo)
52
+ # ...
53
+ # if any.Is(Foo.DESCRIPTOR):
54
+ # any.Unpack(foo)
55
+ # ...
56
+ #
57
+ # Example 4: Pack and unpack a message in Go
58
+ #
59
+ # foo := &pb.Foo{...}
60
+ # any, err := ptypes.MarshalAny(foo)
61
+ # ...
62
+ # foo := &pb.Foo{}
63
+ # if err := ptypes.UnmarshalAny(any, foo); err != nil {
64
+ # ...
65
+ # }
66
+ #
67
+ # The pack methods provided by protobuf library will by default use
68
+ # 'type.googleapis.com/full.type.name' as the type URL and the unpack
69
+ # methods only use the fully qualified type name after the last '/'
70
+ # in the type URL, for example "foo.bar.com/x/y.z" will yield type
71
+ # name "y.z".
72
+ #
73
+ #
74
+ # JSON
75
+ # ====
76
+ # The JSON representation of an `Any` value uses the regular
77
+ # representation of the deserialized, embedded message, with an
78
+ # additional field `@type` which contains the type URL. Example:
79
+ #
80
+ # package google.profile;
81
+ # message Person {
82
+ # string first_name = 1;
83
+ # string last_name = 2;
84
+ # }
85
+ #
86
+ # {
87
+ # "@type": "type.googleapis.com/google.profile.Person",
88
+ # "firstName": <string>,
89
+ # "lastName": <string>
90
+ # }
91
+ #
92
+ # If the embedded message type is well-known and has a custom JSON
93
+ # representation, that representation will be embedded adding a field
94
+ # `value` which holds the custom JSON in addition to the `@type`
95
+ # field. Example (for message [google.protobuf.Duration][]):
96
+ #
97
+ # {
98
+ # "@type": "type.googleapis.com/google.protobuf.Duration",
99
+ # "value": "1.212s"
100
+ # }
101
+ # @!attribute [rw] type_url
102
+ # @return [::String]
103
+ # A URL/resource name that uniquely identifies the type of the serialized
104
+ # protocol buffer message. This string must contain at least
105
+ # one "/" character. The last segment of the URL's path must represent
106
+ # the fully qualified name of the type (as in
107
+ # `path/google.protobuf.Duration`). The name should be in a canonical form
108
+ # (e.g., leading "." is not accepted).
109
+ #
110
+ # In practice, teams usually precompile into the binary all types that they
111
+ # expect it to use in the context of Any. However, for URLs which use the
112
+ # scheme `http`, `https`, or no scheme, one can optionally set up a type
113
+ # server that maps type URLs to message definitions as follows:
114
+ #
115
+ # * If no scheme is provided, `https` is assumed.
116
+ # * An HTTP GET on the URL must yield a [google.protobuf.Type][]
117
+ # value in binary format, or produce an error.
118
+ # * Applications are allowed to cache lookup results based on the
119
+ # URL, or have them precompiled into a binary to avoid any
120
+ # lookup. Therefore, binary compatibility needs to be preserved
121
+ # on changes to types. (Use versioned type names to manage
122
+ # breaking changes.)
123
+ #
124
+ # Note: this functionality is not currently available in the official
125
+ # protobuf release, and it is not used for type URLs beginning with
126
+ # type.googleapis.com.
127
+ #
128
+ # Schemes other than `http`, `https` (or the empty scheme) might be
129
+ # used with implementation specific semantics.
130
+ # @!attribute [rw] value
131
+ # @return [::String]
132
+ # Must be a valid serialized protocol buffer of the above specified type.
133
+ class Any
134
+ include ::Google::Protobuf::MessageExts
135
+ extend ::Google::Protobuf::MessageExts::ClassMethods
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Protobuf
22
+ # A Duration represents a signed, fixed-length span of time represented
23
+ # as a count of seconds and fractions of seconds at nanosecond
24
+ # resolution. It is independent of any calendar and concepts like "day"
25
+ # or "month". It is related to Timestamp in that the difference between
26
+ # two Timestamp values is a Duration and it can be added or subtracted
27
+ # from a Timestamp. Range is approximately +-10,000 years.
28
+ #
29
+ # # Examples
30
+ #
31
+ # Example 1: Compute Duration from two Timestamps in pseudo code.
32
+ #
33
+ # Timestamp start = ...;
34
+ # Timestamp end = ...;
35
+ # Duration duration = ...;
36
+ #
37
+ # duration.seconds = end.seconds - start.seconds;
38
+ # duration.nanos = end.nanos - start.nanos;
39
+ #
40
+ # if (duration.seconds < 0 && duration.nanos > 0) {
41
+ # duration.seconds += 1;
42
+ # duration.nanos -= 1000000000;
43
+ # } else if (duration.seconds > 0 && duration.nanos < 0) {
44
+ # duration.seconds -= 1;
45
+ # duration.nanos += 1000000000;
46
+ # }
47
+ #
48
+ # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
49
+ #
50
+ # Timestamp start = ...;
51
+ # Duration duration = ...;
52
+ # Timestamp end = ...;
53
+ #
54
+ # end.seconds = start.seconds + duration.seconds;
55
+ # end.nanos = start.nanos + duration.nanos;
56
+ #
57
+ # if (end.nanos < 0) {
58
+ # end.seconds -= 1;
59
+ # end.nanos += 1000000000;
60
+ # } else if (end.nanos >= 1000000000) {
61
+ # end.seconds += 1;
62
+ # end.nanos -= 1000000000;
63
+ # }
64
+ #
65
+ # Example 3: Compute Duration from datetime.timedelta in Python.
66
+ #
67
+ # td = datetime.timedelta(days=3, minutes=10)
68
+ # duration = Duration()
69
+ # duration.FromTimedelta(td)
70
+ #
71
+ # # JSON Mapping
72
+ #
73
+ # In JSON format, the Duration type is encoded as a string rather than an
74
+ # object, where the string ends in the suffix "s" (indicating seconds) and
75
+ # is preceded by the number of seconds, with nanoseconds expressed as
76
+ # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
77
+ # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
78
+ # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
79
+ # microsecond should be expressed in JSON format as "3.000001s".
80
+ # @!attribute [rw] seconds
81
+ # @return [::Integer]
82
+ # Signed seconds of the span of time. Must be from -315,576,000,000
83
+ # to +315,576,000,000 inclusive. Note: these bounds are computed from:
84
+ # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
85
+ # @!attribute [rw] nanos
86
+ # @return [::Integer]
87
+ # Signed fractions of a second at nanosecond resolution of the span
88
+ # of time. Durations less than one second are represented with a 0
89
+ # `seconds` field and a positive or negative `nanos` field. For durations
90
+ # of one second or more, a non-zero value for the `nanos` field must be
91
+ # of the same sign as the `seconds` field. Must be from -999,999,999
92
+ # to +999,999,999 inclusive.
93
+ class Duration
94
+ include ::Google::Protobuf::MessageExts
95
+ extend ::Google::Protobuf::MessageExts::ClassMethods
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Protobuf
22
+ # A generic empty message that you can re-use to avoid defining duplicated
23
+ # empty messages in your APIs. A typical example is to use it as the request
24
+ # or the response type of an API method. For instance:
25
+ #
26
+ # service Foo {
27
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
28
+ # }
29
+ #
30
+ # The JSON representation for `Empty` is empty JSON object `{}`.
31
+ class Empty
32
+ include ::Google::Protobuf::MessageExts
33
+ extend ::Google::Protobuf::MessageExts::ClassMethods
34
+ end
35
+ end
36
+ end