google-cloud-pubsub 2.20.0 → 2.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54d10854bbc8ae26caa6b19c2e000ebe83db42543835951e6eabc036297413d6
4
- data.tar.gz: 1b5bfb201af3ce5fd0ef0fe246431fd9c592cf4abaaa136d730ee7a1c8153665
3
+ metadata.gz: c15b6a8127a10f5144ad00b65d9f68d9b9712258ee7f41d45fa3f642817510c9
4
+ data.tar.gz: 65e672430dd2f4fe0ac933725c1de99203ec48b6905ada6396c7f3c03c0879b3
5
5
  SHA512:
6
- metadata.gz: 8b5150b64376931afcf1d6a17118a8c32a892c50add2c5c0d4c4c3cdd613712bcf444b90c2339138eb01040193a42577773a5a803a82fb3db2fa4d1ef3b9fbf3
7
- data.tar.gz: 3724e15d5f7f056688cc96d28bae69acaddd7925cec4113cd6c52088674cbc8b0ee48de2017354b88c4fcefff5fec44feada524a12177778c3f9c006af3f32da
6
+ metadata.gz: 2450f89686a4a87e215bd0c8e162ce7eb5f0634721882023363cef6b2b91ecd7a06b4218ef97593b8dbcc01473f20091cb4384a3127f2af94ed2228f2bd39d92
7
+ data.tar.gz: 5c84cf4a320c415ec122c2f3fdf061ab7637f13806b23d3adbf65ad1c459d6d126e875fd8dddcf508bcc5536c7b466f7b7434748413d603d6e7cedcc28652009
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.21.0 (2025-03-14)
4
+
5
+ #### Features
6
+
7
+ * Support revision_id in Schema
8
+
3
9
  ### 2.20.0 (2025-02-13)
4
10
 
5
11
  #### Features
@@ -84,6 +84,17 @@ module Google
84
84
  @grpc.definition if @grpc.definition && !@grpc.definition.empty?
85
85
  end
86
86
 
87
+ ##
88
+ # The revision ID of the schema.
89
+ #
90
+ # @return [String] The revision id.
91
+ # @return [nil] If this object is a reference.
92
+ #
93
+ def revision_id
94
+ return nil if reference?
95
+ @grpc.revision_id if @grpc.revision_id && !@grpc.revision_id.empty?
96
+ end
97
+
87
98
  ##
88
99
  # Validates a message against a schema.
89
100
  #
@@ -197,6 +208,39 @@ module Google
197
208
  @exists = false
198
209
  end
199
210
 
211
+ ##
212
+ # Commits a new schema revision to an existing schema.
213
+ #
214
+ # @param definition [String] The definition of the schema. This should
215
+ # contain a string representing the full definition of the schema that
216
+ # is a valid schema definition of the type specified in `type`. See
217
+ # https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.schemas#Schema
218
+ # for details.
219
+ # @param type [String, Symbol] The type of the schema. Possible values are
220
+ # case-insensitive and include:
221
+ #
222
+ # * `PROTOCOL_BUFFER` - A Protocol Buffer schema definition.
223
+ # * `AVRO` - An Avro schema definition.
224
+ #
225
+ # @return [Google::Cloud::PubSub::Schema]
226
+ #
227
+ # @example
228
+ # require "google/cloud/pubsub"
229
+ #
230
+ # pubsub = Google::Cloud::PubSub.new
231
+ #
232
+ # schema = pubsub.schema "my-schema"
233
+ #
234
+ # definition = File.read /path/to/file
235
+ #
236
+ # revision_schema = schema.commit definition, type: :protocol_buffer
237
+ #
238
+ def commit definition, type
239
+ type = type.to_s.upcase
240
+ grpc = service.commit_schema name, definition, type
241
+ Schema.from_grpc grpc, service, view: @view
242
+ end
243
+
200
244
  ##
201
245
  # Determines whether the schema object was created without retrieving the
202
246
  # resource representation from the Pub/Sub service.
@@ -371,6 +371,31 @@ module Google
371
371
  schemas.delete_schema name: schema_path(schema_name)
372
372
  end
373
373
 
374
+ ##
375
+ # Commits a new schema revision to an existing schema.
376
+ #
377
+ # @param name [String] The name of the schema to revision.
378
+ # @param definition [String] The definition of the schema. This should
379
+ # contain a string representing the full definition of the schema that
380
+ # is a valid schema definition of the type specified in `type`. See
381
+ # https://cloud.google.com/pubsub/docs/schemas for details.
382
+ # @param type [String, Symbol] The type of the schema. Required. Possible
383
+ # values are case-insensitive and include:
384
+ #
385
+ # * `PROTOCOL_BUFFER` - A Protocol Buffer schema definition.
386
+ # * `AVRO` - An Avro schema definition.
387
+ #
388
+ # @return [Google::Cloud::PubSub::V1::Schema]
389
+ #
390
+ def commit_schema name, definition, type
391
+ schema = Google::Cloud::PubSub::V1::Schema.new(
392
+ name: name,
393
+ definition: definition,
394
+ type: type
395
+ )
396
+ schemas.commit_schema name: name, schema: schema
397
+ end
398
+
374
399
  ##
375
400
  # Validate the definition string intended for a schema.
376
401
  def validate_schema type, definition, options = {}
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.20.0".freeze
19
+ VERSION = "2.21.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.20.0
4
+ version: 2.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-13 00:00:00.000000000 Z
11
+ date: 2025-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.6.3
138
+ rubygems_version: 3.6.5
139
139
  specification_version: 4
140
140
  summary: API Client library for Google Cloud Pub/Sub
141
141
  test_files: []