google-cloud-eventarc-v1 0.1.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.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ # This gem does not autoload during Bundler.require. To load this gem,
20
+ # issue explicit require statements for the packages desired, e.g.:
21
+ # require "google/cloud/eventarc/v1"
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/v1/eventarc"
20
+ require "google/cloud/eventarc/v1/version"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Eventarc
25
+ ##
26
+ # To load this package, including all its services, and instantiate a client:
27
+ #
28
+ # require "google/cloud/eventarc/v1"
29
+ # client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new
30
+ #
31
+ module V1
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/eventarc/v1/_helpers" if ::File.file? helper_path
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/eventarc/v1/version"
24
+
25
+ require "google/cloud/eventarc/v1/eventarc/credentials"
26
+ require "google/cloud/eventarc/v1/eventarc/paths"
27
+ require "google/cloud/eventarc/v1/eventarc/operations"
28
+ require "google/cloud/eventarc/v1/eventarc/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Eventarc
33
+ module V1
34
+ ##
35
+ # Eventarc allows users to subscribe to various events that are provided by
36
+ # Google Cloud services and forward them to supported destinations.
37
+ #
38
+ # To load this service and instantiate a client:
39
+ #
40
+ # require "google/cloud/eventarc/v1/eventarc"
41
+ # client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new
42
+ #
43
+ module Eventarc
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ helper_path = ::File.join __dir__, "eventarc", "helpers.rb"
51
+ require "google/cloud/eventarc/v1/eventarc/helpers" if ::File.file? helper_path
@@ -0,0 +1,724 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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/errors"
20
+ require "google/cloud/eventarc/v1/eventarc_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Eventarc
25
+ module V1
26
+ module Eventarc
27
+ ##
28
+ # Client for the Eventarc service.
29
+ #
30
+ # Eventarc allows users to subscribe to various events that are provided by
31
+ # Google Cloud services and forward them to supported destinations.
32
+ #
33
+ class Client
34
+ include Paths
35
+
36
+ # @private
37
+ attr_reader :eventarc_stub
38
+
39
+ ##
40
+ # Configure the Eventarc Client class.
41
+ #
42
+ # See {::Google::Cloud::Eventarc::V1::Eventarc::Client::Configuration}
43
+ # for a description of the configuration fields.
44
+ #
45
+ # ## Example
46
+ #
47
+ # To modify the configuration for all Eventarc clients:
48
+ #
49
+ # ::Google::Cloud::Eventarc::V1::Eventarc::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Eventarc", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config
70
+ end
71
+ yield @configure if block_given?
72
+ @configure
73
+ end
74
+
75
+ ##
76
+ # Configure the Eventarc Client instance.
77
+ #
78
+ # The configuration is set to the derived mode, meaning that values can be changed,
79
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
80
+ # should be made on {Client.configure}.
81
+ #
82
+ # See {::Google::Cloud::Eventarc::V1::Eventarc::Client::Configuration}
83
+ # for a description of the configuration fields.
84
+ #
85
+ # @yield [config] Configure the Client client.
86
+ # @yieldparam config [Client::Configuration]
87
+ #
88
+ # @return [Client::Configuration]
89
+ #
90
+ def configure
91
+ yield @config if block_given?
92
+ @config
93
+ end
94
+
95
+ ##
96
+ # Create a new Eventarc client object.
97
+ #
98
+ # ## Examples
99
+ #
100
+ # To create a new Eventarc client with the default
101
+ # configuration:
102
+ #
103
+ # client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new
104
+ #
105
+ # To create a new Eventarc client with a custom
106
+ # configuration:
107
+ #
108
+ # client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new do |config|
109
+ # config.timeout = 10.0
110
+ # end
111
+ #
112
+ # @yield [config] Configure the Eventarc client.
113
+ # @yieldparam config [Client::Configuration]
114
+ #
115
+ def initialize
116
+ # These require statements are intentionally placed here to initialize
117
+ # the gRPC module only when it's required.
118
+ # See https://github.com/googleapis/toolkit/issues/446
119
+ require "gapic/grpc"
120
+ require "google/cloud/eventarc/v1/eventarc_services_pb"
121
+
122
+ # Create the configuration object
123
+ @config = Configuration.new Client.configure
124
+
125
+ # Yield the configuration if needed
126
+ yield @config if block_given?
127
+
128
+ # Create credentials
129
+ credentials = @config.credentials
130
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
131
+ # but only if the default endpoint does not have a region prefix.
132
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
133
+ @config.endpoint == Client.configure.endpoint &&
134
+ !@config.endpoint.split(".").first.include?("-")
135
+ credentials ||= Credentials.default scope: @config.scope,
136
+ enable_self_signed_jwt: enable_self_signed_jwt
137
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
138
+ credentials = Credentials.new credentials, scope: @config.scope
139
+ end
140
+ @quota_project_id = @config.quota_project
141
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
142
+
143
+ @operations_client = Operations.new do |config|
144
+ config.credentials = credentials
145
+ config.endpoint = @config.endpoint
146
+ end
147
+
148
+ @eventarc_stub = ::Gapic::ServiceStub.new(
149
+ ::Google::Cloud::Eventarc::V1::Eventarc::Stub,
150
+ credentials: credentials,
151
+ endpoint: @config.endpoint,
152
+ channel_args: @config.channel_args,
153
+ interceptors: @config.interceptors
154
+ )
155
+ end
156
+
157
+ ##
158
+ # Get the associated client for long-running operations.
159
+ #
160
+ # @return [::Google::Cloud::Eventarc::V1::Eventarc::Operations]
161
+ #
162
+ attr_reader :operations_client
163
+
164
+ # Service calls
165
+
166
+ ##
167
+ # Get a single trigger.
168
+ #
169
+ # @overload get_trigger(request, options = nil)
170
+ # Pass arguments to `get_trigger` via a request object, either of type
171
+ # {::Google::Cloud::Eventarc::V1::GetTriggerRequest} or an equivalent Hash.
172
+ #
173
+ # @param request [::Google::Cloud::Eventarc::V1::GetTriggerRequest, ::Hash]
174
+ # A request object representing the call parameters. Required. To specify no
175
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
176
+ # @param options [::Gapic::CallOptions, ::Hash]
177
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
178
+ #
179
+ # @overload get_trigger(name: nil)
180
+ # Pass arguments to `get_trigger` via keyword arguments. Note that at
181
+ # least one keyword argument is required. To specify no parameters, or to keep all
182
+ # the default parameter values, pass an empty Hash as a request object (see above).
183
+ #
184
+ # @param name [::String]
185
+ # Required. The name of the trigger to get.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Google::Cloud::Eventarc::V1::Trigger]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Google::Cloud::Eventarc::V1::Trigger]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ def get_trigger request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::GetTriggerRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ metadata = @config.rpcs.get_trigger.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::Eventarc::V1::VERSION
210
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ header_params = {
213
+ "name" => request.name
214
+ }
215
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
216
+ metadata[:"x-goog-request-params"] ||= request_params_header
217
+
218
+ options.apply_defaults timeout: @config.rpcs.get_trigger.timeout,
219
+ metadata: metadata,
220
+ retry_policy: @config.rpcs.get_trigger.retry_policy
221
+ options.apply_defaults metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @eventarc_stub.call_rpc :get_trigger, request, options: options do |response, operation|
225
+ yield response, operation if block_given?
226
+ return response
227
+ end
228
+ rescue ::GRPC::BadStatus => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # List triggers.
234
+ #
235
+ # @overload list_triggers(request, options = nil)
236
+ # Pass arguments to `list_triggers` via a request object, either of type
237
+ # {::Google::Cloud::Eventarc::V1::ListTriggersRequest} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::Eventarc::V1::ListTriggersRequest, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
244
+ #
245
+ # @overload list_triggers(parent: nil, page_size: nil, page_token: nil, order_by: nil)
246
+ # Pass arguments to `list_triggers` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param parent [::String]
251
+ # Required. The parent collection to list triggers on.
252
+ # @param page_size [::Integer]
253
+ # The maximum number of triggers to return on each page.
254
+ # Note: The service may send fewer.
255
+ # @param page_token [::String]
256
+ # The page token; provide the value from the `next_page_token` field in a
257
+ # previous `ListTriggers` call to retrieve the subsequent page.
258
+ #
259
+ # When paginating, all other parameters provided to `ListTriggers` must match
260
+ # the call that provided the page token.
261
+ # @param order_by [::String]
262
+ # The sorting order of the resources returned. Value should be a comma
263
+ # separated list of fields. The default sorting oder is ascending. To specify
264
+ # descending order for a field, append a ` desc` suffix; for example:
265
+ # `name desc, trigger_id`.
266
+ #
267
+ # @yield [response, operation] Access the result along with the RPC operation
268
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>]
269
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
270
+ #
271
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Eventarc::V1::Trigger>]
272
+ #
273
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
274
+ #
275
+ def list_triggers request, options = nil
276
+ raise ::ArgumentError, "request must be provided" if request.nil?
277
+
278
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::ListTriggersRequest
279
+
280
+ # Converts hash and nil to an options object
281
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
282
+
283
+ # Customize the options with defaults
284
+ metadata = @config.rpcs.list_triggers.metadata.to_h
285
+
286
+ # Set x-goog-api-client and x-goog-user-project headers
287
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
288
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
289
+ gapic_version: ::Google::Cloud::Eventarc::V1::VERSION
290
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
291
+
292
+ header_params = {
293
+ "parent" => request.parent
294
+ }
295
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
296
+ metadata[:"x-goog-request-params"] ||= request_params_header
297
+
298
+ options.apply_defaults timeout: @config.rpcs.list_triggers.timeout,
299
+ metadata: metadata,
300
+ retry_policy: @config.rpcs.list_triggers.retry_policy
301
+ options.apply_defaults metadata: @config.metadata,
302
+ retry_policy: @config.retry_policy
303
+
304
+ @eventarc_stub.call_rpc :list_triggers, request, options: options do |response, operation|
305
+ response = ::Gapic::PagedEnumerable.new @eventarc_stub, :list_triggers, request, response, operation, options
306
+ yield response, operation if block_given?
307
+ return response
308
+ end
309
+ rescue ::GRPC::BadStatus => e
310
+ raise ::Google::Cloud::Error.from_error(e)
311
+ end
312
+
313
+ ##
314
+ # Create a new trigger in a particular project and location.
315
+ #
316
+ # @overload create_trigger(request, options = nil)
317
+ # Pass arguments to `create_trigger` via a request object, either of type
318
+ # {::Google::Cloud::Eventarc::V1::CreateTriggerRequest} or an equivalent Hash.
319
+ #
320
+ # @param request [::Google::Cloud::Eventarc::V1::CreateTriggerRequest, ::Hash]
321
+ # A request object representing the call parameters. Required. To specify no
322
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
323
+ # @param options [::Gapic::CallOptions, ::Hash]
324
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
325
+ #
326
+ # @overload create_trigger(parent: nil, trigger: nil, trigger_id: nil, validate_only: nil)
327
+ # Pass arguments to `create_trigger` via keyword arguments. Note that at
328
+ # least one keyword argument is required. To specify no parameters, or to keep all
329
+ # the default parameter values, pass an empty Hash as a request object (see above).
330
+ #
331
+ # @param parent [::String]
332
+ # Required. The parent collection in which to add this trigger.
333
+ # @param trigger [::Google::Cloud::Eventarc::V1::Trigger, ::Hash]
334
+ # Required. The trigger to create.
335
+ # @param trigger_id [::String]
336
+ # Required. The user-provided ID to be assigned to the trigger.
337
+ # @param validate_only [::Boolean]
338
+ # Required. If set, validate the request and preview the review, but do not actually
339
+ # post it.
340
+ #
341
+ # @yield [response, operation] Access the result along with the RPC operation
342
+ # @yieldparam response [::Gapic::Operation]
343
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
344
+ #
345
+ # @return [::Gapic::Operation]
346
+ #
347
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
348
+ #
349
+ def create_trigger request, options = nil
350
+ raise ::ArgumentError, "request must be provided" if request.nil?
351
+
352
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::CreateTriggerRequest
353
+
354
+ # Converts hash and nil to an options object
355
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
356
+
357
+ # Customize the options with defaults
358
+ metadata = @config.rpcs.create_trigger.metadata.to_h
359
+
360
+ # Set x-goog-api-client and x-goog-user-project headers
361
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
362
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
363
+ gapic_version: ::Google::Cloud::Eventarc::V1::VERSION
364
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
365
+
366
+ header_params = {
367
+ "parent" => request.parent
368
+ }
369
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
370
+ metadata[:"x-goog-request-params"] ||= request_params_header
371
+
372
+ options.apply_defaults timeout: @config.rpcs.create_trigger.timeout,
373
+ metadata: metadata,
374
+ retry_policy: @config.rpcs.create_trigger.retry_policy
375
+ options.apply_defaults metadata: @config.metadata,
376
+ retry_policy: @config.retry_policy
377
+
378
+ @eventarc_stub.call_rpc :create_trigger, request, options: options do |response, operation|
379
+ response = ::Gapic::Operation.new response, @operations_client, options: options
380
+ yield response, operation if block_given?
381
+ return response
382
+ end
383
+ rescue ::GRPC::BadStatus => e
384
+ raise ::Google::Cloud::Error.from_error(e)
385
+ end
386
+
387
+ ##
388
+ # Update a single trigger.
389
+ #
390
+ # @overload update_trigger(request, options = nil)
391
+ # Pass arguments to `update_trigger` via a request object, either of type
392
+ # {::Google::Cloud::Eventarc::V1::UpdateTriggerRequest} or an equivalent Hash.
393
+ #
394
+ # @param request [::Google::Cloud::Eventarc::V1::UpdateTriggerRequest, ::Hash]
395
+ # A request object representing the call parameters. Required. To specify no
396
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
397
+ # @param options [::Gapic::CallOptions, ::Hash]
398
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
399
+ #
400
+ # @overload update_trigger(trigger: nil, update_mask: nil, allow_missing: nil, validate_only: nil)
401
+ # Pass arguments to `update_trigger` via keyword arguments. Note that at
402
+ # least one keyword argument is required. To specify no parameters, or to keep all
403
+ # the default parameter values, pass an empty Hash as a request object (see above).
404
+ #
405
+ # @param trigger [::Google::Cloud::Eventarc::V1::Trigger, ::Hash]
406
+ # The trigger to be updated.
407
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
408
+ # The fields to be updated; only fields explicitly provided will be updated.
409
+ # If no field mask is provided, all provided fields in the request will be
410
+ # updated. To update all fields, provide a field mask of "*".
411
+ # @param allow_missing [::Boolean]
412
+ # If set to true, and the trigger is not found, a new trigger will be
413
+ # created. In this situation, `update_mask` is ignored.
414
+ # @param validate_only [::Boolean]
415
+ # Required. If set, validate the request and preview the review, but do not actually
416
+ # post it.
417
+ #
418
+ # @yield [response, operation] Access the result along with the RPC operation
419
+ # @yieldparam response [::Gapic::Operation]
420
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
421
+ #
422
+ # @return [::Gapic::Operation]
423
+ #
424
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
425
+ #
426
+ def update_trigger request, options = nil
427
+ raise ::ArgumentError, "request must be provided" if request.nil?
428
+
429
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::UpdateTriggerRequest
430
+
431
+ # Converts hash and nil to an options object
432
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
433
+
434
+ # Customize the options with defaults
435
+ metadata = @config.rpcs.update_trigger.metadata.to_h
436
+
437
+ # Set x-goog-api-client and x-goog-user-project headers
438
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
439
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
440
+ gapic_version: ::Google::Cloud::Eventarc::V1::VERSION
441
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
442
+
443
+ header_params = {
444
+ "trigger.name" => request.trigger.name
445
+ }
446
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
447
+ metadata[:"x-goog-request-params"] ||= request_params_header
448
+
449
+ options.apply_defaults timeout: @config.rpcs.update_trigger.timeout,
450
+ metadata: metadata,
451
+ retry_policy: @config.rpcs.update_trigger.retry_policy
452
+ options.apply_defaults metadata: @config.metadata,
453
+ retry_policy: @config.retry_policy
454
+
455
+ @eventarc_stub.call_rpc :update_trigger, request, options: options do |response, operation|
456
+ response = ::Gapic::Operation.new response, @operations_client, options: options
457
+ yield response, operation if block_given?
458
+ return response
459
+ end
460
+ rescue ::GRPC::BadStatus => e
461
+ raise ::Google::Cloud::Error.from_error(e)
462
+ end
463
+
464
+ ##
465
+ # Delete a single trigger.
466
+ #
467
+ # @overload delete_trigger(request, options = nil)
468
+ # Pass arguments to `delete_trigger` via a request object, either of type
469
+ # {::Google::Cloud::Eventarc::V1::DeleteTriggerRequest} or an equivalent Hash.
470
+ #
471
+ # @param request [::Google::Cloud::Eventarc::V1::DeleteTriggerRequest, ::Hash]
472
+ # A request object representing the call parameters. Required. To specify no
473
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
474
+ # @param options [::Gapic::CallOptions, ::Hash]
475
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
476
+ #
477
+ # @overload delete_trigger(name: nil, etag: nil, allow_missing: nil, validate_only: nil)
478
+ # Pass arguments to `delete_trigger` via keyword arguments. Note that at
479
+ # least one keyword argument is required. To specify no parameters, or to keep all
480
+ # the default parameter values, pass an empty Hash as a request object (see above).
481
+ #
482
+ # @param name [::String]
483
+ # Required. The name of the trigger to be deleted.
484
+ # @param etag [::String]
485
+ # If provided, the trigger will only be deleted if the etag matches the
486
+ # current etag on the resource.
487
+ # @param allow_missing [::Boolean]
488
+ # If set to true, and the trigger is not found, the request will succeed
489
+ # but no action will be taken on the server.
490
+ # @param validate_only [::Boolean]
491
+ # Required. If set, validate the request and preview the review, but do not actually
492
+ # post it.
493
+ #
494
+ # @yield [response, operation] Access the result along with the RPC operation
495
+ # @yieldparam response [::Gapic::Operation]
496
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
497
+ #
498
+ # @return [::Gapic::Operation]
499
+ #
500
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
501
+ #
502
+ def delete_trigger request, options = nil
503
+ raise ::ArgumentError, "request must be provided" if request.nil?
504
+
505
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Eventarc::V1::DeleteTriggerRequest
506
+
507
+ # Converts hash and nil to an options object
508
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
509
+
510
+ # Customize the options with defaults
511
+ metadata = @config.rpcs.delete_trigger.metadata.to_h
512
+
513
+ # Set x-goog-api-client and x-goog-user-project headers
514
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
515
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
516
+ gapic_version: ::Google::Cloud::Eventarc::V1::VERSION
517
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
518
+
519
+ header_params = {
520
+ "name" => request.name
521
+ }
522
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
523
+ metadata[:"x-goog-request-params"] ||= request_params_header
524
+
525
+ options.apply_defaults timeout: @config.rpcs.delete_trigger.timeout,
526
+ metadata: metadata,
527
+ retry_policy: @config.rpcs.delete_trigger.retry_policy
528
+ options.apply_defaults metadata: @config.metadata,
529
+ retry_policy: @config.retry_policy
530
+
531
+ @eventarc_stub.call_rpc :delete_trigger, request, options: options do |response, operation|
532
+ response = ::Gapic::Operation.new response, @operations_client, options: options
533
+ yield response, operation if block_given?
534
+ return response
535
+ end
536
+ rescue ::GRPC::BadStatus => e
537
+ raise ::Google::Cloud::Error.from_error(e)
538
+ end
539
+
540
+ ##
541
+ # Configuration class for the Eventarc API.
542
+ #
543
+ # This class represents the configuration for Eventarc,
544
+ # providing control over timeouts, retry behavior, logging, transport
545
+ # parameters, and other low-level controls. Certain parameters can also be
546
+ # applied individually to specific RPCs. See
547
+ # {::Google::Cloud::Eventarc::V1::Eventarc::Client::Configuration::Rpcs}
548
+ # for a list of RPCs that can be configured independently.
549
+ #
550
+ # Configuration can be applied globally to all clients, or to a single client
551
+ # on construction.
552
+ #
553
+ # # Examples
554
+ #
555
+ # To modify the global config, setting the timeout for get_trigger
556
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
557
+ #
558
+ # ::Google::Cloud::Eventarc::V1::Eventarc::Client.configure do |config|
559
+ # config.timeout = 10.0
560
+ # config.rpcs.get_trigger.timeout = 20.0
561
+ # end
562
+ #
563
+ # To apply the above configuration only to a new client:
564
+ #
565
+ # client = ::Google::Cloud::Eventarc::V1::Eventarc::Client.new do |config|
566
+ # config.timeout = 10.0
567
+ # config.rpcs.get_trigger.timeout = 20.0
568
+ # end
569
+ #
570
+ # @!attribute [rw] endpoint
571
+ # The hostname or hostname:port of the service endpoint.
572
+ # Defaults to `"eventarc.googleapis.com"`.
573
+ # @return [::String]
574
+ # @!attribute [rw] credentials
575
+ # Credentials to send with calls. You may provide any of the following types:
576
+ # * (`String`) The path to a service account key file in JSON format
577
+ # * (`Hash`) A service account key as a Hash
578
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
579
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
580
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
581
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
582
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
583
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
584
+ # * (`nil`) indicating no credentials
585
+ # @return [::Object]
586
+ # @!attribute [rw] scope
587
+ # The OAuth scopes
588
+ # @return [::Array<::String>]
589
+ # @!attribute [rw] lib_name
590
+ # The library name as recorded in instrumentation and logging
591
+ # @return [::String]
592
+ # @!attribute [rw] lib_version
593
+ # The library version as recorded in instrumentation and logging
594
+ # @return [::String]
595
+ # @!attribute [rw] channel_args
596
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
597
+ # `GRPC::Core::Channel` object is provided as the credential.
598
+ # @return [::Hash]
599
+ # @!attribute [rw] interceptors
600
+ # An array of interceptors that are run before calls are executed.
601
+ # @return [::Array<::GRPC::ClientInterceptor>]
602
+ # @!attribute [rw] timeout
603
+ # The call timeout in seconds.
604
+ # @return [::Numeric]
605
+ # @!attribute [rw] metadata
606
+ # Additional gRPC headers to be sent with the call.
607
+ # @return [::Hash{::Symbol=>::String}]
608
+ # @!attribute [rw] retry_policy
609
+ # The retry policy. The value is a hash with the following keys:
610
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
611
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
612
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
613
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
614
+ # trigger a retry.
615
+ # @return [::Hash]
616
+ # @!attribute [rw] quota_project
617
+ # A separate project against which to charge quota.
618
+ # @return [::String]
619
+ #
620
+ class Configuration
621
+ extend ::Gapic::Config
622
+
623
+ config_attr :endpoint, "eventarc.googleapis.com", ::String
624
+ config_attr :credentials, nil do |value|
625
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
626
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
627
+ allowed.any? { |klass| klass === value }
628
+ end
629
+ config_attr :scope, nil, ::String, ::Array, nil
630
+ config_attr :lib_name, nil, ::String, nil
631
+ config_attr :lib_version, nil, ::String, nil
632
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
633
+ config_attr :interceptors, nil, ::Array, nil
634
+ config_attr :timeout, nil, ::Numeric, nil
635
+ config_attr :metadata, nil, ::Hash, nil
636
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
637
+ config_attr :quota_project, nil, ::String, nil
638
+
639
+ # @private
640
+ def initialize parent_config = nil
641
+ @parent_config = parent_config unless parent_config.nil?
642
+
643
+ yield self if block_given?
644
+ end
645
+
646
+ ##
647
+ # Configurations for individual RPCs
648
+ # @return [Rpcs]
649
+ #
650
+ def rpcs
651
+ @rpcs ||= begin
652
+ parent_rpcs = nil
653
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
654
+ Rpcs.new parent_rpcs
655
+ end
656
+ end
657
+
658
+ ##
659
+ # Configuration RPC class for the Eventarc API.
660
+ #
661
+ # Includes fields providing the configuration for each RPC in this service.
662
+ # Each configuration object is of type `Gapic::Config::Method` and includes
663
+ # the following configuration fields:
664
+ #
665
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
666
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
667
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
668
+ # include the following keys:
669
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
670
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
671
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
672
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
673
+ # trigger a retry.
674
+ #
675
+ class Rpcs
676
+ ##
677
+ # RPC-specific configuration for `get_trigger`
678
+ # @return [::Gapic::Config::Method]
679
+ #
680
+ attr_reader :get_trigger
681
+ ##
682
+ # RPC-specific configuration for `list_triggers`
683
+ # @return [::Gapic::Config::Method]
684
+ #
685
+ attr_reader :list_triggers
686
+ ##
687
+ # RPC-specific configuration for `create_trigger`
688
+ # @return [::Gapic::Config::Method]
689
+ #
690
+ attr_reader :create_trigger
691
+ ##
692
+ # RPC-specific configuration for `update_trigger`
693
+ # @return [::Gapic::Config::Method]
694
+ #
695
+ attr_reader :update_trigger
696
+ ##
697
+ # RPC-specific configuration for `delete_trigger`
698
+ # @return [::Gapic::Config::Method]
699
+ #
700
+ attr_reader :delete_trigger
701
+
702
+ # @private
703
+ def initialize parent_rpcs = nil
704
+ get_trigger_config = parent_rpcs.get_trigger if parent_rpcs.respond_to? :get_trigger
705
+ @get_trigger = ::Gapic::Config::Method.new get_trigger_config
706
+ list_triggers_config = parent_rpcs.list_triggers if parent_rpcs.respond_to? :list_triggers
707
+ @list_triggers = ::Gapic::Config::Method.new list_triggers_config
708
+ create_trigger_config = parent_rpcs.create_trigger if parent_rpcs.respond_to? :create_trigger
709
+ @create_trigger = ::Gapic::Config::Method.new create_trigger_config
710
+ update_trigger_config = parent_rpcs.update_trigger if parent_rpcs.respond_to? :update_trigger
711
+ @update_trigger = ::Gapic::Config::Method.new update_trigger_config
712
+ delete_trigger_config = parent_rpcs.delete_trigger if parent_rpcs.respond_to? :delete_trigger
713
+ @delete_trigger = ::Gapic::Config::Method.new delete_trigger_config
714
+
715
+ yield self if block_given?
716
+ end
717
+ end
718
+ end
719
+ end
720
+ end
721
+ end
722
+ end
723
+ end
724
+ end