google-cloud-eventarc-publishing-v1 1.0.1 → 1.2.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: 9cd1c83ababa7c196f226a4a144544b5877d7a54394242b9c56f6da1de9153cf
4
- data.tar.gz: 484c1c3bb112022f605007801321590e086194db771f1f630f3771b1971c73e2
3
+ metadata.gz: 06db8e6cfe8ee687d96402eca75b1a18d63da7049344a74981afcfd0bc955929
4
+ data.tar.gz: 3ec0e5d941d518e2d076f56f48bc05a022dc1d8b5beb143f154cb5128ad269a2
5
5
  SHA512:
6
- metadata.gz: 03e3726392a006be4f7560b5511381754b7dce940b0eb76123d3d8240732042e11e5f00be4dbb8bc74c580be56af08b434703f8f96691530c63ccd3a08f8f5ac
7
- data.tar.gz: 5b4b176c7e66dfa6d81316a11759be0d97e5d3d39f3407d4e81262e45a5d1ec118a29713585e9f5e0028ea065487ba06db8082d3d217155b0809c0e613489a07
6
+ metadata.gz: '08fef204a2fe9d65b55fac61a7e10bc19f17517604f8070ec3f1015c43cccdbada232ecdd3935a98d1a339c0efe419d666af8a30e2681acddb01a3f4ce3ee79a'
7
+ data.tar.gz: c0ea00163c6060608ec1f5b20b53f4f9c0eb6fcc81ffb7f9ee1f7114bd1614696949244b39152e442e0307a2efbab573b6ea699dd19ce69485be182d962488a2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Eventarc Publishing V1 API
2
2
 
3
- API Client library for the Eventarc Publishing V1 API
3
+ Processes events generated by an event provider and delivers them to a subscriber.
4
4
 
5
5
  Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. Eventarc requires no infrastructure management — you can optimize productivity and costs while building a modern, event-driven solution.
6
6
 
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/eventarc/)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/eventarc/publishing/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: google/cloud/eventarc/publishing/v1/cloud_event.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/api/field_behavior_pb'
8
+ require 'google/protobuf/any_pb'
9
+ require 'google/protobuf/timestamp_pb'
10
+
11
+
12
+ descriptor_data = "\n5google/cloud/eventarc/publishing/v1/cloud_event.proto\x12#google.cloud.eventarc.publishing.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/protobuf/any.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfc\x04\n\nCloudEvent\x12\x0f\n\x02id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x06source\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x19\n\x0cspec_version\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\x04type\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12X\n\nattributes\x18\x05 \x03(\x0b\x32?.google.cloud.eventarc.publishing.v1.CloudEvent.AttributesEntryB\x03\xe0\x41\x01\x12\x1a\n\x0b\x62inary_data\x18\x06 \x01(\x0c\x42\x03\xe0\x41\x01H\x00\x12\x18\n\ttext_data\x18\x07 \x01(\tB\x03\xe0\x41\x01H\x00\x12/\n\nproto_data\x18\x08 \x01(\x0b\x32\x14.google.protobuf.AnyB\x03\xe0\x41\x01H\x00\x1a\xd3\x01\n\x18\x43loudEventAttributeValue\x12\x14\n\nce_boolean\x18\x01 \x01(\x08H\x00\x12\x14\n\nce_integer\x18\x02 \x01(\x05H\x00\x12\x13\n\tce_string\x18\x03 \x01(\tH\x00\x12\x12\n\x08\x63\x65_bytes\x18\x04 \x01(\x0cH\x00\x12\x10\n\x06\x63\x65_uri\x18\x05 \x01(\tH\x00\x12\x14\n\nce_uri_ref\x18\x06 \x01(\tH\x00\x12\x32\n\x0c\x63\x65_timestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x06\n\x04\x61ttr\x1a{\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12W\n\x05value\x18\x02 \x01(\x0b\x32H.google.cloud.eventarc.publishing.v1.CloudEvent.CloudEventAttributeValue:\x02\x38\x01\x42\x06\n\x04\x64\x61taB\xfb\x01\n\'com.google.cloud.eventarc.publishing.v1B\x0f\x43loudEventProtoP\x01ZGcloud.google.com/go/eventarc/publishing/apiv1/publishingpb;publishingpb\xaa\x02#Google.Cloud.Eventarc.Publishing.V1\xca\x02#Google\\Cloud\\Eventarc\\Publishing\\V1\xea\x02\'Google::Cloud::Eventarc::Publishing::V1b\x06proto3"
13
+
14
+ pool = Google::Protobuf::DescriptorPool.generated_pool
15
+
16
+ begin
17
+ pool.add_serialized_file(descriptor_data)
18
+ rescue TypeError
19
+ # Compatibility code: will be removed in the next major version.
20
+ require 'google/protobuf/descriptor_pb'
21
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
22
+ parsed.clear_dependency
23
+ serialized = parsed.class.encode(parsed)
24
+ file = pool.add_serialized_file(serialized)
25
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
26
+ imports = [
27
+ ["google.protobuf.Any", "google/protobuf/any.proto"],
28
+ ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"],
29
+ ]
30
+ imports.each do |type_name, expected_filename|
31
+ import_file = pool.lookup(type_name).file_descriptor
32
+ if import_file.name != expected_filename
33
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
34
+ end
35
+ end
36
+ warn "Each proto file must use a consistent fully-qualified name."
37
+ warn "This will become an error in the next major version."
38
+ end
39
+
40
+ module Google
41
+ module Cloud
42
+ module Eventarc
43
+ module Publishing
44
+ module V1
45
+ CloudEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.CloudEvent").msgclass
46
+ CloudEvent::CloudEventAttributeValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.CloudEvent.CloudEventAttributeValue").msgclass
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -94,6 +94,8 @@ module Google
94
94
 
95
95
  default_config.rpcs.publish_channel_connection_events.timeout = 60.0
96
96
 
97
+ default_config.rpcs.publish.timeout = 60.0
98
+
97
99
  default_config
98
100
  end
99
101
  yield @configure if block_given?
@@ -181,8 +183,28 @@ module Google
181
183
  universe_domain: @config.universe_domain,
182
184
  channel_args: @config.channel_args,
183
185
  interceptors: @config.interceptors,
184
- channel_pool_config: @config.channel_pool
186
+ channel_pool_config: @config.channel_pool,
187
+ logger: @config.logger
185
188
  )
189
+
190
+ @publisher_stub.stub_logger&.info do |entry|
191
+ entry.set_system_name
192
+ entry.set_service
193
+ entry.message = "Created client for #{entry.service}"
194
+ entry.set_credentials_fields credentials
195
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
196
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
197
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
198
+ end
199
+ end
200
+
201
+ ##
202
+ # The logger used for request/response debug logging.
203
+ #
204
+ # @return [Logger]
205
+ #
206
+ def logger
207
+ @publisher_stub.logger
186
208
  end
187
209
 
188
210
  # Service calls
@@ -277,7 +299,6 @@ module Google
277
299
 
278
300
  @publisher_stub.call_rpc :publish_channel_connection_events, request, options: options do |response, operation|
279
301
  yield response, operation if block_given?
280
- return response
281
302
  end
282
303
  rescue ::GRPC::BadStatus => e
283
304
  raise ::Google::Cloud::Error.from_error(e)
@@ -373,7 +394,104 @@ module Google
373
394
 
374
395
  @publisher_stub.call_rpc :publish_events, request, options: options do |response, operation|
375
396
  yield response, operation if block_given?
376
- return response
397
+ end
398
+ rescue ::GRPC::BadStatus => e
399
+ raise ::Google::Cloud::Error.from_error(e)
400
+ end
401
+
402
+ ##
403
+ # Publish events to a message bus.
404
+ #
405
+ # @overload publish(request, options = nil)
406
+ # Pass arguments to `publish` via a request object, either of type
407
+ # {::Google::Cloud::Eventarc::Publishing::V1::PublishRequest} or an equivalent Hash.
408
+ #
409
+ # @param request [::Google::Cloud::Eventarc::Publishing::V1::PublishRequest, ::Hash]
410
+ # A request object representing the call parameters. Required. To specify no
411
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
412
+ # @param options [::Gapic::CallOptions, ::Hash]
413
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
414
+ #
415
+ # @overload publish(message_bus: nil, proto_message: nil, json_message: nil, avro_message: nil)
416
+ # Pass arguments to `publish` via keyword arguments. Note that at
417
+ # least one keyword argument is required. To specify no parameters, or to keep all
418
+ # the default parameter values, pass an empty Hash as a request object (see above).
419
+ #
420
+ # @param message_bus [::String]
421
+ # Required. The full name of the message bus to publish events to. Format:
422
+ # `projects/{project}/locations/{location}/messageBuses/{messageBus}`.
423
+ # @param proto_message [::Google::Cloud::Eventarc::Publishing::V1::CloudEvent, ::Hash]
424
+ # The Protobuf format of the CloudEvent being published. Specification can
425
+ # be found here:
426
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md
427
+ # @param json_message [::String]
428
+ # The JSON format of the CloudEvent being published. Specification can be
429
+ # found here:
430
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
431
+ # @param avro_message [::String]
432
+ # The Avro format of the CloudEvent being published. Specification can
433
+ # be found here:
434
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md
435
+ #
436
+ # @yield [response, operation] Access the result along with the RPC operation
437
+ # @yieldparam response [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
438
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
439
+ #
440
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
441
+ #
442
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
443
+ #
444
+ # @example Basic example
445
+ # require "google/cloud/eventarc/publishing/v1"
446
+ #
447
+ # # Create a client object. The client can be reused for multiple calls.
448
+ # client = Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new
449
+ #
450
+ # # Create a request. To set request fields, pass in keyword arguments.
451
+ # request = Google::Cloud::Eventarc::Publishing::V1::PublishRequest.new
452
+ #
453
+ # # Call the publish method.
454
+ # result = client.publish request
455
+ #
456
+ # # The returned object is of type Google::Cloud::Eventarc::Publishing::V1::PublishResponse.
457
+ # p result
458
+ #
459
+ def publish request, options = nil
460
+ raise ::ArgumentError, "request must be provided" if request.nil?
461
+
462
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::Publishing::V1::PublishRequest
463
+
464
+ # Converts hash and nil to an options object
465
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
466
+
467
+ # Customize the options with defaults
468
+ metadata = @config.rpcs.publish.metadata.to_h
469
+
470
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
471
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
472
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
473
+ gapic_version: ::Google::Cloud::Eventarc::Publishing::V1::VERSION
474
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
475
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
476
+
477
+ header_params = {}
478
+ if request.message_bus
479
+ header_params["message_bus"] = request.message_bus
480
+ end
481
+
482
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
483
+ metadata[:"x-goog-request-params"] ||= request_params_header
484
+
485
+ options.apply_defaults timeout: @config.rpcs.publish.timeout,
486
+ metadata: metadata,
487
+ retry_policy: @config.rpcs.publish.retry_policy
488
+
489
+ options.apply_defaults timeout: @config.timeout,
490
+ metadata: @config.metadata,
491
+ retry_policy: @config.retry_policy
492
+
493
+ @publisher_stub.call_rpc :publish, request, options: options do |response, operation|
494
+ yield response, operation if block_given?
377
495
  end
378
496
  rescue ::GRPC::BadStatus => e
379
497
  raise ::Google::Cloud::Error.from_error(e)
@@ -462,6 +580,11 @@ module Google
462
580
  # default endpoint URL. The default value of nil uses the environment
463
581
  # universe (usually the default "googleapis.com" universe).
464
582
  # @return [::String,nil]
583
+ # @!attribute [rw] logger
584
+ # A custom logger to use for request/response debug logging, or the value
585
+ # `:default` (the default) to construct a default logger, or `nil` to
586
+ # explicitly disable logging.
587
+ # @return [::Logger,:default,nil]
465
588
  #
466
589
  class Configuration
467
590
  extend ::Gapic::Config
@@ -486,6 +609,7 @@ module Google
486
609
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
487
610
  config_attr :quota_project, nil, ::String, nil
488
611
  config_attr :universe_domain, nil, ::String, nil
612
+ config_attr :logger, :default, ::Logger, nil, :default
489
613
 
490
614
  # @private
491
615
  def initialize parent_config = nil
@@ -542,6 +666,11 @@ module Google
542
666
  # @return [::Gapic::Config::Method]
543
667
  #
544
668
  attr_reader :publish_events
669
+ ##
670
+ # RPC-specific configuration for `publish`
671
+ # @return [::Gapic::Config::Method]
672
+ #
673
+ attr_reader :publish
545
674
 
546
675
  # @private
547
676
  def initialize parent_rpcs = nil
@@ -549,6 +678,8 @@ module Google
549
678
  @publish_channel_connection_events = ::Gapic::Config::Method.new publish_channel_connection_events_config
550
679
  publish_events_config = parent_rpcs.publish_events if parent_rpcs.respond_to? :publish_events
551
680
  @publish_events = ::Gapic::Config::Method.new publish_events_config
681
+ publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
682
+ @publish = ::Gapic::Config::Method.new publish_config
552
683
 
553
684
  yield self if block_given?
554
685
  end
@@ -96,6 +96,8 @@ module Google
96
96
 
97
97
  default_config.rpcs.publish_channel_connection_events.timeout = 60.0
98
98
 
99
+ default_config.rpcs.publish.timeout = 60.0
100
+
99
101
  default_config
100
102
  end
101
103
  yield @configure if block_given?
@@ -174,8 +176,28 @@ module Google
174
176
  endpoint: @config.endpoint,
175
177
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
176
178
  universe_domain: @config.universe_domain,
177
- credentials: credentials
179
+ credentials: credentials,
180
+ logger: @config.logger
178
181
  )
182
+
183
+ @publisher_stub.logger(stub: true)&.info do |entry|
184
+ entry.set_system_name
185
+ entry.set_service
186
+ entry.message = "Created client for #{entry.service}"
187
+ entry.set_credentials_fields credentials
188
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
189
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
190
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
191
+ end
192
+ end
193
+
194
+ ##
195
+ # The logger used for request/response debug logging.
196
+ #
197
+ # @return [Logger]
198
+ #
199
+ def logger
200
+ @publisher_stub.logger
179
201
  end
180
202
 
181
203
  # Service calls
@@ -263,7 +285,6 @@ module Google
263
285
 
264
286
  @publisher_stub.publish_channel_connection_events request, options do |result, operation|
265
287
  yield result, operation if block_given?
266
- return result
267
288
  end
268
289
  rescue ::Gapic::Rest::Error => e
269
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -352,7 +373,97 @@ module Google
352
373
 
353
374
  @publisher_stub.publish_events request, options do |result, operation|
354
375
  yield result, operation if block_given?
355
- return result
376
+ end
377
+ rescue ::Gapic::Rest::Error => e
378
+ raise ::Google::Cloud::Error.from_error(e)
379
+ end
380
+
381
+ ##
382
+ # Publish events to a message bus.
383
+ #
384
+ # @overload publish(request, options = nil)
385
+ # Pass arguments to `publish` via a request object, either of type
386
+ # {::Google::Cloud::Eventarc::Publishing::V1::PublishRequest} or an equivalent Hash.
387
+ #
388
+ # @param request [::Google::Cloud::Eventarc::Publishing::V1::PublishRequest, ::Hash]
389
+ # A request object representing the call parameters. Required. To specify no
390
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
391
+ # @param options [::Gapic::CallOptions, ::Hash]
392
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
393
+ #
394
+ # @overload publish(message_bus: nil, proto_message: nil, json_message: nil, avro_message: nil)
395
+ # Pass arguments to `publish` via keyword arguments. Note that at
396
+ # least one keyword argument is required. To specify no parameters, or to keep all
397
+ # the default parameter values, pass an empty Hash as a request object (see above).
398
+ #
399
+ # @param message_bus [::String]
400
+ # Required. The full name of the message bus to publish events to. Format:
401
+ # `projects/{project}/locations/{location}/messageBuses/{messageBus}`.
402
+ # @param proto_message [::Google::Cloud::Eventarc::Publishing::V1::CloudEvent, ::Hash]
403
+ # The Protobuf format of the CloudEvent being published. Specification can
404
+ # be found here:
405
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md
406
+ # @param json_message [::String]
407
+ # The JSON format of the CloudEvent being published. Specification can be
408
+ # found here:
409
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
410
+ # @param avro_message [::String]
411
+ # The Avro format of the CloudEvent being published. Specification can
412
+ # be found here:
413
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md
414
+ # @yield [result, operation] Access the result along with the TransportOperation object
415
+ # @yieldparam result [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
416
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
417
+ #
418
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
419
+ #
420
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
421
+ #
422
+ # @example Basic example
423
+ # require "google/cloud/eventarc/publishing/v1"
424
+ #
425
+ # # Create a client object. The client can be reused for multiple calls.
426
+ # client = Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new
427
+ #
428
+ # # Create a request. To set request fields, pass in keyword arguments.
429
+ # request = Google::Cloud::Eventarc::Publishing::V1::PublishRequest.new
430
+ #
431
+ # # Call the publish method.
432
+ # result = client.publish request
433
+ #
434
+ # # The returned object is of type Google::Cloud::Eventarc::Publishing::V1::PublishResponse.
435
+ # p result
436
+ #
437
+ def publish request, options = nil
438
+ raise ::ArgumentError, "request must be provided" if request.nil?
439
+
440
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::Publishing::V1::PublishRequest
441
+
442
+ # Converts hash and nil to an options object
443
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
444
+
445
+ # Customize the options with defaults
446
+ call_metadata = @config.rpcs.publish.metadata.to_h
447
+
448
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
449
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
450
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
451
+ gapic_version: ::Google::Cloud::Eventarc::Publishing::V1::VERSION,
452
+ transports_version_send: [:rest]
453
+
454
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
455
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
+
457
+ options.apply_defaults timeout: @config.rpcs.publish.timeout,
458
+ metadata: call_metadata,
459
+ retry_policy: @config.rpcs.publish.retry_policy
460
+
461
+ options.apply_defaults timeout: @config.timeout,
462
+ metadata: @config.metadata,
463
+ retry_policy: @config.retry_policy
464
+
465
+ @publisher_stub.publish request, options do |result, operation|
466
+ yield result, operation if block_given?
356
467
  end
357
468
  rescue ::Gapic::Rest::Error => e
358
469
  raise ::Google::Cloud::Error.from_error(e)
@@ -432,6 +543,11 @@ module Google
432
543
  # default endpoint URL. The default value of nil uses the environment
433
544
  # universe (usually the default "googleapis.com" universe).
434
545
  # @return [::String,nil]
546
+ # @!attribute [rw] logger
547
+ # A custom logger to use for request/response debug logging, or the value
548
+ # `:default` (the default) to construct a default logger, or `nil` to
549
+ # explicitly disable logging.
550
+ # @return [::Logger,:default,nil]
435
551
  #
436
552
  class Configuration
437
553
  extend ::Gapic::Config
@@ -453,6 +569,7 @@ module Google
453
569
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
454
570
  config_attr :quota_project, nil, ::String, nil
455
571
  config_attr :universe_domain, nil, ::String, nil
572
+ config_attr :logger, :default, ::Logger, nil, :default
456
573
 
457
574
  # @private
458
575
  def initialize parent_config = nil
@@ -501,6 +618,11 @@ module Google
501
618
  # @return [::Gapic::Config::Method]
502
619
  #
503
620
  attr_reader :publish_events
621
+ ##
622
+ # RPC-specific configuration for `publish`
623
+ # @return [::Gapic::Config::Method]
624
+ #
625
+ attr_reader :publish
504
626
 
505
627
  # @private
506
628
  def initialize parent_rpcs = nil
@@ -508,6 +630,8 @@ module Google
508
630
  @publish_channel_connection_events = ::Gapic::Config::Method.new publish_channel_connection_events_config
509
631
  publish_events_config = parent_rpcs.publish_events if parent_rpcs.respond_to? :publish_events
510
632
  @publish_events = ::Gapic::Config::Method.new publish_events_config
633
+ publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
634
+ @publish = ::Gapic::Config::Method.new publish_config
511
635
 
512
636
  yield self if block_given?
513
637
  end
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the publish_channel_connection_events REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "publish_channel_connection_events",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -126,16 +140,58 @@ module Google
126
140
 
127
141
  response = @client_stub.make_http_request(
128
142
  verb,
129
- uri: uri,
130
- body: body || "",
131
- params: query_string_params,
143
+ uri: uri,
144
+ body: body || "",
145
+ params: query_string_params,
146
+ method_name: "publish_events",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse.decode_json response.body, ignore_unknown_fields: true
151
+ catch :response do
152
+ yield result, operation if block_given?
153
+ result
154
+ end
155
+ end
156
+
157
+ ##
158
+ # Baseline implementation for the publish REST call
159
+ #
160
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishRequest]
161
+ # A request object representing the call parameters. Required.
162
+ # @param options [::Gapic::CallOptions]
163
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
164
+ #
165
+ # @yield [result, operation] Access the result along with the TransportOperation object
166
+ # @yieldparam result [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
167
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
168
+ #
169
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::PublishResponse]
170
+ # A result object deserialized from the server's reply
171
+ def publish request_pb, options = nil
172
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
173
+
174
+ verb, uri, query_string_params, body = ServiceStub.transcode_publish_request request_pb
175
+ query_string_params = if query_string_params.any?
176
+ query_string_params.to_h { |p| p.split "=", 2 }
177
+ else
178
+ {}
179
+ end
136
180
 
137
- yield result, operation if block_given?
138
- result
181
+ response = @client_stub.make_http_request(
182
+ verb,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ method_name: "publish",
187
+ options: options
188
+ )
189
+ operation = ::Gapic::Rest::TransportOperation.new response
190
+ result = ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse.decode_json response.body, ignore_unknown_fields: true
191
+ catch :response do
192
+ yield result, operation if block_given?
193
+ result
194
+ end
139
195
  end
140
196
 
141
197
  ##
@@ -181,6 +237,28 @@ module Google
181
237
  )
182
238
  transcoder.transcode request_pb
183
239
  end
240
+
241
+ ##
242
+ # @private
243
+ #
244
+ # GRPC transcoding helper method for the publish REST call
245
+ #
246
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishRequest]
247
+ # A request object representing the call parameters. Required.
248
+ # @return [Array(String, [String, nil], Hash{String => String})]
249
+ # Uri, Body, Query string parameters
250
+ def self.transcode_publish_request request_pb
251
+ transcoder = Gapic::Rest::GrpcTranscoder.new
252
+ .with_bindings(
253
+ uri_method: :post,
254
+ uri_template: "/v1/{message_bus}:publish",
255
+ body: "*",
256
+ matches: [
257
+ ["message_bus", %r{^projects/[^/]+/locations/[^/]+/messageBuses/[^/]+/?$}, false]
258
+ ]
259
+ )
260
+ transcoder.transcode request_pb
261
+ end
184
262
  end
185
263
  end
186
264
  end
@@ -6,10 +6,13 @@ require 'google/protobuf'
6
6
 
7
7
  require 'google/api/annotations_pb'
8
8
  require 'google/api/client_pb'
9
+ require 'google/api/field_behavior_pb'
10
+ require 'google/api/field_info_pb'
11
+ require 'google/cloud/eventarc/publishing/v1/cloud_event_pb'
9
12
  require 'google/protobuf/any_pb'
10
13
 
11
14
 
12
- descriptor_data = "\n3google/cloud/eventarc/publishing/v1/publisher.proto\x12#google.cloud.eventarc.publishing.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x19google/protobuf/any.proto\"~\n%PublishChannelConnectionEventsRequest\x12\x1a\n\x12\x63hannel_connection\x18\x01 \x01(\t\x12$\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x14.google.protobuf.Any\x12\x13\n\x0btext_events\x18\x03 \x03(\t\"(\n&PublishChannelConnectionEventsResponse\"b\n\x14PublishEventsRequest\x12\x0f\n\x07\x63hannel\x18\x01 \x01(\t\x12$\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x14.google.protobuf.Any\x12\x13\n\x0btext_events\x18\x03 \x03(\t\"\x17\n\x15PublishEventsResponse2\xd0\x04\n\tPublisher\x12\x98\x02\n\x1ePublishChannelConnectionEvents\x12J.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsRequest\x1aK.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse\"]\x82\xd3\xe4\x93\x02W\"R/v1/{channel_connection=projects/*/locations/*/channelConnections/*}:publishEvents:\x01*\x12\xd0\x01\n\rPublishEvents\x12\x39.google.cloud.eventarc.publishing.v1.PublishEventsRequest\x1a:.google.cloud.eventarc.publishing.v1.PublishEventsResponse\"H\x82\xd3\xe4\x93\x02\x42\"=/v1/{channel=projects/*/locations/*/channels/*}:publishEvents:\x01*\x1aU\xca\x41!eventarcpublishing.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xfa\x01\n\'com.google.cloud.eventarc.publishing.v1B\x0ePublisherProtoP\x01ZGcloud.google.com/go/eventarc/publishing/apiv1/publishingpb;publishingpb\xaa\x02#Google.Cloud.Eventarc.Publishing.V1\xca\x02#Google\\Cloud\\Eventarc\\Publishing\\V1\xea\x02\'Google::Cloud::Eventarc::Publishing::V1b\x06proto3"
15
+ descriptor_data = "\n3google/cloud/eventarc/publishing/v1/publisher.proto\x12#google.cloud.eventarc.publishing.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/api/field_info.proto\x1a\x35google/cloud/eventarc/publishing/v1/cloud_event.proto\x1a\x19google/protobuf/any.proto\"~\n%PublishChannelConnectionEventsRequest\x12\x1a\n\x12\x63hannel_connection\x18\x01 \x01(\t\x12$\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x14.google.protobuf.Any\x12\x13\n\x0btext_events\x18\x03 \x03(\t\"(\n&PublishChannelConnectionEventsResponse\"b\n\x14PublishEventsRequest\x12\x0f\n\x07\x63hannel\x18\x01 \x01(\t\x12$\n\x06\x65vents\x18\x02 \x03(\x0b\x32\x14.google.protobuf.Any\x12\x13\n\x0btext_events\x18\x03 \x03(\t\"\x17\n\x15PublishEventsResponse\"\xae\x01\n\x0ePublishRequest\x12\x18\n\x0bmessage_bus\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12H\n\rproto_message\x18\x02 \x01(\x0b\x32/.google.cloud.eventarc.publishing.v1.CloudEventH\x00\x12\x16\n\x0cjson_message\x18\x03 \x01(\tH\x00\x12\x16\n\x0c\x61vro_message\x18\x04 \x01(\x0cH\x00\x42\x08\n\x06\x66ormat\"\x11\n\x0fPublishResponse2\x93\x06\n\tPublisher\x12\x98\x02\n\x1ePublishChannelConnectionEvents\x12J.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsRequest\x1aK.google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse\"]\x82\xd3\xe4\x93\x02W\"R/v1/{channel_connection=projects/*/locations/*/channelConnections/*}:publishEvents:\x01*\x12\xd0\x01\n\rPublishEvents\x12\x39.google.cloud.eventarc.publishing.v1.PublishEventsRequest\x1a:.google.cloud.eventarc.publishing.v1.PublishEventsResponse\"H\x82\xd3\xe4\x93\x02\x42\"=/v1/{channel=projects/*/locations/*/channels/*}:publishEvents:\x01*\x12\xc0\x01\n\x07Publish\x12\x33.google.cloud.eventarc.publishing.v1.PublishRequest\x1a\x34.google.cloud.eventarc.publishing.v1.PublishResponse\"J\x82\xd3\xe4\x93\x02\x44\"?/v1/{message_bus=projects/*/locations/*/messageBuses/*}:publish:\x01*\x1aU\xca\x41!eventarcpublishing.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xfa\x01\n\'com.google.cloud.eventarc.publishing.v1B\x0ePublisherProtoP\x01ZGcloud.google.com/go/eventarc/publishing/apiv1/publishingpb;publishingpb\xaa\x02#Google.Cloud.Eventarc.Publishing.V1\xca\x02#Google\\Cloud\\Eventarc\\Publishing\\V1\xea\x02\'Google::Cloud::Eventarc::Publishing::V1b\x06proto3"
13
16
 
14
17
  pool = Google::Protobuf::DescriptorPool.generated_pool
15
18
 
@@ -25,6 +28,7 @@ rescue TypeError
25
28
  warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
26
29
  imports = [
27
30
  ["google.protobuf.Any", "google/protobuf/any.proto"],
31
+ ["google.cloud.eventarc.publishing.v1.CloudEvent", "google/cloud/eventarc/publishing/v1/cloud_event.proto"],
28
32
  ]
29
33
  imports.each do |type_name, expected_filename|
30
34
  import_file = pool.lookup(type_name).file_descriptor
@@ -45,6 +49,8 @@ module Google
45
49
  PublishChannelConnectionEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse").msgclass
46
50
  PublishEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.PublishEventsRequest").msgclass
47
51
  PublishEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.PublishEventsResponse").msgclass
52
+ PublishRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.PublishRequest").msgclass
53
+ PublishResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.eventarc.publishing.v1.PublishResponse").msgclass
48
54
  end
49
55
  end
50
56
  end
@@ -14,6 +14,7 @@
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
+ #
17
18
 
18
19
  require 'grpc'
19
20
  require 'google/cloud/eventarc/publishing/v1/publisher_pb'
@@ -60,6 +61,8 @@ module Google
60
61
  rpc :PublishChannelConnectionEvents, ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsRequest, ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse
61
62
  # Publish events to a subscriber's channel.
62
63
  rpc :PublishEvents, ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest, ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse
64
+ # Publish events to a message bus.
65
+ rpc :Publish, ::Google::Cloud::Eventarc::Publishing::V1::PublishRequest, ::Google::Cloud::Eventarc::Publishing::V1::PublishResponse
63
66
  end
64
67
 
65
68
  Stub = Service.rpc_stub_class
@@ -22,7 +22,7 @@ module Google
22
22
  module Eventarc
23
23
  module Publishing
24
24
  module V1
25
- VERSION = "1.0.1"
25
+ VERSION = "1.2.0"
26
26
  end
27
27
  end
28
28
  end
@@ -28,6 +28,9 @@ module Google
28
28
  # @!attribute [rw] destinations
29
29
  # @return [::Array<::Google::Api::ClientLibraryDestination>]
30
30
  # The destination where API teams want this client library to be published.
31
+ # @!attribute [rw] selective_gapic_generation
32
+ # @return [::Google::Api::SelectiveGapicGeneration]
33
+ # Configuration for which RPCs should be generated in the GAPIC client.
31
34
  class CommonLanguageSettings
32
35
  include ::Google::Protobuf::MessageExts
33
36
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -212,6 +215,12 @@ module Google
212
215
  # enabled. By default, asynchronous REST clients will not be generated.
213
216
  # This feature will be enabled by default 1 month after launching the
214
217
  # feature in preview packages.
218
+ # @!attribute [rw] protobuf_pythonic_types_enabled
219
+ # @return [::Boolean]
220
+ # Enables generation of protobuf code using new types that are more
221
+ # Pythonic which are included in `protobuf>=5.29.x`. This feature will be
222
+ # enabled by default 1 month after launching the feature in preview
223
+ # packages.
215
224
  class ExperimentalFeatures
216
225
  include ::Google::Protobuf::MessageExts
217
226
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -297,9 +306,28 @@ module Google
297
306
  # @!attribute [rw] common
298
307
  # @return [::Google::Api::CommonLanguageSettings]
299
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
300
319
  class GoSettings
301
320
  include ::Google::Protobuf::MessageExts
302
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
303
331
  end
304
332
 
305
333
  # Describes the generator configuration for a method.
@@ -375,6 +403,17 @@ module Google
375
403
  end
376
404
  end
377
405
 
406
+ # This message is used to configure the generation of a subset of the RPCs in
407
+ # a service for client libraries.
408
+ # @!attribute [rw] methods
409
+ # @return [::Array<::String>]
410
+ # An allowlist of the fully qualified names of RPCs that should be included
411
+ # on public client surfaces.
412
+ class SelectiveGapicGeneration
413
+ include ::Google::Protobuf::MessageExts
414
+ extend ::Google::Protobuf::MessageExts::ClassMethods
415
+ end
416
+
378
417
  # The organization for which the client libraries are being published.
379
418
  # Affects the url where generated docs are published, etc.
380
419
  module ClientLibraryOrganization
@@ -0,0 +1,85 @@
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 Api
22
+ # An indicator of the behavior of a given field (for example, that a field
23
+ # is required in requests, or given as output but ignored as input).
24
+ # This **does not** change the behavior in protocol buffers itself; it only
25
+ # denotes the behavior and may affect how API tooling handles the field.
26
+ #
27
+ # Note: This enum **may** receive new values in the future.
28
+ module FieldBehavior
29
+ # Conventional default for enums. Do not use this.
30
+ FIELD_BEHAVIOR_UNSPECIFIED = 0
31
+
32
+ # Specifically denotes a field as optional.
33
+ # While all fields in protocol buffers are optional, this may be specified
34
+ # for emphasis if appropriate.
35
+ OPTIONAL = 1
36
+
37
+ # Denotes a field as required.
38
+ # This indicates that the field **must** be provided as part of the request,
39
+ # and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
40
+ REQUIRED = 2
41
+
42
+ # Denotes a field as output only.
43
+ # This indicates that the field is provided in responses, but including the
44
+ # field in a request does nothing (the server *must* ignore it and
45
+ # *must not* throw an error as a result of the field's presence).
46
+ OUTPUT_ONLY = 3
47
+
48
+ # Denotes a field as input only.
49
+ # This indicates that the field is provided in requests, and the
50
+ # corresponding field is not included in output.
51
+ INPUT_ONLY = 4
52
+
53
+ # Denotes a field as immutable.
54
+ # This indicates that the field may be set once in a request to create a
55
+ # resource, but may not be changed thereafter.
56
+ IMMUTABLE = 5
57
+
58
+ # Denotes that a (repeated) field is an unordered list.
59
+ # This indicates that the service may provide the elements of the list
60
+ # in any arbitrary order, rather than the order the user originally
61
+ # provided. Additionally, the list's order may or may not be stable.
62
+ UNORDERED_LIST = 6
63
+
64
+ # Denotes that this field returns a non-empty default value if not set.
65
+ # This indicates that if the user provides the empty value in a request,
66
+ # a non-empty value will be returned. The user will not be aware of what
67
+ # non-empty value to expect.
68
+ NON_EMPTY_DEFAULT = 7
69
+
70
+ # Denotes that the field in a resource (a message annotated with
71
+ # google.api.resource) is used in the resource name to uniquely identify the
72
+ # resource. For AIP-compliant APIs, this should only be applied to the
73
+ # `name` field on the resource.
74
+ #
75
+ # This behavior should not be applied to references to other resources within
76
+ # the message.
77
+ #
78
+ # The identifier field of resources often have different field behavior
79
+ # depending on the request it is embedded in (e.g. for Create methods name
80
+ # is optional and unused, while for Update methods it is required). Instead
81
+ # of method-specific annotations, only `IDENTIFIER` is required.
82
+ IDENTIFIER = 8
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,88 @@
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 Api
22
+ # Rich semantic information of an API field beyond basic typing.
23
+ # @!attribute [rw] format
24
+ # @return [::Google::Api::FieldInfo::Format]
25
+ # The standard format of a field value. This does not explicitly configure
26
+ # any API consumer, just documents the API's format for the field it is
27
+ # applied to.
28
+ # @!attribute [rw] referenced_types
29
+ # @return [::Array<::Google::Api::TypeReference>]
30
+ # The type(s) that the annotated, generic field may represent.
31
+ #
32
+ # Currently, this must only be used on fields of type `google.protobuf.Any`.
33
+ # Supporting other generic types may be considered in the future.
34
+ class FieldInfo
35
+ include ::Google::Protobuf::MessageExts
36
+ extend ::Google::Protobuf::MessageExts::ClassMethods
37
+
38
+ # The standard format of a field value. The supported formats are all backed
39
+ # by either an RFC defined by the IETF or a Google-defined AIP.
40
+ module Format
41
+ # Default, unspecified value.
42
+ FORMAT_UNSPECIFIED = 0
43
+
44
+ # Universally Unique Identifier, version 4, value as defined by
45
+ # https://datatracker.ietf.org/doc/html/rfc4122. The value may be
46
+ # normalized to entirely lowercase letters. For example, the value
47
+ # `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to
48
+ # `f47ac10b-58cc-0372-8567-0e02b2c3d479`.
49
+ UUID4 = 1
50
+
51
+ # Internet Protocol v4 value as defined by [RFC
52
+ # 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be
53
+ # condensed, with leading zeros in each octet stripped. For example,
54
+ # `001.022.233.040` would be condensed to `1.22.233.40`.
55
+ IPV4 = 2
56
+
57
+ # Internet Protocol v6 value as defined by [RFC
58
+ # 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be
59
+ # normalized to entirely lowercase letters with zeros compressed, following
60
+ # [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example,
61
+ # the value `2001:0DB8:0::0` would be normalized to `2001:db8::`.
62
+ IPV6 = 3
63
+
64
+ # An IP address in either v4 or v6 format as described by the individual
65
+ # values defined herein. See the comments on the IPV4 and IPV6 types for
66
+ # allowed normalizations of each.
67
+ IPV4_OR_IPV6 = 4
68
+ end
69
+ end
70
+
71
+ # A reference to a message type, for use in {::Google::Api::FieldInfo FieldInfo}.
72
+ # @!attribute [rw] type_name
73
+ # @return [::String]
74
+ # The name of the type that the annotated, generic field may represent.
75
+ # If the type is in the same protobuf package, the value can be the simple
76
+ # message name e.g., `"MyMessage"`. Otherwise, the value must be the
77
+ # fully-qualified message name e.g., `"google.library.v1.Book"`.
78
+ #
79
+ # If the type(s) are unknown to the service (e.g. the field accepts generic
80
+ # user input), use the wildcard `"*"` to denote this behavior.
81
+ #
82
+ # See [AIP-202](https://google.aip.dev/202#type-references) for more details.
83
+ class TypeReference
84
+ include ::Google::Protobuf::MessageExts
85
+ extend ::Google::Protobuf::MessageExts::ClassMethods
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,99 @@
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 Eventarc
23
+ module Publishing
24
+ module V1
25
+ # CloudEvent represents a vendor-neutral specification for defining the format
26
+ # of event data.
27
+ # @!attribute [rw] id
28
+ # @return [::String]
29
+ # Required. Identifies the event. Producers MUST ensure that source + id is
30
+ # unique for each distinct event.
31
+ # @!attribute [rw] source
32
+ # @return [::String]
33
+ # Required. Identifies the context in which an event happened.
34
+ # URI-reference
35
+ # @!attribute [rw] spec_version
36
+ # @return [::String]
37
+ # Required. The version of the CloudEvents specification which the event
38
+ # uses.
39
+ # @!attribute [rw] type
40
+ # @return [::String]
41
+ # Required. This attribute contains a value describing the type of event
42
+ # related to the originating occurrence.
43
+ # @!attribute [rw] attributes
44
+ # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Eventarc::Publishing::V1::CloudEvent::CloudEventAttributeValue}]
45
+ # Optional. Used for Optional & Extension Attributes
46
+ # @!attribute [rw] binary_data
47
+ # @return [::String]
48
+ # Optional. Binary data.
49
+ # @!attribute [rw] text_data
50
+ # @return [::String]
51
+ # Optional. Text data.
52
+ # @!attribute [rw] proto_data
53
+ # @return [::Google::Protobuf::Any]
54
+ # Optional. Proto data.
55
+ class CloudEvent
56
+ include ::Google::Protobuf::MessageExts
57
+ extend ::Google::Protobuf::MessageExts::ClassMethods
58
+
59
+ # The following abstract data types are available for use in attributes.
60
+ # @!attribute [rw] ce_boolean
61
+ # @return [::Boolean]
62
+ # Boolean value.
63
+ # @!attribute [rw] ce_integer
64
+ # @return [::Integer]
65
+ # Integer value.
66
+ # @!attribute [rw] ce_string
67
+ # @return [::String]
68
+ # String value.
69
+ # @!attribute [rw] ce_bytes
70
+ # @return [::String]
71
+ # Bytes value.
72
+ # @!attribute [rw] ce_uri
73
+ # @return [::String]
74
+ # URI value.
75
+ # @!attribute [rw] ce_uri_ref
76
+ # @return [::String]
77
+ # URI-reference value.
78
+ # @!attribute [rw] ce_timestamp
79
+ # @return [::Google::Protobuf::Timestamp]
80
+ # Timestamp value.
81
+ class CloudEventAttributeValue
82
+ include ::Google::Protobuf::MessageExts
83
+ extend ::Google::Protobuf::MessageExts::ClassMethods
84
+ end
85
+
86
+ # @!attribute [rw] key
87
+ # @return [::String]
88
+ # @!attribute [rw] value
89
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::CloudEvent::CloudEventAttributeValue]
90
+ class AttributesEntry
91
+ include ::Google::Protobuf::MessageExts
92
+ extend ::Google::Protobuf::MessageExts::ClassMethods
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -75,6 +75,37 @@ module Google
75
75
  include ::Google::Protobuf::MessageExts
76
76
  extend ::Google::Protobuf::MessageExts::ClassMethods
77
77
  end
78
+
79
+ # The request message for the Publish method.
80
+ # @!attribute [rw] message_bus
81
+ # @return [::String]
82
+ # Required. The full name of the message bus to publish events to. Format:
83
+ # `projects/{project}/locations/{location}/messageBuses/{messageBus}`.
84
+ # @!attribute [rw] proto_message
85
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::CloudEvent]
86
+ # The Protobuf format of the CloudEvent being published. Specification can
87
+ # be found here:
88
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md
89
+ # @!attribute [rw] json_message
90
+ # @return [::String]
91
+ # The JSON format of the CloudEvent being published. Specification can be
92
+ # found here:
93
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md
94
+ # @!attribute [rw] avro_message
95
+ # @return [::String]
96
+ # The Avro format of the CloudEvent being published. Specification can
97
+ # be found here:
98
+ # https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md
99
+ class PublishRequest
100
+ include ::Google::Protobuf::MessageExts
101
+ extend ::Google::Protobuf::MessageExts::ClassMethods
102
+ end
103
+
104
+ # The response message for the Publish method.
105
+ class PublishResponse
106
+ include ::Google::Protobuf::MessageExts
107
+ extend ::Google::Protobuf::MessageExts::ClassMethods
108
+ end
78
109
  end
79
110
  end
80
111
  end
@@ -0,0 +1,127 @@
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 Timestamp represents a point in time independent of any time zone or local
23
+ # calendar, encoded as a count of seconds and fractions of seconds at
24
+ # nanosecond resolution. The count is relative to an epoch at UTC midnight on
25
+ # January 1, 1970, in the proleptic Gregorian calendar which extends the
26
+ # Gregorian calendar backwards to year one.
27
+ #
28
+ # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
29
+ # second table is needed for interpretation, using a [24-hour linear
30
+ # smear](https://developers.google.com/time/smear).
31
+ #
32
+ # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
33
+ # restricting to that range, we ensure that we can convert to and from [RFC
34
+ # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
35
+ #
36
+ # # Examples
37
+ #
38
+ # Example 1: Compute Timestamp from POSIX `time()`.
39
+ #
40
+ # Timestamp timestamp;
41
+ # timestamp.set_seconds(time(NULL));
42
+ # timestamp.set_nanos(0);
43
+ #
44
+ # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
45
+ #
46
+ # struct timeval tv;
47
+ # gettimeofday(&tv, NULL);
48
+ #
49
+ # Timestamp timestamp;
50
+ # timestamp.set_seconds(tv.tv_sec);
51
+ # timestamp.set_nanos(tv.tv_usec * 1000);
52
+ #
53
+ # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
54
+ #
55
+ # FILETIME ft;
56
+ # GetSystemTimeAsFileTime(&ft);
57
+ # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
58
+ #
59
+ # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
60
+ # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
61
+ # Timestamp timestamp;
62
+ # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
63
+ # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
64
+ #
65
+ # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
66
+ #
67
+ # long millis = System.currentTimeMillis();
68
+ #
69
+ # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
70
+ # .setNanos((int) ((millis % 1000) * 1000000)).build();
71
+ #
72
+ # Example 5: Compute Timestamp from Java `Instant.now()`.
73
+ #
74
+ # Instant now = Instant.now();
75
+ #
76
+ # Timestamp timestamp =
77
+ # Timestamp.newBuilder().setSeconds(now.getEpochSecond())
78
+ # .setNanos(now.getNano()).build();
79
+ #
80
+ # Example 6: Compute Timestamp from current time in Python.
81
+ #
82
+ # timestamp = Timestamp()
83
+ # timestamp.GetCurrentTime()
84
+ #
85
+ # # JSON Mapping
86
+ #
87
+ # In JSON format, the Timestamp type is encoded as a string in the
88
+ # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
89
+ # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
90
+ # where \\{year} is always expressed using four digits while \\{month}, \\{day},
91
+ # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
92
+ # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
93
+ # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
94
+ # is required. A proto3 JSON serializer should always use UTC (as indicated by
95
+ # "Z") when printing the Timestamp type and a proto3 JSON parser should be
96
+ # able to accept both UTC and other timezones (as indicated by an offset).
97
+ #
98
+ # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
99
+ # 01:30 UTC on January 15, 2017.
100
+ #
101
+ # In JavaScript, one can convert a Date object to this format using the
102
+ # standard
103
+ # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
104
+ # method. In Python, a standard `datetime.datetime` object can be converted
105
+ # to this format using
106
+ # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
107
+ # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
108
+ # the Joda Time's [`ISODateTimeFormat.dateTime()`](
109
+ # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
110
+ # ) to obtain a formatter capable of generating timestamps in this format.
111
+ # @!attribute [rw] seconds
112
+ # @return [::Integer]
113
+ # Represents seconds of UTC time since Unix epoch
114
+ # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
115
+ # 9999-12-31T23:59:59Z inclusive.
116
+ # @!attribute [rw] nanos
117
+ # @return [::Integer]
118
+ # Non-negative fractions of a second at nanosecond resolution. Negative
119
+ # second values with fractions must still have non-negative nanos values
120
+ # that count forward in time. Must be from 0 to 999,999,999
121
+ # inclusive.
122
+ class Timestamp
123
+ include ::Google::Protobuf::MessageExts
124
+ extend ::Google::Protobuf::MessageExts::ClassMethods
125
+ end
126
+ end
127
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-eventarc-publishing-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-30 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -62,6 +62,7 @@ files:
62
62
  - README.md
63
63
  - lib/google-cloud-eventarc-publishing-v1.rb
64
64
  - lib/google/cloud/eventarc/publishing/v1.rb
65
+ - lib/google/cloud/eventarc/publishing/v1/cloud_event_pb.rb
65
66
  - lib/google/cloud/eventarc/publishing/v1/publisher.rb
66
67
  - lib/google/cloud/eventarc/publishing/v1/publisher/client.rb
67
68
  - lib/google/cloud/eventarc/publishing/v1/publisher/credentials.rb
@@ -74,11 +75,15 @@ files:
74
75
  - lib/google/cloud/eventarc/publishing/v1/version.rb
75
76
  - proto_docs/README.md
76
77
  - proto_docs/google/api/client.rb
78
+ - proto_docs/google/api/field_behavior.rb
79
+ - proto_docs/google/api/field_info.rb
77
80
  - proto_docs/google/api/launch_stage.rb
78
81
  - proto_docs/google/api/resource.rb
82
+ - proto_docs/google/cloud/eventarc/publishing/v1/cloud_event.rb
79
83
  - proto_docs/google/cloud/eventarc/publishing/v1/publisher.rb
80
84
  - proto_docs/google/protobuf/any.rb
81
85
  - proto_docs/google/protobuf/duration.rb
86
+ - proto_docs/google/protobuf/timestamp.rb
82
87
  homepage: https://github.com/googleapis/google-cloud-ruby
83
88
  licenses:
84
89
  - Apache-2.0
@@ -98,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
103
  - !ruby/object:Gem::Version
99
104
  version: '0'
100
105
  requirements: []
101
- rubygems_version: 3.5.6
106
+ rubygems_version: 3.5.23
102
107
  signing_key:
103
108
  specification_version: 4
104
- summary: API Client library for the Eventarc Publishing V1 API
109
+ summary: Processes events generated by an event provider and delivers them to a subscriber.
105
110
  test_files: []