google-cloud-pubsub 2.19.0 → 2.22.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: db206c3eab0b2c876feeb00d0e0d8de12b6c6ac60f55153c61f06973f627ac34
4
- data.tar.gz: bed374d87a423c101703159453d1ef6724062b2c6bee7ab58276b715b95d094d
3
+ metadata.gz: 769d41360e1e561290f024664e2090b2a17322f0c7110bc31bb26d45f6a521d9
4
+ data.tar.gz: 340c7db4b5f7e27066bde07e838378c0c734738072363567d268b88657135a07
5
5
  SHA512:
6
- metadata.gz: 0dbec66b7af6c93d4493ddbfc8b918a661dac41aa5bfb94330169652e2da6e62682c4b22bc969f061e111950babbf7aa786bcf29305aa91f7a85438389adb87d
7
- data.tar.gz: 0c8b9aba5a2c7ed59ed2cda8696db84e253e074468dc48a337a5992e4a695e3c40c87f023872db49565eaac4cc00fa5b0ec55db90839fd5a877fab8a38f334ce
6
+ metadata.gz: c83de697da5723967ed3287d5256cb36ba6a6f010b9882f14893e016c3055772873fcb3dd6e47c89ed950c58ab16c6f1af89e11fb4974f21259233abeae39700
7
+ data.tar.gz: f1480d77dacda0b07cce8bb54ef8914014ef27b5371c8a6cf1ff204239485ea0822bc71ff18fe73a18769157d17a80b77a5ee1e48165d5624e3ff0fd2ecf4fb6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Release History
2
2
 
3
+ ### 2.22.0 (2025-03-27)
4
+
5
+ #### Features
6
+
7
+ * Support list schema revisions ([#29174](https://github.com/googleapis/google-cloud-ruby/issues/29174))
8
+
9
+ ### 2.21.0 (2025-03-14)
10
+
11
+ #### Features
12
+
13
+ * Support revision_id in Schema
14
+
15
+ ### 2.20.0 (2025-02-13)
16
+
17
+ #### Features
18
+
19
+ * Update Ruby version requirement to 3.0 ([#29071](https://github.com/googleapis/google-cloud-ruby/issues/29071))
20
+
3
21
  ### 2.19.0 (2024-07-09)
4
22
 
5
23
  #### 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,63 @@ 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
+
244
+ ##
245
+ # Lists all schema revisions for the named schema.
246
+ #
247
+ # @param view [Symbol, String, nil] The set of fields to return in the response. Possible values:
248
+ # * `BASIC` - Include the `name` and `type` of the schema, but not the `definition`.
249
+ # * `FULL` - Include all Schema object fields.
250
+ #
251
+ # @return [Google::Cloud::PubSub::V1::ListSchemaRevisionsResponse]
252
+ #
253
+ # @example
254
+ # require "google/cloud/pubsub"
255
+ #
256
+ # pubsub = Google::Cloud::PubSub.new
257
+ #
258
+ # schema = pubsub.schema "my-schema"
259
+ # schema.list_revisions
260
+ #
261
+ def list_revisions view: nil, page_size: nil, page_token: nil
262
+ service.list_schema_revisions name,
263
+ view || @view,
264
+ page_size,
265
+ page_token
266
+ end
267
+
200
268
  ##
201
269
  # Determines whether the schema object was created without retrieving the
202
270
  # resource representation from the Pub/Sub service.
@@ -341,6 +341,21 @@ module Google
341
341
  paged_enum.response
342
342
  end
343
343
 
344
+ ##
345
+ # Lists all schema revisions for the named schema.
346
+ # @param name [String] The name of the schema to list revisions for.
347
+ # @param view [String, Symbol, nil] Possible values:
348
+ # * `BASIC` - Include the name and type of the schema, but not the definition.
349
+ # * `FULL` - Include all Schema object fields.
350
+ #
351
+ def list_schema_revisions name, view, page_size, page_token
352
+ schema_view = Google::Cloud::PubSub::V1::SchemaView.const_get view.to_s.upcase
353
+ schemas.list_schema_revisions name: name,
354
+ view: schema_view,
355
+ page_size: page_size,
356
+ page_token: page_token
357
+ end
358
+
344
359
  ##
345
360
  # Creates a schema in the current (or given) project.
346
361
  def create_schema schema_id, type, definition, options = {}
@@ -371,6 +386,31 @@ module Google
371
386
  schemas.delete_schema name: schema_path(schema_name)
372
387
  end
373
388
 
389
+ ##
390
+ # Commits a new schema revision to an existing schema.
391
+ #
392
+ # @param name [String] The name of the schema to revision.
393
+ # @param definition [String] The definition of the schema. This should
394
+ # contain a string representing the full definition of the schema that
395
+ # is a valid schema definition of the type specified in `type`. See
396
+ # https://cloud.google.com/pubsub/docs/schemas for details.
397
+ # @param type [String, Symbol] The type of the schema. Required. Possible
398
+ # values are case-insensitive and include:
399
+ #
400
+ # * `PROTOCOL_BUFFER` - A Protocol Buffer schema definition.
401
+ # * `AVRO` - An Avro schema definition.
402
+ #
403
+ # @return [Google::Cloud::PubSub::V1::Schema]
404
+ #
405
+ def commit_schema name, definition, type
406
+ schema = Google::Cloud::PubSub::V1::Schema.new(
407
+ name: name,
408
+ definition: definition,
409
+ type: type
410
+ )
411
+ schemas.commit_schema name: name, schema: schema
412
+ end
413
+
374
414
  ##
375
415
  # Validate the definition string intended for a schema.
376
416
  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.19.0".freeze
19
+ VERSION = "2.22.0".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0
4
+ version: 2.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
8
8
  - Chris Smith
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2024-07-09 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: concurrent-ruby
@@ -43,22 +42,16 @@ dependencies:
43
42
  name: google-cloud-pubsub-v1
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0.20'
49
- - - "<"
45
+ - - "~>"
50
46
  - !ruby/object:Gem::Version
51
- version: 2.a
47
+ version: '1.7'
52
48
  type: :runtime
53
49
  prerelease: false
54
50
  version_requirements: !ruby/object:Gem::Requirement
55
51
  requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: '0.20'
59
- - - "<"
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 2.a
54
+ version: '1.7'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: retriable
64
57
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +121,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-clo
128
121
  licenses:
129
122
  - Apache-2.0
130
123
  metadata: {}
131
- post_install_message:
132
124
  rdoc_options: []
133
125
  require_paths:
134
126
  - lib
@@ -136,15 +128,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
128
  requirements:
137
129
  - - ">="
138
130
  - !ruby/object:Gem::Version
139
- version: '2.7'
131
+ version: '3.0'
140
132
  required_rubygems_version: !ruby/object:Gem::Requirement
141
133
  requirements:
142
134
  - - ">="
143
135
  - !ruby/object:Gem::Version
144
136
  version: '0'
145
137
  requirements: []
146
- rubygems_version: 3.5.6
147
- signing_key:
138
+ rubygems_version: 3.6.5
148
139
  specification_version: 4
149
140
  summary: API Client library for Google Cloud Pub/Sub
150
141
  test_files: []