google-cloud-eventarc-publishing-v1 0.4.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,170 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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
+ require "google/cloud/eventarc/publishing/v1/publisher_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Eventarc
24
+ module Publishing
25
+ module V1
26
+ module Publisher
27
+ module Rest
28
+ ##
29
+ # REST service stub for the Publisher service.
30
+ # Service stub contains baseline method implementations
31
+ # including transcoding, making the REST call, and deserialing the response.
32
+ #
33
+ class ServiceStub
34
+ def initialize endpoint:, credentials:
35
+ # These require statements are intentionally placed here to initialize
36
+ # the REST modules only when it's required.
37
+ require "gapic/rest"
38
+
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
40
+ numeric_enums: true,
41
+ raise_faraday_errors: false
42
+ end
43
+
44
+ ##
45
+ # Baseline implementation for the publish_channel_connection_events REST call
46
+ #
47
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsRequest]
48
+ # A request object representing the call parameters. Required.
49
+ # @param options [::Gapic::CallOptions]
50
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
51
+ #
52
+ # @yield [result, operation] Access the result along with the TransportOperation object
53
+ # @yieldparam result [::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse]
54
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
55
+ #
56
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse]
57
+ # A result object deserialized from the server's reply
58
+ def publish_channel_connection_events request_pb, options = nil
59
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
60
+
61
+ verb, uri, query_string_params, body = ServiceStub.transcode_publish_channel_connection_events_request request_pb
62
+ query_string_params = if query_string_params.any?
63
+ query_string_params.to_h { |p| p.split "=", 2 }
64
+ else
65
+ {}
66
+ end
67
+
68
+ response = @client_stub.make_http_request(
69
+ verb,
70
+ uri: uri,
71
+ body: body || "",
72
+ params: query_string_params,
73
+ options: options
74
+ )
75
+ operation = ::Gapic::Rest::TransportOperation.new response
76
+ result = ::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsResponse.decode_json response.body, ignore_unknown_fields: true
77
+
78
+ yield result, operation if block_given?
79
+ result
80
+ end
81
+
82
+ ##
83
+ # Baseline implementation for the publish_events REST call
84
+ #
85
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest]
86
+ # A request object representing the call parameters. Required.
87
+ # @param options [::Gapic::CallOptions]
88
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
89
+ #
90
+ # @yield [result, operation] Access the result along with the TransportOperation object
91
+ # @yieldparam result [::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse]
92
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
93
+ #
94
+ # @return [::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse]
95
+ # A result object deserialized from the server's reply
96
+ def publish_events request_pb, options = nil
97
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
98
+
99
+ verb, uri, query_string_params, body = ServiceStub.transcode_publish_events_request request_pb
100
+ query_string_params = if query_string_params.any?
101
+ query_string_params.to_h { |p| p.split "=", 2 }
102
+ else
103
+ {}
104
+ end
105
+
106
+ response = @client_stub.make_http_request(
107
+ verb,
108
+ uri: uri,
109
+ body: body || "",
110
+ params: query_string_params,
111
+ options: options
112
+ )
113
+ operation = ::Gapic::Rest::TransportOperation.new response
114
+ result = ::Google::Cloud::Eventarc::Publishing::V1::PublishEventsResponse.decode_json response.body, ignore_unknown_fields: true
115
+
116
+ yield result, operation if block_given?
117
+ result
118
+ end
119
+
120
+ ##
121
+ # @private
122
+ #
123
+ # GRPC transcoding helper method for the publish_channel_connection_events REST call
124
+ #
125
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishChannelConnectionEventsRequest]
126
+ # A request object representing the call parameters. Required.
127
+ # @return [Array(String, [String, nil], Hash{String => String})]
128
+ # Uri, Body, Query string parameters
129
+ def self.transcode_publish_channel_connection_events_request request_pb
130
+ transcoder = Gapic::Rest::GrpcTranscoder.new
131
+ .with_bindings(
132
+ uri_method: :post,
133
+ uri_template: "/v1/{channel_connection}:publishEvents",
134
+ body: "*",
135
+ matches: [
136
+ ["channel_connection", %r{^projects/[^/]+/locations/[^/]+/channelConnections/[^/]+/?$}, false]
137
+ ]
138
+ )
139
+ transcoder.transcode request_pb
140
+ end
141
+
142
+ ##
143
+ # @private
144
+ #
145
+ # GRPC transcoding helper method for the publish_events REST call
146
+ #
147
+ # @param request_pb [::Google::Cloud::Eventarc::Publishing::V1::PublishEventsRequest]
148
+ # A request object representing the call parameters. Required.
149
+ # @return [Array(String, [String, nil], Hash{String => String})]
150
+ # Uri, Body, Query string parameters
151
+ def self.transcode_publish_events_request request_pb
152
+ transcoder = Gapic::Rest::GrpcTranscoder.new
153
+ .with_bindings(
154
+ uri_method: :post,
155
+ uri_template: "/v1/{channel}:publishEvents",
156
+ body: "*",
157
+ matches: [
158
+ ["channel", %r{^projects/[^/]+/locations/[^/]+/channels/[^/]+/?$}, false]
159
+ ]
160
+ )
161
+ transcoder.transcode request_pb
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/eventarc/publishing/v1/version"
24
+
25
+ require "google/cloud/eventarc/publishing/v1/publisher/credentials"
26
+ require "google/cloud/eventarc/publishing/v1/publisher/rest/client"
27
+
28
+ module Google
29
+ module Cloud
30
+ module Eventarc
31
+ module Publishing
32
+ module V1
33
+ ##
34
+ # Eventarc processes events generated by an event provider and delivers them to
35
+ # a subscriber.
36
+ #
37
+ # An event provider is a software-as-a-service (SaaS) system or
38
+ # product that can generate and deliver events through Eventarc.
39
+ #
40
+ # A third-party event provider is an event provider from outside of Google.
41
+ #
42
+ # A partner is a third-party event provider that is integrated with Eventarc.
43
+ #
44
+ # A subscriber is a GCP customer interested in receiving events.
45
+ #
46
+ # Channel is a first-class Eventarc resource that is created and managed
47
+ # by the subscriber in their GCP project. A Channel represents a subscriber's
48
+ # intent to receive events from an event provider. A Channel is associated with
49
+ # exactly one event provider.
50
+ #
51
+ # ChannelConnection is a first-class Eventarc resource that
52
+ # is created and managed by the partner in their GCP project. A
53
+ # ChannelConnection represents a connection between a partner and a
54
+ # subscriber's Channel. A ChannelConnection has a one-to-one mapping with a
55
+ # Channel.
56
+ #
57
+ # Publisher allows an event provider to publish events to Eventarc.
58
+ #
59
+ # To load this service and instantiate a REST client:
60
+ #
61
+ # require "google/cloud/eventarc/publishing/v1/publisher/rest"
62
+ # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new
63
+ #
64
+ module Publisher
65
+ # Client for the REST transport
66
+ module Rest
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
76
+ require "google/cloud/eventarc/publishing/v1/publisher/rest/helpers" if ::File.file? helper_path
@@ -24,6 +24,7 @@ require "google/cloud/eventarc/publishing/v1/version"
24
24
 
25
25
  require "google/cloud/eventarc/publishing/v1/publisher/credentials"
26
26
  require "google/cloud/eventarc/publishing/v1/publisher/client"
27
+ require "google/cloud/eventarc/publishing/v1/publisher/rest"
27
28
 
28
29
  module Google
29
30
  module Cloud
@@ -56,11 +57,16 @@ module Google
56
57
  #
57
58
  # Publisher allows an event provider to publish events to Eventarc.
58
59
  #
59
- # To load this service and instantiate a client:
60
+ # @example Load this service and instantiate a gRPC client
60
61
  #
61
62
  # require "google/cloud/eventarc/publishing/v1/publisher"
62
63
  # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new
63
64
  #
65
+ # @example Load this service and instantiate a REST client
66
+ #
67
+ # require "google/cloud/eventarc/publishing/v1/publisher/rest"
68
+ # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new
69
+ #
64
70
  module Publisher
65
71
  end
66
72
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: google/cloud/eventarc/publishing/v1/publisher.proto
3
4
 
@@ -7,23 +8,32 @@ require 'google/api/annotations_pb'
7
8
  require 'google/api/client_pb'
8
9
  require 'google/protobuf/any_pb'
9
10
 
10
- Google::Protobuf::DescriptorPool.generated_pool.build do
11
- add_file("google/cloud/eventarc/publishing/v1/publisher.proto", :syntax => :proto3) do
12
- add_message "google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsRequest" do
13
- optional :channel_connection, :string, 1
14
- repeated :events, :message, 2, "google.protobuf.Any"
15
- repeated :text_events, :string, 3
16
- end
17
- add_message "google.cloud.eventarc.publishing.v1.PublishChannelConnectionEventsResponse" do
18
- end
19
- add_message "google.cloud.eventarc.publishing.v1.PublishEventsRequest" do
20
- optional :channel, :string, 1
21
- repeated :events, :message, 2, "google.protobuf.Any"
22
- repeated :text_events, :string, 3
23
- end
24
- add_message "google.cloud.eventarc.publishing.v1.PublishEventsResponse" do
11
+
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"
13
+
14
+ pool = Google::Protobuf::DescriptorPool.generated_pool
15
+
16
+ begin
17
+ pool.add_serialized_file(descriptor_data)
18
+ rescue TypeError => e
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
+ ]
29
+ imports.each do |type_name, expected_filename|
30
+ import_file = pool.lookup(type_name).file_descriptor
31
+ if import_file.name != expected_filename
32
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
25
33
  end
26
34
  end
35
+ warn "Each proto file must use a consistent fully-qualified name."
36
+ warn "This will become an error in the next major version."
27
37
  end
28
38
 
29
39
  module Google
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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
+ require "google/cloud/eventarc/publishing/v1/publisher/rest"
20
+ require "google/cloud/eventarc/publishing/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Eventarc
25
+ module Publishing
26
+ ##
27
+ # To load just the REST part of this package, including all its services, and instantiate a REST client:
28
+ #
29
+ # @example
30
+ #
31
+ # require "google/cloud/eventarc/publishing/v1/rest"
32
+ # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new
33
+ #
34
+ module V1
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -22,7 +22,7 @@ module Google
22
22
  module Eventarc
23
23
  module Publishing
24
24
  module V1
25
- VERSION = "0.4.0"
25
+ VERSION = "0.6.0"
26
26
  end
27
27
  end
28
28
  end
@@ -24,13 +24,18 @@ module Google
24
24
  module Eventarc
25
25
  module Publishing
26
26
  ##
27
- # To load this package, including all its services, and instantiate a client:
27
+ # API client module.
28
28
  #
29
- # @example
29
+ # @example Load this package, including all its services, and instantiate a gRPC client
30
30
  #
31
31
  # require "google/cloud/eventarc/publishing/v1"
32
32
  # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Client.new
33
33
  #
34
+ # @example Load this package, including all its services, and instantiate a REST client
35
+ #
36
+ # require "google/cloud/eventarc/publishing/v1"
37
+ # client = ::Google::Cloud::Eventarc::Publishing::V1::Publisher::Rest::Client.new
38
+ #
34
39
  module V1
35
40
  end
36
41
  end