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

Sign up to get free protection for your applications and to get access to all the features.
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 +399 -0
  24. data/proto_docs/google/api/field_behavior.rb +85 -0
  25. data/proto_docs/google/api/field_info.rb +65 -0
  26. data/proto_docs/google/api/launch_stage.rb +71 -0
  27. data/proto_docs/google/api/resource.rb +222 -0
  28. data/proto_docs/google/cloud/managedkafka/v1/managed_kafka.rb +341 -0
  29. data/proto_docs/google/cloud/managedkafka/v1/resources.rb +291 -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,291 @@
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
+ # Note that the project component only accepts a project ID, and not a
159
+ # project number.
160
+ class GcpConfig
161
+ include ::Google::Protobuf::MessageExts
162
+ extend ::Google::Protobuf::MessageExts::ClassMethods
163
+ end
164
+
165
+ # A Kafka topic in a given cluster.
166
+ # @!attribute [rw] name
167
+ # @return [::String]
168
+ # Identifier. The name of the topic. The `topic` segment is used when
169
+ # connecting directly to the cluster. Structured like:
170
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/topics/\\{topic}
171
+ # @!attribute [rw] partition_count
172
+ # @return [::Integer]
173
+ # Required. The number of partitions this topic has. The partition count can
174
+ # only be increased, not decreased. Please note that if partitions are
175
+ # increased for a topic that has a key, the partitioning logic or the
176
+ # ordering of the messages will be affected.
177
+ # @!attribute [rw] replication_factor
178
+ # @return [::Integer]
179
+ # Required. Immutable. The number of replicas of each partition. A
180
+ # replication factor of 3 is recommended for high availability.
181
+ # @!attribute [rw] configs
182
+ # @return [::Google::Protobuf::Map{::String => ::String}]
183
+ # Optional. Configurations for the topic that are overridden from the cluster
184
+ # defaults. The key of the map is a Kafka topic property name, for example:
185
+ # `cleanup.policy`, `compression.type`.
186
+ class Topic
187
+ include ::Google::Protobuf::MessageExts
188
+ extend ::Google::Protobuf::MessageExts::ClassMethods
189
+
190
+ # @!attribute [rw] key
191
+ # @return [::String]
192
+ # @!attribute [rw] value
193
+ # @return [::String]
194
+ class ConfigsEntry
195
+ include ::Google::Protobuf::MessageExts
196
+ extend ::Google::Protobuf::MessageExts::ClassMethods
197
+ end
198
+ end
199
+
200
+ # Metadata for a consumer group corresponding to a specific topic.
201
+ # @!attribute [rw] partitions
202
+ # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::ManagedKafka::V1::ConsumerPartitionMetadata}]
203
+ # Optional. Metadata for this consumer group and topic for all partition
204
+ # indexes it has metadata for.
205
+ class ConsumerTopicMetadata
206
+ include ::Google::Protobuf::MessageExts
207
+ extend ::Google::Protobuf::MessageExts::ClassMethods
208
+
209
+ # @!attribute [rw] key
210
+ # @return [::Integer]
211
+ # @!attribute [rw] value
212
+ # @return [::Google::Cloud::ManagedKafka::V1::ConsumerPartitionMetadata]
213
+ class PartitionsEntry
214
+ include ::Google::Protobuf::MessageExts
215
+ extend ::Google::Protobuf::MessageExts::ClassMethods
216
+ end
217
+ end
218
+
219
+ # Metadata for a consumer group corresponding to a specific partition.
220
+ # @!attribute [rw] offset
221
+ # @return [::Integer]
222
+ # Required. The offset for this partition, or 0 if no offset has been
223
+ # committed.
224
+ # @!attribute [rw] metadata
225
+ # @return [::String]
226
+ # Optional. The associated metadata for this partition, or empty if it does
227
+ # not exist.
228
+ class ConsumerPartitionMetadata
229
+ include ::Google::Protobuf::MessageExts
230
+ extend ::Google::Protobuf::MessageExts::ClassMethods
231
+ end
232
+
233
+ # A Kafka consumer group in a given cluster.
234
+ # @!attribute [rw] name
235
+ # @return [::String]
236
+ # Identifier. The name of the consumer group. The `consumer_group` segment is
237
+ # used when connecting directly to the cluster. Structured like:
238
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/consumerGroups/\\{consumer_group}
239
+ # @!attribute [rw] topics
240
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::ManagedKafka::V1::ConsumerTopicMetadata}]
241
+ # Optional. Metadata for this consumer group for all topics it has metadata
242
+ # for. The key of the map is a topic name, structured like:
243
+ # projects/\\{project}/locations/\\{location}/clusters/\\{cluster}/topics/\\{topic}
244
+ class ConsumerGroup
245
+ include ::Google::Protobuf::MessageExts
246
+ extend ::Google::Protobuf::MessageExts::ClassMethods
247
+
248
+ # @!attribute [rw] key
249
+ # @return [::String]
250
+ # @!attribute [rw] value
251
+ # @return [::Google::Cloud::ManagedKafka::V1::ConsumerTopicMetadata]
252
+ class TopicsEntry
253
+ include ::Google::Protobuf::MessageExts
254
+ extend ::Google::Protobuf::MessageExts::ClassMethods
255
+ end
256
+ end
257
+
258
+ # Represents the metadata of the long-running operation.
259
+ # @!attribute [r] create_time
260
+ # @return [::Google::Protobuf::Timestamp]
261
+ # Output only. The time the operation was created.
262
+ # @!attribute [r] end_time
263
+ # @return [::Google::Protobuf::Timestamp]
264
+ # Output only. The time the operation finished running.
265
+ # @!attribute [r] target
266
+ # @return [::String]
267
+ # Output only. Server-defined resource path for the target of the operation.
268
+ # @!attribute [r] verb
269
+ # @return [::String]
270
+ # Output only. Name of the verb executed by the operation.
271
+ # @!attribute [r] status_message
272
+ # @return [::String]
273
+ # Output only. Human-readable status of the operation, if any.
274
+ # @!attribute [r] requested_cancellation
275
+ # @return [::Boolean]
276
+ # Output only. Identifies whether the user has requested cancellation
277
+ # of the operation. Operations that have been cancelled successfully
278
+ # have [Operation.error][] value with a
279
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of 1, corresponding to
280
+ # `Code.CANCELLED`.
281
+ # @!attribute [r] api_version
282
+ # @return [::String]
283
+ # Output only. API version used to start the operation.
284
+ class OperationMetadata
285
+ include ::Google::Protobuf::MessageExts
286
+ extend ::Google::Protobuf::MessageExts::ClassMethods
287
+ end
288
+ end
289
+ end
290
+ end
291
+ 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