google-cloud-gsuite_add_ons-v1 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,975 @@
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/errors"
20
+ require "google/cloud/gsuiteaddons/v1/gsuiteaddons_pb"
21
+ require "google/cloud/gsuite_add_ons/v1/gsuite_add_ons/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module GSuiteAddOns
26
+ module V1
27
+ module GSuiteAddOns
28
+ module Rest
29
+ ##
30
+ # REST client for the GSuiteAddOns service.
31
+ #
32
+ # A service for managing Google Workspace Add-ons deployments.
33
+ #
34
+ # A Google Workspace Add-on is a third-party embedded component that can be
35
+ # installed in Google Workspace Applications like Gmail, Calendar, Drive, and
36
+ # the Google Docs, Sheets, and Slides editors. Google Workspace Add-ons can
37
+ # display UI cards, receive contextual information from the host application,
38
+ # and perform actions in the host application (See:
39
+ # https://developers.google.com/gsuite/add-ons/overview for more information).
40
+ #
41
+ # A Google Workspace Add-on deployment resource specifies metadata about the
42
+ # add-on, including a specification of the entry points in the host application
43
+ # that trigger add-on executions (see:
44
+ # https://developers.google.com/gsuite/add-ons/concepts/gsuite-manifests).
45
+ # Add-on deployments defined via the Google Workspace Add-ons API define their
46
+ # entrypoints using HTTPS URLs (See:
47
+ # https://developers.google.com/gsuite/add-ons/guides/alternate-runtimes),
48
+ #
49
+ # A Google Workspace Add-on deployment can be installed in developer mode,
50
+ # which allows an add-on developer to test the experience an end-user would see
51
+ # when installing and running the add-on in their G Suite applications. When
52
+ # running in developer mode, more detailed error messages are exposed in the
53
+ # add-on UI to aid in debugging.
54
+ #
55
+ # A Google Workspace Add-on deployment can be published to Google Workspace
56
+ # Marketplace, which allows other Google Workspace users to discover and
57
+ # install the add-on. See:
58
+ # https://developers.google.com/gsuite/add-ons/how-tos/publish-add-on-overview
59
+ # for details.
60
+ #
61
+ class Client
62
+ include Paths
63
+
64
+ # @private
65
+ attr_reader :g_suite_add_ons_stub
66
+
67
+ ##
68
+ # Configure the GSuiteAddOns Client class.
69
+ #
70
+ # See {::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client::Configuration}
71
+ # for a description of the configuration fields.
72
+ #
73
+ # @example
74
+ #
75
+ # # Modify the configuration for all GSuiteAddOns clients
76
+ # ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client.configure do |config|
77
+ # config.timeout = 10.0
78
+ # end
79
+ #
80
+ # @yield [config] Configure the Client client.
81
+ # @yieldparam config [Client::Configuration]
82
+ #
83
+ # @return [Client::Configuration]
84
+ #
85
+ def self.configure
86
+ @configure ||= begin
87
+ namespace = ["Google", "Cloud", "GSuiteAddOns", "V1"]
88
+ parent_config = while namespace.any?
89
+ parent_name = namespace.join "::"
90
+ parent_const = const_get parent_name
91
+ break parent_const.configure if parent_const.respond_to? :configure
92
+ namespace.pop
93
+ end
94
+ default_config = Client::Configuration.new parent_config
95
+
96
+ default_config.timeout = 10.0
97
+ default_config.retry_policy = {
98
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 2]
99
+ }
100
+
101
+ default_config.rpcs.get_authorization.timeout = 120.0
102
+
103
+ default_config.rpcs.create_deployment.timeout = 10.0
104
+
105
+ default_config.rpcs.delete_deployment.timeout = 10.0
106
+
107
+ default_config
108
+ end
109
+ yield @configure if block_given?
110
+ @configure
111
+ end
112
+
113
+ ##
114
+ # Configure the GSuiteAddOns Client instance.
115
+ #
116
+ # The configuration is set to the derived mode, meaning that values can be changed,
117
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
118
+ # should be made on {Client.configure}.
119
+ #
120
+ # See {::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client::Configuration}
121
+ # for a description of the configuration fields.
122
+ #
123
+ # @yield [config] Configure the Client client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ # @return [Client::Configuration]
127
+ #
128
+ def configure
129
+ yield @config if block_given?
130
+ @config
131
+ end
132
+
133
+ ##
134
+ # Create a new GSuiteAddOns REST client object.
135
+ #
136
+ # @example
137
+ #
138
+ # # Create a client using the default configuration
139
+ # client = ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client.new
140
+ #
141
+ # # Create a client using a custom configuration
142
+ # client = ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client.new do |config|
143
+ # config.timeout = 10.0
144
+ # end
145
+ #
146
+ # @yield [config] Configure the GSuiteAddOns client.
147
+ # @yieldparam config [Client::Configuration]
148
+ #
149
+ def initialize
150
+ # Create the configuration object
151
+ @config = Configuration.new Client.configure
152
+
153
+ # Yield the configuration if needed
154
+ yield @config if block_given?
155
+
156
+ # Create credentials
157
+ credentials = @config.credentials
158
+ # Use self-signed JWT if the endpoint is unchanged from default,
159
+ # but only if the default endpoint does not have a region prefix.
160
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
161
+ !@config.endpoint.split(".").first.include?("-")
162
+ credentials ||= Credentials.default scope: @config.scope,
163
+ enable_self_signed_jwt: enable_self_signed_jwt
164
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
165
+ credentials = Credentials.new credentials, scope: @config.scope
166
+ end
167
+
168
+ @quota_project_id = @config.quota_project
169
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
170
+
171
+ @g_suite_add_ons_stub = ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
172
+ end
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # Gets the authorization information for deployments in a given project.
178
+ #
179
+ # @overload get_authorization(request, options = nil)
180
+ # Pass arguments to `get_authorization` via a request object, either of type
181
+ # {::Google::Cloud::GSuiteAddOns::V1::GetAuthorizationRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::GetAuthorizationRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
188
+ #
189
+ # @overload get_authorization(name: nil)
190
+ # Pass arguments to `get_authorization` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param name [::String]
195
+ # Required. Name of the project for which to get the Google Workspace Add-ons
196
+ # authorization information.
197
+ #
198
+ # Example: `projects/my_project/authorization`.
199
+ # @yield [result, operation] Access the result along with the TransportOperation object
200
+ # @yieldparam result [::Google::Cloud::GSuiteAddOns::V1::Authorization]
201
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
202
+ #
203
+ # @return [::Google::Cloud::GSuiteAddOns::V1::Authorization]
204
+ #
205
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
206
+ def get_authorization request, options = nil
207
+ raise ::ArgumentError, "request must be provided" if request.nil?
208
+
209
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::GetAuthorizationRequest
210
+
211
+ # Converts hash and nil to an options object
212
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
213
+
214
+ # Customize the options with defaults
215
+ call_metadata = @config.rpcs.get_authorization.metadata.to_h
216
+
217
+ # Set x-goog-api-client and x-goog-user-project headers
218
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
219
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
220
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
221
+ transports_version_send: [:rest]
222
+
223
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
224
+
225
+ options.apply_defaults timeout: @config.rpcs.get_authorization.timeout,
226
+ metadata: call_metadata,
227
+ retry_policy: @config.rpcs.get_authorization.retry_policy
228
+
229
+ options.apply_defaults timeout: @config.timeout,
230
+ metadata: @config.metadata,
231
+ retry_policy: @config.retry_policy
232
+
233
+ @g_suite_add_ons_stub.get_authorization request, options do |result, operation|
234
+ yield result, operation if block_given?
235
+ return result
236
+ end
237
+ rescue ::Gapic::Rest::Error => e
238
+ raise ::Google::Cloud::Error.from_error(e)
239
+ end
240
+
241
+ ##
242
+ # Creates a deployment with the specified name and configuration.
243
+ #
244
+ # @overload create_deployment(request, options = nil)
245
+ # Pass arguments to `create_deployment` via a request object, either of type
246
+ # {::Google::Cloud::GSuiteAddOns::V1::CreateDeploymentRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::CreateDeploymentRequest, ::Hash]
249
+ # A request object representing the call parameters. Required. To specify no
250
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
251
+ # @param options [::Gapic::CallOptions, ::Hash]
252
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
253
+ #
254
+ # @overload create_deployment(parent: nil, deployment_id: nil, deployment: nil)
255
+ # Pass arguments to `create_deployment` via keyword arguments. Note that at
256
+ # least one keyword argument is required. To specify no parameters, or to keep all
257
+ # the default parameter values, pass an empty Hash as a request object (see above).
258
+ #
259
+ # @param parent [::String]
260
+ # Required. Name of the project in which to create the deployment.
261
+ #
262
+ # Example: `projects/my_project`.
263
+ # @param deployment_id [::String]
264
+ # Required. The id to use for this deployment. The full name of the created
265
+ # resource will be `projects/<project_number>/deployments/<deployment_id>`.
266
+ # @param deployment [::Google::Cloud::GSuiteAddOns::V1::Deployment, ::Hash]
267
+ # Required. The deployment to create (deployment.name cannot be set).
268
+ # @yield [result, operation] Access the result along with the TransportOperation object
269
+ # @yieldparam result [::Google::Cloud::GSuiteAddOns::V1::Deployment]
270
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
271
+ #
272
+ # @return [::Google::Cloud::GSuiteAddOns::V1::Deployment]
273
+ #
274
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
275
+ def create_deployment request, options = nil
276
+ raise ::ArgumentError, "request must be provided" if request.nil?
277
+
278
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::CreateDeploymentRequest
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
+ call_metadata = @config.rpcs.create_deployment.metadata.to_h
285
+
286
+ # Set x-goog-api-client and x-goog-user-project headers
287
+ call_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::GSuiteAddOns::V1::VERSION,
290
+ transports_version_send: [:rest]
291
+
292
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
293
+
294
+ options.apply_defaults timeout: @config.rpcs.create_deployment.timeout,
295
+ metadata: call_metadata,
296
+ retry_policy: @config.rpcs.create_deployment.retry_policy
297
+
298
+ options.apply_defaults timeout: @config.timeout,
299
+ metadata: @config.metadata,
300
+ retry_policy: @config.retry_policy
301
+
302
+ @g_suite_add_ons_stub.create_deployment request, options do |result, operation|
303
+ yield result, operation if block_given?
304
+ return result
305
+ end
306
+ rescue ::Gapic::Rest::Error => e
307
+ raise ::Google::Cloud::Error.from_error(e)
308
+ end
309
+
310
+ ##
311
+ # Creates or replaces a deployment with the specified name.
312
+ #
313
+ # @overload replace_deployment(request, options = nil)
314
+ # Pass arguments to `replace_deployment` via a request object, either of type
315
+ # {::Google::Cloud::GSuiteAddOns::V1::ReplaceDeploymentRequest} or an equivalent Hash.
316
+ #
317
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::ReplaceDeploymentRequest, ::Hash]
318
+ # A request object representing the call parameters. Required. To specify no
319
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
320
+ # @param options [::Gapic::CallOptions, ::Hash]
321
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
322
+ #
323
+ # @overload replace_deployment(deployment: nil)
324
+ # Pass arguments to `replace_deployment` via keyword arguments. Note that at
325
+ # least one keyword argument is required. To specify no parameters, or to keep all
326
+ # the default parameter values, pass an empty Hash as a request object (see above).
327
+ #
328
+ # @param deployment [::Google::Cloud::GSuiteAddOns::V1::Deployment, ::Hash]
329
+ # Required. The deployment to create or replace.
330
+ # @yield [result, operation] Access the result along with the TransportOperation object
331
+ # @yieldparam result [::Google::Cloud::GSuiteAddOns::V1::Deployment]
332
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
333
+ #
334
+ # @return [::Google::Cloud::GSuiteAddOns::V1::Deployment]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
337
+ def replace_deployment request, options = nil
338
+ raise ::ArgumentError, "request must be provided" if request.nil?
339
+
340
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::ReplaceDeploymentRequest
341
+
342
+ # Converts hash and nil to an options object
343
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
344
+
345
+ # Customize the options with defaults
346
+ call_metadata = @config.rpcs.replace_deployment.metadata.to_h
347
+
348
+ # Set x-goog-api-client and x-goog-user-project headers
349
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
350
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
351
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
352
+ transports_version_send: [:rest]
353
+
354
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ options.apply_defaults timeout: @config.rpcs.replace_deployment.timeout,
357
+ metadata: call_metadata,
358
+ retry_policy: @config.rpcs.replace_deployment.retry_policy
359
+
360
+ options.apply_defaults timeout: @config.timeout,
361
+ metadata: @config.metadata,
362
+ retry_policy: @config.retry_policy
363
+
364
+ @g_suite_add_ons_stub.replace_deployment request, options do |result, operation|
365
+ yield result, operation if block_given?
366
+ return result
367
+ end
368
+ rescue ::Gapic::Rest::Error => e
369
+ raise ::Google::Cloud::Error.from_error(e)
370
+ end
371
+
372
+ ##
373
+ # Gets the deployment with the specified name.
374
+ #
375
+ # @overload get_deployment(request, options = nil)
376
+ # Pass arguments to `get_deployment` via a request object, either of type
377
+ # {::Google::Cloud::GSuiteAddOns::V1::GetDeploymentRequest} or an equivalent Hash.
378
+ #
379
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::GetDeploymentRequest, ::Hash]
380
+ # A request object representing the call parameters. Required. To specify no
381
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
382
+ # @param options [::Gapic::CallOptions, ::Hash]
383
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
384
+ #
385
+ # @overload get_deployment(name: nil)
386
+ # Pass arguments to `get_deployment` via keyword arguments. Note that at
387
+ # least one keyword argument is required. To specify no parameters, or to keep all
388
+ # the default parameter values, pass an empty Hash as a request object (see above).
389
+ #
390
+ # @param name [::String]
391
+ # Required. The full resource name of the deployment to get.
392
+ #
393
+ # Example: `projects/my_project/deployments/my_deployment`.
394
+ # @yield [result, operation] Access the result along with the TransportOperation object
395
+ # @yieldparam result [::Google::Cloud::GSuiteAddOns::V1::Deployment]
396
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
397
+ #
398
+ # @return [::Google::Cloud::GSuiteAddOns::V1::Deployment]
399
+ #
400
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
401
+ def get_deployment request, options = nil
402
+ raise ::ArgumentError, "request must be provided" if request.nil?
403
+
404
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::GetDeploymentRequest
405
+
406
+ # Converts hash and nil to an options object
407
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
408
+
409
+ # Customize the options with defaults
410
+ call_metadata = @config.rpcs.get_deployment.metadata.to_h
411
+
412
+ # Set x-goog-api-client and x-goog-user-project headers
413
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
414
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
415
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
416
+ transports_version_send: [:rest]
417
+
418
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
419
+
420
+ options.apply_defaults timeout: @config.rpcs.get_deployment.timeout,
421
+ metadata: call_metadata,
422
+ retry_policy: @config.rpcs.get_deployment.retry_policy
423
+
424
+ options.apply_defaults timeout: @config.timeout,
425
+ metadata: @config.metadata,
426
+ retry_policy: @config.retry_policy
427
+
428
+ @g_suite_add_ons_stub.get_deployment request, options do |result, operation|
429
+ yield result, operation if block_given?
430
+ return result
431
+ end
432
+ rescue ::Gapic::Rest::Error => e
433
+ raise ::Google::Cloud::Error.from_error(e)
434
+ end
435
+
436
+ ##
437
+ # Lists all deployments in a particular project.
438
+ #
439
+ # @overload list_deployments(request, options = nil)
440
+ # Pass arguments to `list_deployments` via a request object, either of type
441
+ # {::Google::Cloud::GSuiteAddOns::V1::ListDeploymentsRequest} or an equivalent Hash.
442
+ #
443
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::ListDeploymentsRequest, ::Hash]
444
+ # A request object representing the call parameters. Required. To specify no
445
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
446
+ # @param options [::Gapic::CallOptions, ::Hash]
447
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
448
+ #
449
+ # @overload list_deployments(parent: nil, page_size: nil, page_token: nil)
450
+ # Pass arguments to `list_deployments` via keyword arguments. Note that at
451
+ # least one keyword argument is required. To specify no parameters, or to keep all
452
+ # the default parameter values, pass an empty Hash as a request object (see above).
453
+ #
454
+ # @param parent [::String]
455
+ # Required. Name of the project in which to create the deployment.
456
+ #
457
+ # Example: `projects/my_project`.
458
+ # @param page_size [::Integer]
459
+ # The maximum number of deployments to return. The service may return fewer
460
+ # than this value.
461
+ # If unspecified, at most 1000 deployments will be returned.
462
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
463
+ # @param page_token [::String]
464
+ # A page token, received from a previous `ListDeployments` call.
465
+ # Provide this to retrieve the subsequent page.
466
+ #
467
+ # When paginating, all other parameters provided to `ListDeployments` must
468
+ # match the call that provided the page token.
469
+ # @yield [result, operation] Access the result along with the TransportOperation object
470
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::GSuiteAddOns::V1::Deployment>]
471
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
472
+ #
473
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::GSuiteAddOns::V1::Deployment>]
474
+ #
475
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
476
+ def list_deployments request, options = nil
477
+ raise ::ArgumentError, "request must be provided" if request.nil?
478
+
479
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::ListDeploymentsRequest
480
+
481
+ # Converts hash and nil to an options object
482
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
+
484
+ # Customize the options with defaults
485
+ call_metadata = @config.rpcs.list_deployments.metadata.to_h
486
+
487
+ # Set x-goog-api-client and x-goog-user-project headers
488
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
489
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
490
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
491
+ transports_version_send: [:rest]
492
+
493
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
494
+
495
+ options.apply_defaults timeout: @config.rpcs.list_deployments.timeout,
496
+ metadata: call_metadata,
497
+ retry_policy: @config.rpcs.list_deployments.retry_policy
498
+
499
+ options.apply_defaults timeout: @config.timeout,
500
+ metadata: @config.metadata,
501
+ retry_policy: @config.retry_policy
502
+
503
+ @g_suite_add_ons_stub.list_deployments request, options do |result, operation|
504
+ result = ::Gapic::Rest::PagedEnumerable.new @g_suite_add_ons_stub, :list_deployments, "deployments", request, result, options
505
+ yield result, operation if block_given?
506
+ return result
507
+ end
508
+ rescue ::Gapic::Rest::Error => e
509
+ raise ::Google::Cloud::Error.from_error(e)
510
+ end
511
+
512
+ ##
513
+ # Deletes the deployment with the given name.
514
+ #
515
+ # @overload delete_deployment(request, options = nil)
516
+ # Pass arguments to `delete_deployment` via a request object, either of type
517
+ # {::Google::Cloud::GSuiteAddOns::V1::DeleteDeploymentRequest} or an equivalent Hash.
518
+ #
519
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::DeleteDeploymentRequest, ::Hash]
520
+ # A request object representing the call parameters. Required. To specify no
521
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
522
+ # @param options [::Gapic::CallOptions, ::Hash]
523
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
524
+ #
525
+ # @overload delete_deployment(name: nil, etag: nil)
526
+ # Pass arguments to `delete_deployment` via keyword arguments. Note that at
527
+ # least one keyword argument is required. To specify no parameters, or to keep all
528
+ # the default parameter values, pass an empty Hash as a request object (see above).
529
+ #
530
+ # @param name [::String]
531
+ # Required. The full resource name of the deployment to delete.
532
+ #
533
+ # Example: `projects/my_project/deployments/my_deployment`.
534
+ # @param etag [::String]
535
+ # The etag of the deployment to delete.
536
+ # If this is provided, it must match the server's etag.
537
+ # @yield [result, operation] Access the result along with the TransportOperation object
538
+ # @yieldparam result [::Google::Protobuf::Empty]
539
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
540
+ #
541
+ # @return [::Google::Protobuf::Empty]
542
+ #
543
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
544
+ def delete_deployment request, options = nil
545
+ raise ::ArgumentError, "request must be provided" if request.nil?
546
+
547
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::DeleteDeploymentRequest
548
+
549
+ # Converts hash and nil to an options object
550
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
551
+
552
+ # Customize the options with defaults
553
+ call_metadata = @config.rpcs.delete_deployment.metadata.to_h
554
+
555
+ # Set x-goog-api-client and x-goog-user-project headers
556
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
557
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
558
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
559
+ transports_version_send: [:rest]
560
+
561
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
562
+
563
+ options.apply_defaults timeout: @config.rpcs.delete_deployment.timeout,
564
+ metadata: call_metadata,
565
+ retry_policy: @config.rpcs.delete_deployment.retry_policy
566
+
567
+ options.apply_defaults timeout: @config.timeout,
568
+ metadata: @config.metadata,
569
+ retry_policy: @config.retry_policy
570
+
571
+ @g_suite_add_ons_stub.delete_deployment request, options do |result, operation|
572
+ yield result, operation if block_given?
573
+ return result
574
+ end
575
+ rescue ::Gapic::Rest::Error => e
576
+ raise ::Google::Cloud::Error.from_error(e)
577
+ end
578
+
579
+ ##
580
+ # Installs a deployment in developer mode.
581
+ # See:
582
+ # https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.
583
+ #
584
+ # @overload install_deployment(request, options = nil)
585
+ # Pass arguments to `install_deployment` via a request object, either of type
586
+ # {::Google::Cloud::GSuiteAddOns::V1::InstallDeploymentRequest} or an equivalent Hash.
587
+ #
588
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::InstallDeploymentRequest, ::Hash]
589
+ # A request object representing the call parameters. Required. To specify no
590
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
591
+ # @param options [::Gapic::CallOptions, ::Hash]
592
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
593
+ #
594
+ # @overload install_deployment(name: nil)
595
+ # Pass arguments to `install_deployment` via keyword arguments. Note that at
596
+ # least one keyword argument is required. To specify no parameters, or to keep all
597
+ # the default parameter values, pass an empty Hash as a request object (see above).
598
+ #
599
+ # @param name [::String]
600
+ # Required. The full resource name of the deployment to install.
601
+ #
602
+ # Example: `projects/my_project/deployments/my_deployment`.
603
+ # @yield [result, operation] Access the result along with the TransportOperation object
604
+ # @yieldparam result [::Google::Protobuf::Empty]
605
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
606
+ #
607
+ # @return [::Google::Protobuf::Empty]
608
+ #
609
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
610
+ def install_deployment request, options = nil
611
+ raise ::ArgumentError, "request must be provided" if request.nil?
612
+
613
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::InstallDeploymentRequest
614
+
615
+ # Converts hash and nil to an options object
616
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
617
+
618
+ # Customize the options with defaults
619
+ call_metadata = @config.rpcs.install_deployment.metadata.to_h
620
+
621
+ # Set x-goog-api-client and x-goog-user-project headers
622
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
623
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
624
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
625
+ transports_version_send: [:rest]
626
+
627
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
628
+
629
+ options.apply_defaults timeout: @config.rpcs.install_deployment.timeout,
630
+ metadata: call_metadata,
631
+ retry_policy: @config.rpcs.install_deployment.retry_policy
632
+
633
+ options.apply_defaults timeout: @config.timeout,
634
+ metadata: @config.metadata,
635
+ retry_policy: @config.retry_policy
636
+
637
+ @g_suite_add_ons_stub.install_deployment request, options do |result, operation|
638
+ yield result, operation if block_given?
639
+ return result
640
+ end
641
+ rescue ::Gapic::Rest::Error => e
642
+ raise ::Google::Cloud::Error.from_error(e)
643
+ end
644
+
645
+ ##
646
+ # Uninstalls a developer mode deployment.
647
+ # See:
648
+ # https://developers.google.com/gsuite/add-ons/how-tos/testing-gsuite-addons.
649
+ #
650
+ # @overload uninstall_deployment(request, options = nil)
651
+ # Pass arguments to `uninstall_deployment` via a request object, either of type
652
+ # {::Google::Cloud::GSuiteAddOns::V1::UninstallDeploymentRequest} or an equivalent Hash.
653
+ #
654
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::UninstallDeploymentRequest, ::Hash]
655
+ # A request object representing the call parameters. Required. To specify no
656
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
657
+ # @param options [::Gapic::CallOptions, ::Hash]
658
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
659
+ #
660
+ # @overload uninstall_deployment(name: nil)
661
+ # Pass arguments to `uninstall_deployment` via keyword arguments. Note that at
662
+ # least one keyword argument is required. To specify no parameters, or to keep all
663
+ # the default parameter values, pass an empty Hash as a request object (see above).
664
+ #
665
+ # @param name [::String]
666
+ # Required. The full resource name of the deployment to install.
667
+ #
668
+ # Example: `projects/my_project/deployments/my_deployment`.
669
+ # @yield [result, operation] Access the result along with the TransportOperation object
670
+ # @yieldparam result [::Google::Protobuf::Empty]
671
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
672
+ #
673
+ # @return [::Google::Protobuf::Empty]
674
+ #
675
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
676
+ def uninstall_deployment request, options = nil
677
+ raise ::ArgumentError, "request must be provided" if request.nil?
678
+
679
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::UninstallDeploymentRequest
680
+
681
+ # Converts hash and nil to an options object
682
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
683
+
684
+ # Customize the options with defaults
685
+ call_metadata = @config.rpcs.uninstall_deployment.metadata.to_h
686
+
687
+ # Set x-goog-api-client and x-goog-user-project headers
688
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
689
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
690
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
691
+ transports_version_send: [:rest]
692
+
693
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
694
+
695
+ options.apply_defaults timeout: @config.rpcs.uninstall_deployment.timeout,
696
+ metadata: call_metadata,
697
+ retry_policy: @config.rpcs.uninstall_deployment.retry_policy
698
+
699
+ options.apply_defaults timeout: @config.timeout,
700
+ metadata: @config.metadata,
701
+ retry_policy: @config.retry_policy
702
+
703
+ @g_suite_add_ons_stub.uninstall_deployment request, options do |result, operation|
704
+ yield result, operation if block_given?
705
+ return result
706
+ end
707
+ rescue ::Gapic::Rest::Error => e
708
+ raise ::Google::Cloud::Error.from_error(e)
709
+ end
710
+
711
+ ##
712
+ # Fetches the install status of a developer mode deployment.
713
+ #
714
+ # @overload get_install_status(request, options = nil)
715
+ # Pass arguments to `get_install_status` via a request object, either of type
716
+ # {::Google::Cloud::GSuiteAddOns::V1::GetInstallStatusRequest} or an equivalent Hash.
717
+ #
718
+ # @param request [::Google::Cloud::GSuiteAddOns::V1::GetInstallStatusRequest, ::Hash]
719
+ # A request object representing the call parameters. Required. To specify no
720
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
721
+ # @param options [::Gapic::CallOptions, ::Hash]
722
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
723
+ #
724
+ # @overload get_install_status(name: nil)
725
+ # Pass arguments to `get_install_status` via keyword arguments. Note that at
726
+ # least one keyword argument is required. To specify no parameters, or to keep all
727
+ # the default parameter values, pass an empty Hash as a request object (see above).
728
+ #
729
+ # @param name [::String]
730
+ # Required. The full resource name of the deployment.
731
+ #
732
+ # Example: `projects/my_project/deployments/my_deployment/installStatus`.
733
+ # @yield [result, operation] Access the result along with the TransportOperation object
734
+ # @yieldparam result [::Google::Cloud::GSuiteAddOns::V1::InstallStatus]
735
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
736
+ #
737
+ # @return [::Google::Cloud::GSuiteAddOns::V1::InstallStatus]
738
+ #
739
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
740
+ def get_install_status request, options = nil
741
+ raise ::ArgumentError, "request must be provided" if request.nil?
742
+
743
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GSuiteAddOns::V1::GetInstallStatusRequest
744
+
745
+ # Converts hash and nil to an options object
746
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
747
+
748
+ # Customize the options with defaults
749
+ call_metadata = @config.rpcs.get_install_status.metadata.to_h
750
+
751
+ # Set x-goog-api-client and x-goog-user-project headers
752
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
753
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
754
+ gapic_version: ::Google::Cloud::GSuiteAddOns::V1::VERSION,
755
+ transports_version_send: [:rest]
756
+
757
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
758
+
759
+ options.apply_defaults timeout: @config.rpcs.get_install_status.timeout,
760
+ metadata: call_metadata,
761
+ retry_policy: @config.rpcs.get_install_status.retry_policy
762
+
763
+ options.apply_defaults timeout: @config.timeout,
764
+ metadata: @config.metadata,
765
+ retry_policy: @config.retry_policy
766
+
767
+ @g_suite_add_ons_stub.get_install_status request, options do |result, operation|
768
+ yield result, operation if block_given?
769
+ return result
770
+ end
771
+ rescue ::Gapic::Rest::Error => e
772
+ raise ::Google::Cloud::Error.from_error(e)
773
+ end
774
+
775
+ ##
776
+ # Configuration class for the GSuiteAddOns REST API.
777
+ #
778
+ # This class represents the configuration for GSuiteAddOns REST,
779
+ # providing control over timeouts, retry behavior, logging, transport
780
+ # parameters, and other low-level controls. Certain parameters can also be
781
+ # applied individually to specific RPCs. See
782
+ # {::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client::Configuration::Rpcs}
783
+ # for a list of RPCs that can be configured independently.
784
+ #
785
+ # Configuration can be applied globally to all clients, or to a single client
786
+ # on construction.
787
+ #
788
+ # @example
789
+ #
790
+ # # Modify the global config, setting the timeout for
791
+ # # get_authorization to 20 seconds,
792
+ # # and all remaining timeouts to 10 seconds.
793
+ # ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client.configure do |config|
794
+ # config.timeout = 10.0
795
+ # config.rpcs.get_authorization.timeout = 20.0
796
+ # end
797
+ #
798
+ # # Apply the above configuration only to a new client.
799
+ # client = ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::Client.new do |config|
800
+ # config.timeout = 10.0
801
+ # config.rpcs.get_authorization.timeout = 20.0
802
+ # end
803
+ #
804
+ # @!attribute [rw] endpoint
805
+ # The hostname or hostname:port of the service endpoint.
806
+ # Defaults to `"gsuiteaddons.googleapis.com"`.
807
+ # @return [::String]
808
+ # @!attribute [rw] credentials
809
+ # Credentials to send with calls. You may provide any of the following types:
810
+ # * (`String`) The path to a service account key file in JSON format
811
+ # * (`Hash`) A service account key as a Hash
812
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
813
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
814
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
815
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
816
+ # * (`nil`) indicating no credentials
817
+ # @return [::Object]
818
+ # @!attribute [rw] scope
819
+ # The OAuth scopes
820
+ # @return [::Array<::String>]
821
+ # @!attribute [rw] lib_name
822
+ # The library name as recorded in instrumentation and logging
823
+ # @return [::String]
824
+ # @!attribute [rw] lib_version
825
+ # The library version as recorded in instrumentation and logging
826
+ # @return [::String]
827
+ # @!attribute [rw] timeout
828
+ # The call timeout in seconds.
829
+ # @return [::Numeric]
830
+ # @!attribute [rw] metadata
831
+ # Additional headers to be sent with the call.
832
+ # @return [::Hash{::Symbol=>::String}]
833
+ # @!attribute [rw] retry_policy
834
+ # The retry policy. The value is a hash with the following keys:
835
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
836
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
837
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
838
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
839
+ # trigger a retry.
840
+ # @return [::Hash]
841
+ # @!attribute [rw] quota_project
842
+ # A separate project against which to charge quota.
843
+ # @return [::String]
844
+ #
845
+ class Configuration
846
+ extend ::Gapic::Config
847
+
848
+ config_attr :endpoint, "gsuiteaddons.googleapis.com", ::String
849
+ config_attr :credentials, nil do |value|
850
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
851
+ allowed.any? { |klass| klass === value }
852
+ end
853
+ config_attr :scope, nil, ::String, ::Array, nil
854
+ config_attr :lib_name, nil, ::String, nil
855
+ config_attr :lib_version, nil, ::String, nil
856
+ config_attr :timeout, nil, ::Numeric, nil
857
+ config_attr :metadata, nil, ::Hash, nil
858
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
859
+ config_attr :quota_project, nil, ::String, nil
860
+
861
+ # @private
862
+ def initialize parent_config = nil
863
+ @parent_config = parent_config unless parent_config.nil?
864
+
865
+ yield self if block_given?
866
+ end
867
+
868
+ ##
869
+ # Configurations for individual RPCs
870
+ # @return [Rpcs]
871
+ #
872
+ def rpcs
873
+ @rpcs ||= begin
874
+ parent_rpcs = nil
875
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
876
+ Rpcs.new parent_rpcs
877
+ end
878
+ end
879
+
880
+ ##
881
+ # Configuration RPC class for the GSuiteAddOns API.
882
+ #
883
+ # Includes fields providing the configuration for each RPC in this service.
884
+ # Each configuration object is of type `Gapic::Config::Method` and includes
885
+ # the following configuration fields:
886
+ #
887
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
888
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
889
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
890
+ # include the following keys:
891
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
892
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
893
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
894
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
895
+ # trigger a retry.
896
+ #
897
+ class Rpcs
898
+ ##
899
+ # RPC-specific configuration for `get_authorization`
900
+ # @return [::Gapic::Config::Method]
901
+ #
902
+ attr_reader :get_authorization
903
+ ##
904
+ # RPC-specific configuration for `create_deployment`
905
+ # @return [::Gapic::Config::Method]
906
+ #
907
+ attr_reader :create_deployment
908
+ ##
909
+ # RPC-specific configuration for `replace_deployment`
910
+ # @return [::Gapic::Config::Method]
911
+ #
912
+ attr_reader :replace_deployment
913
+ ##
914
+ # RPC-specific configuration for `get_deployment`
915
+ # @return [::Gapic::Config::Method]
916
+ #
917
+ attr_reader :get_deployment
918
+ ##
919
+ # RPC-specific configuration for `list_deployments`
920
+ # @return [::Gapic::Config::Method]
921
+ #
922
+ attr_reader :list_deployments
923
+ ##
924
+ # RPC-specific configuration for `delete_deployment`
925
+ # @return [::Gapic::Config::Method]
926
+ #
927
+ attr_reader :delete_deployment
928
+ ##
929
+ # RPC-specific configuration for `install_deployment`
930
+ # @return [::Gapic::Config::Method]
931
+ #
932
+ attr_reader :install_deployment
933
+ ##
934
+ # RPC-specific configuration for `uninstall_deployment`
935
+ # @return [::Gapic::Config::Method]
936
+ #
937
+ attr_reader :uninstall_deployment
938
+ ##
939
+ # RPC-specific configuration for `get_install_status`
940
+ # @return [::Gapic::Config::Method]
941
+ #
942
+ attr_reader :get_install_status
943
+
944
+ # @private
945
+ def initialize parent_rpcs = nil
946
+ get_authorization_config = parent_rpcs.get_authorization if parent_rpcs.respond_to? :get_authorization
947
+ @get_authorization = ::Gapic::Config::Method.new get_authorization_config
948
+ create_deployment_config = parent_rpcs.create_deployment if parent_rpcs.respond_to? :create_deployment
949
+ @create_deployment = ::Gapic::Config::Method.new create_deployment_config
950
+ replace_deployment_config = parent_rpcs.replace_deployment if parent_rpcs.respond_to? :replace_deployment
951
+ @replace_deployment = ::Gapic::Config::Method.new replace_deployment_config
952
+ get_deployment_config = parent_rpcs.get_deployment if parent_rpcs.respond_to? :get_deployment
953
+ @get_deployment = ::Gapic::Config::Method.new get_deployment_config
954
+ list_deployments_config = parent_rpcs.list_deployments if parent_rpcs.respond_to? :list_deployments
955
+ @list_deployments = ::Gapic::Config::Method.new list_deployments_config
956
+ delete_deployment_config = parent_rpcs.delete_deployment if parent_rpcs.respond_to? :delete_deployment
957
+ @delete_deployment = ::Gapic::Config::Method.new delete_deployment_config
958
+ install_deployment_config = parent_rpcs.install_deployment if parent_rpcs.respond_to? :install_deployment
959
+ @install_deployment = ::Gapic::Config::Method.new install_deployment_config
960
+ uninstall_deployment_config = parent_rpcs.uninstall_deployment if parent_rpcs.respond_to? :uninstall_deployment
961
+ @uninstall_deployment = ::Gapic::Config::Method.new uninstall_deployment_config
962
+ get_install_status_config = parent_rpcs.get_install_status if parent_rpcs.respond_to? :get_install_status
963
+ @get_install_status = ::Gapic::Config::Method.new get_install_status_config
964
+
965
+ yield self if block_given?
966
+ end
967
+ end
968
+ end
969
+ end
970
+ end
971
+ end
972
+ end
973
+ end
974
+ end
975
+ end