google-cloud-managed_kafka-v1 0.a → 0.1.1

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/managed_kafka/v1/bindings_override.rb +102 -0
  6. data/lib/google/cloud/managed_kafka/v1/managed_kafka/client.rb +1876 -0
  7. data/lib/google/cloud/managed_kafka/v1/managed_kafka/credentials.rb +47 -0
  8. data/lib/google/cloud/managed_kafka/v1/managed_kafka/operations.rb +809 -0
  9. data/lib/google/cloud/managed_kafka/v1/managed_kafka/paths.rb +132 -0
  10. data/lib/google/cloud/managed_kafka/v1/managed_kafka/rest/client.rb +1759 -0
  11. data/lib/google/cloud/managed_kafka/v1/managed_kafka/rest/operations.rb +902 -0
  12. data/lib/google/cloud/managed_kafka/v1/managed_kafka/rest/service_stub.rb +900 -0
  13. data/lib/google/cloud/managed_kafka/v1/managed_kafka/rest.rb +55 -0
  14. data/lib/google/cloud/managed_kafka/v1/managed_kafka.rb +57 -0
  15. data/lib/google/cloud/managed_kafka/v1/rest.rb +38 -0
  16. data/lib/google/cloud/managed_kafka/v1/version.rb +7 -2
  17. data/lib/google/cloud/managed_kafka/v1.rb +45 -0
  18. data/lib/google/cloud/managedkafka/v1/managed_kafka_pb.rb +70 -0
  19. data/lib/google/cloud/managedkafka/v1/managed_kafka_services_pb.rb +72 -0
  20. data/lib/google/cloud/managedkafka/v1/resources_pb.rb +59 -0
  21. data/lib/google-cloud-managed_kafka-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/client.rb +403 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/field_info.rb +88 -0
  26. data/proto_docs/google/api/launch_stage.rb +71 -0
  27. data/proto_docs/google/api/resource.rb +227 -0
  28. data/proto_docs/google/cloud/managedkafka/v1/managed_kafka.rb +341 -0
  29. data/proto_docs/google/cloud/managedkafka/v1/resources.rb +289 -0
  30. data/proto_docs/google/longrunning/operations.rb +164 -0
  31. data/proto_docs/google/protobuf/any.rb +145 -0
  32. data/proto_docs/google/protobuf/duration.rb +98 -0
  33. data/proto_docs/google/protobuf/empty.rb +34 -0
  34. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  35. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  36. data/proto_docs/google/rpc/status.rb +48 -0
  37. metadata +96 -10
@@ -0,0 +1,289 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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 ManagedKafka
23
+ module V1
24
+ # An Apache Kafka cluster deployed in a location.
25
+ # @!attribute [rw] gcp_config
26
+ # @return [::Google::Cloud::ManagedKafka::V1::GcpConfig]
27
+ # Required. Configuration properties for a Kafka cluster deployed to Google
28
+ # Cloud Platform.
29
+ # @!attribute [rw] name
30
+ # @return [::String]
31
+ # Identifier. The name of the cluster. Structured like:
32
+ # projects/\\{project_number}/locations/\\{location}/clusters/\\{cluster_id}
33
+ # @!attribute [r] create_time
34
+ # @return [::Google::Protobuf::Timestamp]
35
+ # Output only. The time when the cluster was created.
36
+ # @!attribute [r] update_time
37
+ # @return [::Google::Protobuf::Timestamp]
38
+ # Output only. The time when the cluster was last updated.
39
+ # @!attribute [rw] labels
40
+ # @return [::Google::Protobuf::Map{::String => ::String}]
41
+ # Optional. Labels as key value pairs.
42
+ # @!attribute [rw] capacity_config
43
+ # @return [::Google::Cloud::ManagedKafka::V1::CapacityConfig]
44
+ # Required. Capacity configuration for the Kafka cluster.
45
+ # @!attribute [rw] rebalance_config
46
+ # @return [::Google::Cloud::ManagedKafka::V1::RebalanceConfig]
47
+ # Optional. Rebalance configuration for the Kafka cluster.
48
+ # @!attribute [r] state
49
+ # @return [::Google::Cloud::ManagedKafka::V1::Cluster::State]
50
+ # Output only. The current state of the cluster.
51
+ class Cluster
52
+ include ::Google::Protobuf::MessageExts
53
+ extend ::Google::Protobuf::MessageExts::ClassMethods
54
+
55
+ # @!attribute [rw] key
56
+ # @return [::String]
57
+ # @!attribute [rw] value
58
+ # @return [::String]
59
+ class LabelsEntry
60
+ include ::Google::Protobuf::MessageExts
61
+ extend ::Google::Protobuf::MessageExts::ClassMethods
62
+ end
63
+
64
+ # The state of the cluster.
65
+ module State
66
+ # A state was not specified.
67
+ STATE_UNSPECIFIED = 0
68
+
69
+ # The cluster is being created.
70
+ CREATING = 1
71
+
72
+ # The cluster is active.
73
+ ACTIVE = 2
74
+
75
+ # The cluster is being deleted.
76
+ DELETING = 3
77
+ end
78
+ end
79
+
80
+ # A capacity configuration of a Kafka cluster.
81
+ # @!attribute [rw] vcpu_count
82
+ # @return [::Integer]
83
+ # Required. The number of vCPUs to provision for the cluster. Minimum: 3.
84
+ # @!attribute [rw] memory_bytes
85
+ # @return [::Integer]
86
+ # Required. The memory to provision for the cluster in bytes.
87
+ # The CPU:memory ratio (vCPU:GiB) must be between 1:1 and 1:8.
88
+ # Minimum: 3221225472 (3 GiB).
89
+ class CapacityConfig
90
+ include ::Google::Protobuf::MessageExts
91
+ extend ::Google::Protobuf::MessageExts::ClassMethods
92
+ end
93
+
94
+ # Defines rebalancing behavior of a Kafka cluster.
95
+ # @!attribute [rw] mode
96
+ # @return [::Google::Cloud::ManagedKafka::V1::RebalanceConfig::Mode]
97
+ # Optional. The rebalance behavior for the cluster.
98
+ # When not specified, defaults to `NO_REBALANCE`.
99
+ class RebalanceConfig
100
+ include ::Google::Protobuf::MessageExts
101
+ extend ::Google::Protobuf::MessageExts::ClassMethods
102
+
103
+ # The partition rebalance mode for the cluster.
104
+ module Mode
105
+ # A mode was not specified. Do not use.
106
+ MODE_UNSPECIFIED = 0
107
+
108
+ # Do not rebalance automatically.
109
+ NO_REBALANCE = 1
110
+
111
+ # Automatically rebalance topic partitions among brokers when the
112
+ # cluster is scaled up.
113
+ AUTO_REBALANCE_ON_SCALE_UP = 2
114
+ end
115
+ end
116
+
117
+ # The configuration of a Virtual Private Cloud (VPC) network that can access
118
+ # the Kafka cluster.
119
+ # @!attribute [rw] subnet
120
+ # @return [::String]
121
+ # Required. Name of the VPC subnet in which to create Private Service Connect
122
+ # (PSC) endpoints for the Kafka brokers and bootstrap address. Structured
123
+ # like: projects/\\{project}/regions/\\{region}/subnetworks/\\{subnet_id}
124
+ #
125
+ # The subnet must be located in the same region as the Kafka cluster. The
126
+ # project may differ. Multiple subnets from the same parent network must not
127
+ # be specified.
128
+ #
129
+ # The CIDR range of the subnet must be within the IPv4 address ranges for
130
+ # private networks, as specified in RFC 1918.
131
+ class NetworkConfig
132
+ include ::Google::Protobuf::MessageExts
133
+ extend ::Google::Protobuf::MessageExts::ClassMethods
134
+ end
135
+
136
+ # The configuration of access to the Kafka cluster.
137
+ # @!attribute [rw] network_configs
138
+ # @return [::Array<::Google::Cloud::ManagedKafka::V1::NetworkConfig>]
139
+ # Required. Virtual Private Cloud (VPC) networks that must be granted direct
140
+ # access to the Kafka cluster. Minimum of 1 network is required. Maximum 10
141
+ # networks can be specified.
142
+ class AccessConfig
143
+ include ::Google::Protobuf::MessageExts
144
+ extend ::Google::Protobuf::MessageExts::ClassMethods
145
+ end
146
+
147
+ # Configuration properties for a Kafka cluster deployed to Google Cloud
148
+ # Platform.
149
+ # @!attribute [rw] access_config
150
+ # @return [::Google::Cloud::ManagedKafka::V1::AccessConfig]
151
+ # Required. Access configuration for the Kafka cluster.
152
+ # @!attribute [rw] kms_key
153
+ # @return [::String]
154
+ # Optional. Immutable. The Cloud KMS Key name to use for encryption. The key
155
+ # must be located in the same region as the cluster and cannot be changed.
156
+ # Structured like:
157
+ # projects/\\{project}/locations/\\{location}/keyRings/\\{key_ring}/cryptoKeys/\\{crypto_key}.
158
+ class GcpConfig
159
+ include ::Google::Protobuf::MessageExts
160
+ extend ::Google::Protobuf::MessageExts::ClassMethods
161
+ end
162
+
163
+ # A Kafka topic in a given cluster.
164
+ # @!attribute [rw] name
165
+ # @return [::String]
166
+ # Identifier. The name of the topic. The `topic` segment is used when
167
+ # connecting directly to the cluster. Structured like:
168
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/topics/\\{topic}
169
+ # @!attribute [rw] partition_count
170
+ # @return [::Integer]
171
+ # Required. The number of partitions this topic has. The partition count can
172
+ # only be increased, not decreased. Please note that if partitions are
173
+ # increased for a topic that has a key, the partitioning logic or the
174
+ # ordering of the messages will be affected.
175
+ # @!attribute [rw] replication_factor
176
+ # @return [::Integer]
177
+ # Required. Immutable. The number of replicas of each partition. A
178
+ # replication factor of 3 is recommended for high availability.
179
+ # @!attribute [rw] configs
180
+ # @return [::Google::Protobuf::Map{::String => ::String}]
181
+ # Optional. Configurations for the topic that are overridden from the cluster
182
+ # defaults. The key of the map is a Kafka topic property name, for example:
183
+ # `cleanup.policy`, `compression.type`.
184
+ class Topic
185
+ include ::Google::Protobuf::MessageExts
186
+ extend ::Google::Protobuf::MessageExts::ClassMethods
187
+
188
+ # @!attribute [rw] key
189
+ # @return [::String]
190
+ # @!attribute [rw] value
191
+ # @return [::String]
192
+ class ConfigsEntry
193
+ include ::Google::Protobuf::MessageExts
194
+ extend ::Google::Protobuf::MessageExts::ClassMethods
195
+ end
196
+ end
197
+
198
+ # Metadata for a consumer group corresponding to a specific topic.
199
+ # @!attribute [rw] partitions
200
+ # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::ManagedKafka::V1::ConsumerPartitionMetadata}]
201
+ # Optional. Metadata for this consumer group and topic for all partition
202
+ # indexes it has metadata for.
203
+ class ConsumerTopicMetadata
204
+ include ::Google::Protobuf::MessageExts
205
+ extend ::Google::Protobuf::MessageExts::ClassMethods
206
+
207
+ # @!attribute [rw] key
208
+ # @return [::Integer]
209
+ # @!attribute [rw] value
210
+ # @return [::Google::Cloud::ManagedKafka::V1::ConsumerPartitionMetadata]
211
+ class PartitionsEntry
212
+ include ::Google::Protobuf::MessageExts
213
+ extend ::Google::Protobuf::MessageExts::ClassMethods
214
+ end
215
+ end
216
+
217
+ # Metadata for a consumer group corresponding to a specific partition.
218
+ # @!attribute [rw] offset
219
+ # @return [::Integer]
220
+ # Required. The offset for this partition, or 0 if no offset has been
221
+ # committed.
222
+ # @!attribute [rw] metadata
223
+ # @return [::String]
224
+ # Optional. The associated metadata for this partition, or empty if it does
225
+ # not exist.
226
+ class ConsumerPartitionMetadata
227
+ include ::Google::Protobuf::MessageExts
228
+ extend ::Google::Protobuf::MessageExts::ClassMethods
229
+ end
230
+
231
+ # A Kafka consumer group in a given cluster.
232
+ # @!attribute [rw] name
233
+ # @return [::String]
234
+ # Identifier. The name of the consumer group. The `consumer_group` segment is
235
+ # used when connecting directly to the cluster. Structured like:
236
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/consumerGroups/\\{consumer_group}
237
+ # @!attribute [rw] topics
238
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::ManagedKafka::V1::ConsumerTopicMetadata}]
239
+ # Optional. Metadata for this consumer group for all topics it has metadata
240
+ # for. The key of the map is a topic name, structured like:
241
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/topics/\\{topic}
242
+ class ConsumerGroup
243
+ include ::Google::Protobuf::MessageExts
244
+ extend ::Google::Protobuf::MessageExts::ClassMethods
245
+
246
+ # @!attribute [rw] key
247
+ # @return [::String]
248
+ # @!attribute [rw] value
249
+ # @return [::Google::Cloud::ManagedKafka::V1::ConsumerTopicMetadata]
250
+ class TopicsEntry
251
+ include ::Google::Protobuf::MessageExts
252
+ extend ::Google::Protobuf::MessageExts::ClassMethods
253
+ end
254
+ end
255
+
256
+ # Represents the metadata of the long-running operation.
257
+ # @!attribute [r] create_time
258
+ # @return [::Google::Protobuf::Timestamp]
259
+ # Output only. The time the operation was created.
260
+ # @!attribute [r] end_time
261
+ # @return [::Google::Protobuf::Timestamp]
262
+ # Output only. The time the operation finished running.
263
+ # @!attribute [r] target
264
+ # @return [::String]
265
+ # Output only. Server-defined resource path for the target of the operation.
266
+ # @!attribute [r] verb
267
+ # @return [::String]
268
+ # Output only. Name of the verb executed by the operation.
269
+ # @!attribute [r] status_message
270
+ # @return [::String]
271
+ # Output only. Human-readable status of the operation, if any.
272
+ # @!attribute [r] requested_cancellation
273
+ # @return [::Boolean]
274
+ # Output only. Identifies whether the user has requested cancellation
275
+ # of the operation. Operations that have been cancelled successfully
276
+ # have [Operation.error][] value with a
277
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of 1, corresponding to
278
+ # `Code.CANCELLED`.
279
+ # @!attribute [r] api_version
280
+ # @return [::String]
281
+ # Output only. API version used to start the operation.
282
+ class OperationMetadata
283
+ include ::Google::Protobuf::MessageExts
284
+ extend ::Google::Protobuf::MessageExts::ClassMethods
285
+ end
286
+ end
287
+ end
288
+ end
289
+ end
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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 Longrunning
22
+ # This resource represents a long-running operation that is the result of a
23
+ # network API call.
24
+ # @!attribute [rw] name
25
+ # @return [::String]
26
+ # The server-assigned name, which is only unique within the same service that
27
+ # originally returns it. If you use the default HTTP mapping, the
28
+ # `name` should be a resource name ending with `operations/{unique_id}`.
29
+ # @!attribute [rw] metadata
30
+ # @return [::Google::Protobuf::Any]
31
+ # Service-specific metadata associated with the operation. It typically
32
+ # contains progress information and common metadata such as create time.
33
+ # Some services might not provide such metadata. Any method that returns a
34
+ # long-running operation should document the metadata type, if any.
35
+ # @!attribute [rw] done
36
+ # @return [::Boolean]
37
+ # If the value is `false`, it means the operation is still in progress.
38
+ # If `true`, the operation is completed, and either `error` or `response` is
39
+ # available.
40
+ # @!attribute [rw] error
41
+ # @return [::Google::Rpc::Status]
42
+ # The error result of the operation in case of failure or cancellation.
43
+ # @!attribute [rw] response
44
+ # @return [::Google::Protobuf::Any]
45
+ # The normal response of the operation in case of success. If the original
46
+ # method returns no data on success, such as `Delete`, the response is
47
+ # `google.protobuf.Empty`. If the original method is standard
48
+ # `Get`/`Create`/`Update`, the response should be the resource. For other
49
+ # methods, the response should have the type `XxxResponse`, where `Xxx`
50
+ # is the original method name. For example, if the original method name
51
+ # is `TakeSnapshot()`, the inferred response type is
52
+ # `TakeSnapshotResponse`.
53
+ class Operation
54
+ include ::Google::Protobuf::MessageExts
55
+ extend ::Google::Protobuf::MessageExts::ClassMethods
56
+ end
57
+
58
+ # The request message for Operations.GetOperation.
59
+ # @!attribute [rw] name
60
+ # @return [::String]
61
+ # The name of the operation resource.
62
+ class GetOperationRequest
63
+ include ::Google::Protobuf::MessageExts
64
+ extend ::Google::Protobuf::MessageExts::ClassMethods
65
+ end
66
+
67
+ # The request message for Operations.ListOperations.
68
+ # @!attribute [rw] name
69
+ # @return [::String]
70
+ # The name of the operation's parent resource.
71
+ # @!attribute [rw] filter
72
+ # @return [::String]
73
+ # The standard list filter.
74
+ # @!attribute [rw] page_size
75
+ # @return [::Integer]
76
+ # The standard list page size.
77
+ # @!attribute [rw] page_token
78
+ # @return [::String]
79
+ # The standard list page token.
80
+ class ListOperationsRequest
81
+ include ::Google::Protobuf::MessageExts
82
+ extend ::Google::Protobuf::MessageExts::ClassMethods
83
+ end
84
+
85
+ # The response message for Operations.ListOperations.
86
+ # @!attribute [rw] operations
87
+ # @return [::Array<::Google::Longrunning::Operation>]
88
+ # A list of operations that matches the specified filter in the request.
89
+ # @!attribute [rw] next_page_token
90
+ # @return [::String]
91
+ # The standard List next-page token.
92
+ class ListOperationsResponse
93
+ include ::Google::Protobuf::MessageExts
94
+ extend ::Google::Protobuf::MessageExts::ClassMethods
95
+ end
96
+
97
+ # The request message for Operations.CancelOperation.
98
+ # @!attribute [rw] name
99
+ # @return [::String]
100
+ # The name of the operation resource to be cancelled.
101
+ class CancelOperationRequest
102
+ include ::Google::Protobuf::MessageExts
103
+ extend ::Google::Protobuf::MessageExts::ClassMethods
104
+ end
105
+
106
+ # The request message for Operations.DeleteOperation.
107
+ # @!attribute [rw] name
108
+ # @return [::String]
109
+ # The name of the operation resource to be deleted.
110
+ class DeleteOperationRequest
111
+ include ::Google::Protobuf::MessageExts
112
+ extend ::Google::Protobuf::MessageExts::ClassMethods
113
+ end
114
+
115
+ # The request message for Operations.WaitOperation.
116
+ # @!attribute [rw] name
117
+ # @return [::String]
118
+ # The name of the operation resource to wait on.
119
+ # @!attribute [rw] timeout
120
+ # @return [::Google::Protobuf::Duration]
121
+ # The maximum duration to wait before timing out. If left blank, the wait
122
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
123
+ # If RPC context deadline is also specified, the shorter one will be used.
124
+ class WaitOperationRequest
125
+ include ::Google::Protobuf::MessageExts
126
+ extend ::Google::Protobuf::MessageExts::ClassMethods
127
+ end
128
+
129
+ # A message representing the message types used by a long-running operation.
130
+ #
131
+ # Example:
132
+ #
133
+ # rpc LongRunningRecognize(LongRunningRecognizeRequest)
134
+ # returns (google.longrunning.Operation) {
135
+ # option (google.longrunning.operation_info) = {
136
+ # response_type: "LongRunningRecognizeResponse"
137
+ # metadata_type: "LongRunningRecognizeMetadata"
138
+ # };
139
+ # }
140
+ # @!attribute [rw] response_type
141
+ # @return [::String]
142
+ # Required. The message name of the primary return type for this
143
+ # long-running operation.
144
+ # This type will be used to deserialize the LRO's response.
145
+ #
146
+ # If the response is in a different package from the rpc, a fully-qualified
147
+ # message name must be used (e.g. `google.protobuf.Struct`).
148
+ #
149
+ # Note: Altering this value constitutes a breaking change.
150
+ # @!attribute [rw] metadata_type
151
+ # @return [::String]
152
+ # Required. The message name of the metadata type for this long-running
153
+ # operation.
154
+ #
155
+ # If the response is in a different package from the rpc, a fully-qualified
156
+ # message name must be used (e.g. `google.protobuf.Struct`).
157
+ #
158
+ # Note: Altering this value constitutes a breaking change.
159
+ class OperationInfo
160
+ include ::Google::Protobuf::MessageExts
161
+ extend ::Google::Protobuf::MessageExts::ClassMethods
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,145 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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
+ # // or ...
47
+ # if (any.isSameTypeAs(Foo.getDefaultInstance())) {
48
+ # foo = any.unpack(Foo.getDefaultInstance());
49
+ # }
50
+ #
51
+ # Example 3: Pack and unpack a message in Python.
52
+ #
53
+ # foo = Foo(...)
54
+ # any = Any()
55
+ # any.Pack(foo)
56
+ # ...
57
+ # if any.Is(Foo.DESCRIPTOR):
58
+ # any.Unpack(foo)
59
+ # ...
60
+ #
61
+ # Example 4: Pack and unpack a message in Go
62
+ #
63
+ # foo := &pb.Foo{...}
64
+ # any, err := anypb.New(foo)
65
+ # if err != nil {
66
+ # ...
67
+ # }
68
+ # ...
69
+ # foo := &pb.Foo{}
70
+ # if err := any.UnmarshalTo(foo); err != nil {
71
+ # ...
72
+ # }
73
+ #
74
+ # The pack methods provided by protobuf library will by default use
75
+ # 'type.googleapis.com/full.type.name' as the type URL and the unpack
76
+ # methods only use the fully qualified type name after the last '/'
77
+ # in the type URL, for example "foo.bar.com/x/y.z" will yield type
78
+ # name "y.z".
79
+ #
80
+ # JSON
81
+ # ====
82
+ # The JSON representation of an `Any` value uses the regular
83
+ # representation of the deserialized, embedded message, with an
84
+ # additional field `@type` which contains the type URL. Example:
85
+ #
86
+ # package google.profile;
87
+ # message Person {
88
+ # string first_name = 1;
89
+ # string last_name = 2;
90
+ # }
91
+ #
92
+ # {
93
+ # "@type": "type.googleapis.com/google.profile.Person",
94
+ # "firstName": <string>,
95
+ # "lastName": <string>
96
+ # }
97
+ #
98
+ # If the embedded message type is well-known and has a custom JSON
99
+ # representation, that representation will be embedded adding a field
100
+ # `value` which holds the custom JSON in addition to the `@type`
101
+ # field. Example (for message [google.protobuf.Duration][]):
102
+ #
103
+ # {
104
+ # "@type": "type.googleapis.com/google.protobuf.Duration",
105
+ # "value": "1.212s"
106
+ # }
107
+ # @!attribute [rw] type_url
108
+ # @return [::String]
109
+ # A URL/resource name that uniquely identifies the type of the serialized
110
+ # protocol buffer message. This string must contain at least
111
+ # one "/" character. The last segment of the URL's path must represent
112
+ # the fully qualified name of the type (as in
113
+ # `path/google.protobuf.Duration`). The name should be in a canonical form
114
+ # (e.g., leading "." is not accepted).
115
+ #
116
+ # In practice, teams usually precompile into the binary all types that they
117
+ # expect it to use in the context of Any. However, for URLs which use the
118
+ # scheme `http`, `https`, or no scheme, one can optionally set up a type
119
+ # server that maps type URLs to message definitions as follows:
120
+ #
121
+ # * If no scheme is provided, `https` is assumed.
122
+ # * An HTTP GET on the URL must yield a [google.protobuf.Type][]
123
+ # value in binary format, or produce an error.
124
+ # * Applications are allowed to cache lookup results based on the
125
+ # URL, or have them precompiled into a binary to avoid any
126
+ # lookup. Therefore, binary compatibility needs to be preserved
127
+ # on changes to types. (Use versioned type names to manage
128
+ # breaking changes.)
129
+ #
130
+ # Note: this functionality is not currently available in the official
131
+ # protobuf release, and it is not used for type URLs beginning with
132
+ # type.googleapis.com. As of May 2023, there are no widely used type server
133
+ # implementations and no plans to implement one.
134
+ #
135
+ # Schemes other than `http`, `https` (or the empty scheme) might be
136
+ # used with implementation specific semantics.
137
+ # @!attribute [rw] value
138
+ # @return [::String]
139
+ # Must be a valid serialized protocol buffer of the above specified type.
140
+ class Any
141
+ include ::Google::Protobuf::MessageExts
142
+ extend ::Google::Protobuf::MessageExts::ClassMethods
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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