google-cloud-apigee_connect-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +201 -0
- data/README.md +139 -0
- data/lib/google-cloud-apigee_connect-v1.rb +21 -0
- data/lib/google/cloud/apigee_connect/v1.rb +39 -0
- data/lib/google/cloud/apigee_connect/v1/connection_service.rb +49 -0
- data/lib/google/cloud/apigee_connect/v1/connection_service/client.rb +396 -0
- data/lib/google/cloud/apigee_connect/v1/connection_service/credentials.rb +51 -0
- data/lib/google/cloud/apigee_connect/v1/connection_service/paths.rb +50 -0
- data/lib/google/cloud/apigee_connect/v1/tether.rb +50 -0
- data/lib/google/cloud/apigee_connect/v1/tether/client.rb +367 -0
- data/lib/google/cloud/apigee_connect/v1/tether/credentials.rb +51 -0
- data/lib/google/cloud/apigee_connect/v1/version.rb +28 -0
- data/lib/google/cloud/apigeeconnect/v1/connection_pb.rb +44 -0
- data/lib/google/cloud/apigeeconnect/v1/connection_services_pb.rb +46 -0
- data/lib/google/cloud/apigeeconnect/v1/tether_pb.rb +97 -0
- data/lib/google/cloud/apigeeconnect/v1/tether_services_pb.rb +53 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +65 -0
- data/proto_docs/google/api/resource.rb +283 -0
- data/proto_docs/google/cloud/apigeeconnect/v1/connection.rb +88 -0
- data/proto_docs/google/cloud/apigeeconnect/v1/tether.rb +215 -0
- data/proto_docs/google/protobuf/any.rb +141 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- metadata +220 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 ApigeeConnect
|
23
|
+
module V1
|
24
|
+
# The request for [ListConnections][Management.ListConnections].
|
25
|
+
# @!attribute [rw] parent
|
26
|
+
# @return [::String]
|
27
|
+
# Required. Parent name of the form:
|
28
|
+
# `projects/{project_number or project_id}/endpoints/{endpoint}`.
|
29
|
+
# @!attribute [rw] page_size
|
30
|
+
# @return [::Integer]
|
31
|
+
# The maximum number of connections to return. The service may return fewer
|
32
|
+
# than this value. If unspecified, at most 100 connections will be returned.
|
33
|
+
# The maximum value is 1000; values above 1000 will be coerced to 1000.
|
34
|
+
# @!attribute [rw] page_token
|
35
|
+
# @return [::String]
|
36
|
+
# A page token, received from a previous `ListConnections` call.
|
37
|
+
# Provide this to retrieve the subsequent page.
|
38
|
+
#
|
39
|
+
# When paginating, all other parameters provided to `ListConnections` must
|
40
|
+
# match the call that provided the page token.
|
41
|
+
class ListConnectionsRequest
|
42
|
+
include ::Google::Protobuf::MessageExts
|
43
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
44
|
+
end
|
45
|
+
|
46
|
+
# The response for
|
47
|
+
# [ListConnections][Management.ListConnections].
|
48
|
+
# @!attribute [rw] connections
|
49
|
+
# @return [::Array<::Google::Cloud::ApigeeConnect::V1::Connection>]
|
50
|
+
# A list of clients.
|
51
|
+
# @!attribute [rw] next_page_token
|
52
|
+
# @return [::String]
|
53
|
+
# A token that can be sent as `page_token` to retrieve the next page.
|
54
|
+
# If this field is omitted, there are no subsequent pages.
|
55
|
+
class ListConnectionsResponse
|
56
|
+
include ::Google::Protobuf::MessageExts
|
57
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
58
|
+
end
|
59
|
+
|
60
|
+
# @!attribute [rw] endpoint
|
61
|
+
# @return [::String]
|
62
|
+
# The endpoint that the connection is made against.
|
63
|
+
# Format: `projects/{project_number}/endpoints/{endpoint}`
|
64
|
+
# @!attribute [rw] cluster
|
65
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::Cluster]
|
66
|
+
# Cluster information.
|
67
|
+
# @!attribute [rw] stream_count
|
68
|
+
# @return [::Integer]
|
69
|
+
# The count of streams.
|
70
|
+
class Connection
|
71
|
+
include ::Google::Protobuf::MessageExts
|
72
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
73
|
+
end
|
74
|
+
|
75
|
+
# @!attribute [rw] name
|
76
|
+
# @return [::String]
|
77
|
+
# The name of the cluster.
|
78
|
+
# @!attribute [rw] region
|
79
|
+
# @return [::String]
|
80
|
+
# The region of the cluster.
|
81
|
+
class Cluster
|
82
|
+
include ::Google::Protobuf::MessageExts
|
83
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 ApigeeConnect
|
23
|
+
module V1
|
24
|
+
# gRPC request payload for tether.
|
25
|
+
# @!attribute [rw] id
|
26
|
+
# @return [::String]
|
27
|
+
# Unique identifier for the request.
|
28
|
+
# @!attribute [rw] payload
|
29
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::Payload]
|
30
|
+
# Actual payload to send to agent.
|
31
|
+
# @!attribute [rw] endpoint
|
32
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::TetherEndpoint]
|
33
|
+
# Tether Endpoint.
|
34
|
+
# @!attribute [rw] project
|
35
|
+
# @return [::String]
|
36
|
+
# GCP Project.
|
37
|
+
# Format: `projects/{project_number}`.
|
38
|
+
# @!attribute [rw] trace_id
|
39
|
+
# @return [::String]
|
40
|
+
# Unique identifier for clients to trace their request/response.
|
41
|
+
# @!attribute [rw] timeout
|
42
|
+
# @return [::Google::Protobuf::Duration]
|
43
|
+
# Timeout for the HTTP request.
|
44
|
+
class EgressRequest
|
45
|
+
include ::Google::Protobuf::MessageExts
|
46
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
47
|
+
end
|
48
|
+
|
49
|
+
# Payload for EgressRequest.
|
50
|
+
# @!attribute [rw] http_request
|
51
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::HttpRequest]
|
52
|
+
# The HttpRequest proto.
|
53
|
+
# @!attribute [rw] stream_info
|
54
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::StreamInfo]
|
55
|
+
# The information of stream.
|
56
|
+
# @!attribute [rw] action
|
57
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::Action]
|
58
|
+
# The action taken by agent.
|
59
|
+
class Payload
|
60
|
+
include ::Google::Protobuf::MessageExts
|
61
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
62
|
+
end
|
63
|
+
|
64
|
+
# The Information of bi-directional stream.
|
65
|
+
# @!attribute [rw] id
|
66
|
+
# @return [::String]
|
67
|
+
# Unique identifier for the stream.
|
68
|
+
class StreamInfo
|
69
|
+
include ::Google::Protobuf::MessageExts
|
70
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
71
|
+
end
|
72
|
+
|
73
|
+
# gRPC response payload for tether.
|
74
|
+
# @!attribute [rw] id
|
75
|
+
# @return [::String]
|
76
|
+
# Unique identifier for the response. Matches the EgressRequest's id.
|
77
|
+
# @!attribute [rw] http_response
|
78
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::HttpResponse]
|
79
|
+
# HttpResponse.
|
80
|
+
# @!attribute [rw] status
|
81
|
+
# @return [::Google::Rpc::Status]
|
82
|
+
# Errors from application when handling the http request.
|
83
|
+
# @!attribute [rw] project
|
84
|
+
# @return [::String]
|
85
|
+
# GCP Project.
|
86
|
+
# Format: `projects/{project_number}`.
|
87
|
+
# @!attribute [rw] trace_id
|
88
|
+
# @return [::String]
|
89
|
+
# Unique identifier for clients to trace their request/response. Matches the
|
90
|
+
# EgressRequest's trace id
|
91
|
+
# @!attribute [rw] endpoint
|
92
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::TetherEndpoint]
|
93
|
+
# Tether Endpoint.
|
94
|
+
# @!attribute [rw] name
|
95
|
+
# @return [::String]
|
96
|
+
# Name is the full resource path of endpoint.
|
97
|
+
# Format: `projects/{project_number or project_id}/endpoints/{endpoint}`
|
98
|
+
class EgressResponse
|
99
|
+
include ::Google::Protobuf::MessageExts
|
100
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
101
|
+
end
|
102
|
+
|
103
|
+
# The proto definition of http request.
|
104
|
+
# @!attribute [rw] id
|
105
|
+
# @return [::String]
|
106
|
+
# A unique identifier for the request.
|
107
|
+
# @!attribute [rw] method
|
108
|
+
# @return [::String]
|
109
|
+
# The HTTP request method.
|
110
|
+
# Valid methods: "GET", "HEAD", "POST", "PUT", "PATCH","DELETE".
|
111
|
+
# @!attribute [rw] url
|
112
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::Url]
|
113
|
+
# The HTTP request URL.
|
114
|
+
# @!attribute [rw] headers
|
115
|
+
# @return [::Array<::Google::Cloud::ApigeeConnect::V1::Header>]
|
116
|
+
# The HTTP request headers.
|
117
|
+
# @!attribute [rw] body
|
118
|
+
# @return [::String]
|
119
|
+
# HTTP request body.
|
120
|
+
class HttpRequest
|
121
|
+
include ::Google::Protobuf::MessageExts
|
122
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
123
|
+
end
|
124
|
+
|
125
|
+
# The proto definition of url.
|
126
|
+
# A url represents a URL and the general form represented is:
|
127
|
+
#
|
128
|
+
# `[scheme://][google.cloud.apigeeconnect.v1.Url.host][path]`
|
129
|
+
# @!attribute [rw] scheme
|
130
|
+
# @return [::Google::Cloud::ApigeeConnect::V1::Scheme]
|
131
|
+
# Scheme.
|
132
|
+
# @!attribute [rw] host
|
133
|
+
# @return [::String]
|
134
|
+
# Host or Host:Port.
|
135
|
+
# @!attribute [rw] path
|
136
|
+
# @return [::String]
|
137
|
+
# Path starts with `/`.
|
138
|
+
class Url
|
139
|
+
include ::Google::Protobuf::MessageExts
|
140
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
141
|
+
end
|
142
|
+
|
143
|
+
# The http headers.
|
144
|
+
# @!attribute [rw] key
|
145
|
+
# @return [::String]
|
146
|
+
# @!attribute [rw] values
|
147
|
+
# @return [::Array<::String>]
|
148
|
+
class Header
|
149
|
+
include ::Google::Protobuf::MessageExts
|
150
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
151
|
+
end
|
152
|
+
|
153
|
+
# The proto definition of http response.
|
154
|
+
# @!attribute [rw] id
|
155
|
+
# @return [::String]
|
156
|
+
# A unique identifier that matches the request ID.
|
157
|
+
# @!attribute [rw] status
|
158
|
+
# @return [::String]
|
159
|
+
# Status of http response, e.g. "200 OK".
|
160
|
+
# @!attribute [rw] status_code
|
161
|
+
# @return [::Integer]
|
162
|
+
# Status code of http response, e.g. 200.
|
163
|
+
# @!attribute [rw] body
|
164
|
+
# @return [::String]
|
165
|
+
# The HTTP 1.1 response body.
|
166
|
+
# @!attribute [rw] headers
|
167
|
+
# @return [::Array<::Google::Cloud::ApigeeConnect::V1::Header>]
|
168
|
+
# The HTTP response headers.
|
169
|
+
# @!attribute [rw] content_length
|
170
|
+
# @return [::Integer]
|
171
|
+
# Content length records the length of the associated content. The
|
172
|
+
# value -1 indicates that the length is unknown. Unless http method
|
173
|
+
# is "HEAD", values >= 0 indicate that the given number of bytes may
|
174
|
+
# be read from Body.
|
175
|
+
class HttpResponse
|
176
|
+
include ::Google::Protobuf::MessageExts
|
177
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
178
|
+
end
|
179
|
+
|
180
|
+
# The action taken by agent.
|
181
|
+
module Action
|
182
|
+
# Unspecified Action.
|
183
|
+
ACTION_UNSPECIFIED = 0
|
184
|
+
|
185
|
+
# Indicates that agent should open a new stream.
|
186
|
+
OPEN_NEW_STREAM = 1
|
187
|
+
end
|
188
|
+
|
189
|
+
# Endpoint indicates where the messages will be delivered.
|
190
|
+
module TetherEndpoint
|
191
|
+
# Unspecified tether endpoint.
|
192
|
+
TETHER_ENDPOINT_UNSPECIFIED = 0
|
193
|
+
|
194
|
+
# Apigee MART endpoint.
|
195
|
+
APIGEE_MART = 1
|
196
|
+
|
197
|
+
# Apigee Runtime endpoint.
|
198
|
+
APIGEE_RUNTIME = 2
|
199
|
+
|
200
|
+
# Apigee Mint Rating endpoint.
|
201
|
+
APIGEE_MINT_RATING = 3
|
202
|
+
end
|
203
|
+
|
204
|
+
# HTTP Scheme.
|
205
|
+
module Scheme
|
206
|
+
# Unspecified scheme.
|
207
|
+
SCHEME_UNSPECIFIED = 0
|
208
|
+
|
209
|
+
# HTTPS protocol.
|
210
|
+
HTTPS = 1
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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 := anypb.New(foo)
|
61
|
+
# if err != nil {
|
62
|
+
# ...
|
63
|
+
# }
|
64
|
+
# ...
|
65
|
+
# foo := &pb.Foo{}
|
66
|
+
# if err := any.UnmarshalTo(foo); err != nil {
|
67
|
+
# ...
|
68
|
+
# }
|
69
|
+
#
|
70
|
+
# The pack methods provided by protobuf library will by default use
|
71
|
+
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
72
|
+
# methods only use the fully qualified type name after the last '/'
|
73
|
+
# in the type URL, for example "foo.bar.com/x/y.z" will yield type
|
74
|
+
# name "y.z".
|
75
|
+
#
|
76
|
+
#
|
77
|
+
# JSON
|
78
|
+
# ====
|
79
|
+
# The JSON representation of an `Any` value uses the regular
|
80
|
+
# representation of the deserialized, embedded message, with an
|
81
|
+
# additional field `@type` which contains the type URL. Example:
|
82
|
+
#
|
83
|
+
# package google.profile;
|
84
|
+
# message Person {
|
85
|
+
# string first_name = 1;
|
86
|
+
# string last_name = 2;
|
87
|
+
# }
|
88
|
+
#
|
89
|
+
# {
|
90
|
+
# "@type": "type.googleapis.com/google.profile.Person",
|
91
|
+
# "firstName": <string>,
|
92
|
+
# "lastName": <string>
|
93
|
+
# }
|
94
|
+
#
|
95
|
+
# If the embedded message type is well-known and has a custom JSON
|
96
|
+
# representation, that representation will be embedded adding a field
|
97
|
+
# `value` which holds the custom JSON in addition to the `@type`
|
98
|
+
# field. Example (for message [google.protobuf.Duration][]):
|
99
|
+
#
|
100
|
+
# {
|
101
|
+
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
102
|
+
# "value": "1.212s"
|
103
|
+
# }
|
104
|
+
# @!attribute [rw] type_url
|
105
|
+
# @return [::String]
|
106
|
+
# A URL/resource name that uniquely identifies the type of the serialized
|
107
|
+
# protocol buffer message. This string must contain at least
|
108
|
+
# one "/" character. The last segment of the URL's path must represent
|
109
|
+
# the fully qualified name of the type (as in
|
110
|
+
# `path/google.protobuf.Duration`). The name should be in a canonical form
|
111
|
+
# (e.g., leading "." is not accepted).
|
112
|
+
#
|
113
|
+
# In practice, teams usually precompile into the binary all types that they
|
114
|
+
# expect it to use in the context of Any. However, for URLs which use the
|
115
|
+
# scheme `http`, `https`, or no scheme, one can optionally set up a type
|
116
|
+
# server that maps type URLs to message definitions as follows:
|
117
|
+
#
|
118
|
+
# * If no scheme is provided, `https` is assumed.
|
119
|
+
# * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
120
|
+
# value in binary format, or produce an error.
|
121
|
+
# * Applications are allowed to cache lookup results based on the
|
122
|
+
# URL, or have them precompiled into a binary to avoid any
|
123
|
+
# lookup. Therefore, binary compatibility needs to be preserved
|
124
|
+
# on changes to types. (Use versioned type names to manage
|
125
|
+
# breaking changes.)
|
126
|
+
#
|
127
|
+
# Note: this functionality is not currently available in the official
|
128
|
+
# protobuf release, and it is not used for type URLs beginning with
|
129
|
+
# type.googleapis.com.
|
130
|
+
#
|
131
|
+
# Schemes other than `http`, `https` (or the empty scheme) might be
|
132
|
+
# used with implementation specific semantics.
|
133
|
+
# @!attribute [rw] value
|
134
|
+
# @return [::String]
|
135
|
+
# Must be a valid serialized protocol buffer of the above specified type.
|
136
|
+
class Any
|
137
|
+
include ::Google::Protobuf::MessageExts
|
138
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2021 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
|