google-ads-marketing_platform-admin-v1alpha 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.
Files changed (29) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +154 -0
  6. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/client.rb +877 -0
  7. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/credentials.rb +50 -0
  8. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/paths.rb +94 -0
  9. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/rest/client.rb +816 -0
  10. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/rest/service_stub.rb +390 -0
  11. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service/rest.rb +54 -0
  12. data/lib/google/ads/marketing_platform/admin/v1alpha/marketingplatform_admin_service.rb +57 -0
  13. data/lib/google/ads/marketing_platform/admin/v1alpha/rest.rb +39 -0
  14. data/lib/google/ads/marketing_platform/admin/v1alpha/version.rb +30 -0
  15. data/lib/google/ads/marketing_platform/admin/v1alpha.rb +47 -0
  16. data/lib/google/marketingplatform/admin/v1alpha/marketingplatform_admin_pb.rb +59 -0
  17. data/lib/google/marketingplatform/admin/v1alpha/marketingplatform_admin_services_pb.rb +65 -0
  18. data/lib/google/marketingplatform/admin/v1alpha/resources_pb.rb +49 -0
  19. data/lib/google-ads-marketing_platform-admin-v1alpha.rb +21 -0
  20. data/proto_docs/README.md +4 -0
  21. data/proto_docs/google/api/client.rb +473 -0
  22. data/proto_docs/google/api/field_behavior.rb +85 -0
  23. data/proto_docs/google/api/launch_stage.rb +71 -0
  24. data/proto_docs/google/api/resource.rb +227 -0
  25. data/proto_docs/google/marketingplatform/admin/v1alpha/marketingplatform_admin.rb +138 -0
  26. data/proto_docs/google/marketingplatform/admin/v1alpha/resources.rb +84 -0
  27. data/proto_docs/google/protobuf/duration.rb +98 -0
  28. data/proto_docs/google/protobuf/empty.rb +34 -0
  29. metadata +103 -0
@@ -0,0 +1,877 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/marketingplatform/admin/v1alpha/marketingplatform_admin_pb"
21
+
22
+ module Google
23
+ module Ads
24
+ module MarketingPlatform
25
+ module Admin
26
+ module V1alpha
27
+ module MarketingplatformAdminService
28
+ ##
29
+ # Client for the MarketingplatformAdminService service.
30
+ #
31
+ # Service Interface for the Google Marketing Platform Admin API.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "marketingplatformadmin.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :marketingplatform_admin_service_stub
44
+
45
+ ##
46
+ # Configure the MarketingplatformAdminService Client class.
47
+ #
48
+ # See {::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all MarketingplatformAdminService clients
54
+ # ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Ads", "MarketingPlatform", "Admin", "V1alpha"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.timeout = 60.0
75
+ default_config.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
77
+ }
78
+
79
+ default_config
80
+ end
81
+ yield @configure if block_given?
82
+ @configure
83
+ end
84
+
85
+ ##
86
+ # Configure the MarketingplatformAdminService Client instance.
87
+ #
88
+ # The configuration is set to the derived mode, meaning that values can be changed,
89
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
90
+ # should be made on {Client.configure}.
91
+ #
92
+ # See {::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client::Configuration}
93
+ # for a description of the configuration fields.
94
+ #
95
+ # @yield [config] Configure the Client client.
96
+ # @yieldparam config [Client::Configuration]
97
+ #
98
+ # @return [Client::Configuration]
99
+ #
100
+ def configure
101
+ yield @config if block_given?
102
+ @config
103
+ end
104
+
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @marketingplatform_admin_service_stub.universe_domain
112
+ end
113
+
114
+ ##
115
+ # Create a new MarketingplatformAdminService client object.
116
+ #
117
+ # @example
118
+ #
119
+ # # Create a client using the default configuration
120
+ # client = ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
121
+ #
122
+ # # Create a client using a custom configuration
123
+ # client = ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new do |config|
124
+ # config.timeout = 10.0
125
+ # end
126
+ #
127
+ # @yield [config] Configure the MarketingplatformAdminService client.
128
+ # @yieldparam config [Client::Configuration]
129
+ #
130
+ def initialize
131
+ # These require statements are intentionally placed here to initialize
132
+ # the gRPC module only when it's required.
133
+ # See https://github.com/googleapis/toolkit/issues/446
134
+ require "gapic/grpc"
135
+ require "google/marketingplatform/admin/v1alpha/marketingplatform_admin_services_pb"
136
+
137
+ # Create the configuration object
138
+ @config = Configuration.new Client.configure
139
+
140
+ # Yield the configuration if needed
141
+ yield @config if block_given?
142
+
143
+ # Create credentials
144
+ credentials = @config.credentials
145
+ # Use self-signed JWT if the endpoint is unchanged from default,
146
+ # but only if the default endpoint does not have a region prefix.
147
+ enable_self_signed_jwt = @config.endpoint.nil? ||
148
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
149
+ !@config.endpoint.split(".").first.include?("-"))
150
+ credentials ||= Credentials.default scope: @config.scope,
151
+ enable_self_signed_jwt: enable_self_signed_jwt
152
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
153
+ credentials = Credentials.new credentials, scope: @config.scope
154
+ end
155
+ @quota_project_id = @config.quota_project
156
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
+
158
+ @marketingplatform_admin_service_stub = ::Gapic::ServiceStub.new(
159
+ ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Stub,
160
+ credentials: credentials,
161
+ endpoint: @config.endpoint,
162
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
+ universe_domain: @config.universe_domain,
164
+ channel_args: @config.channel_args,
165
+ interceptors: @config.interceptors,
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
168
+ )
169
+
170
+ @marketingplatform_admin_service_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+ end
180
+
181
+ ##
182
+ # The logger used for request/response debug logging.
183
+ #
184
+ # @return [Logger]
185
+ #
186
+ def logger
187
+ @marketingplatform_admin_service_stub.logger
188
+ end
189
+
190
+ # Service calls
191
+
192
+ ##
193
+ # Lookup for a single organization.
194
+ #
195
+ # @overload get_organization(request, options = nil)
196
+ # Pass arguments to `get_organization` via a request object, either of type
197
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::GetOrganizationRequest} or an equivalent Hash.
198
+ #
199
+ # @param request [::Google::Ads::MarketingPlatform::Admin::V1alpha::GetOrganizationRequest, ::Hash]
200
+ # A request object representing the call parameters. Required. To specify no
201
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
202
+ # @param options [::Gapic::CallOptions, ::Hash]
203
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
204
+ #
205
+ # @overload get_organization(name: nil)
206
+ # Pass arguments to `get_organization` via keyword arguments. Note that at
207
+ # least one keyword argument is required. To specify no parameters, or to keep all
208
+ # the default parameter values, pass an empty Hash as a request object (see above).
209
+ #
210
+ # @param name [::String]
211
+ # Required. The name of the Organization to retrieve.
212
+ # Format: organizations/\\{org_id}
213
+ #
214
+ # @yield [response, operation] Access the result along with the RPC operation
215
+ # @yieldparam response [::Google::Ads::MarketingPlatform::Admin::V1alpha::Organization]
216
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
217
+ #
218
+ # @return [::Google::Ads::MarketingPlatform::Admin::V1alpha::Organization]
219
+ #
220
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
221
+ #
222
+ # @example Basic example
223
+ # require "google/ads/marketing_platform/admin/v1alpha"
224
+ #
225
+ # # Create a client object. The client can be reused for multiple calls.
226
+ # client = Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
227
+ #
228
+ # # Create a request. To set request fields, pass in keyword arguments.
229
+ # request = Google::Ads::MarketingPlatform::Admin::V1alpha::GetOrganizationRequest.new
230
+ #
231
+ # # Call the get_organization method.
232
+ # result = client.get_organization request
233
+ #
234
+ # # The returned object is of type Google::Ads::MarketingPlatform::Admin::V1alpha::Organization.
235
+ # p result
236
+ #
237
+ def get_organization request, options = nil
238
+ raise ::ArgumentError, "request must be provided" if request.nil?
239
+
240
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Ads::MarketingPlatform::Admin::V1alpha::GetOrganizationRequest
241
+
242
+ # Converts hash and nil to an options object
243
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
244
+
245
+ # Customize the options with defaults
246
+ metadata = @config.rpcs.get_organization.metadata.to_h
247
+
248
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
249
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
250
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
251
+ gapic_version: ::Google::Ads::MarketingPlatform::Admin::V1alpha::VERSION
252
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
253
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
254
+
255
+ header_params = {}
256
+ if request.name
257
+ header_params["name"] = request.name
258
+ end
259
+
260
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
261
+ metadata[:"x-goog-request-params"] ||= request_params_header
262
+
263
+ options.apply_defaults timeout: @config.rpcs.get_organization.timeout,
264
+ metadata: metadata,
265
+ retry_policy: @config.rpcs.get_organization.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @marketingplatform_admin_service_stub.call_rpc :get_organization, request, options: options do |response, operation|
272
+ yield response, operation if block_given?
273
+ end
274
+ rescue ::GRPC::BadStatus => e
275
+ raise ::Google::Cloud::Error.from_error(e)
276
+ end
277
+
278
+ ##
279
+ # Lists the Google Analytics accounts link to the specified Google Marketing
280
+ # Platform organization.
281
+ #
282
+ # @overload list_analytics_account_links(request, options = nil)
283
+ # Pass arguments to `list_analytics_account_links` via a request object, either of type
284
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::ListAnalyticsAccountLinksRequest} or an equivalent Hash.
285
+ #
286
+ # @param request [::Google::Ads::MarketingPlatform::Admin::V1alpha::ListAnalyticsAccountLinksRequest, ::Hash]
287
+ # A request object representing the call parameters. Required. To specify no
288
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
289
+ # @param options [::Gapic::CallOptions, ::Hash]
290
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
291
+ #
292
+ # @overload list_analytics_account_links(parent: nil, page_size: nil, page_token: nil)
293
+ # Pass arguments to `list_analytics_account_links` via keyword arguments. Note that at
294
+ # least one keyword argument is required. To specify no parameters, or to keep all
295
+ # the default parameter values, pass an empty Hash as a request object (see above).
296
+ #
297
+ # @param parent [::String]
298
+ # Required. The parent organization, which owns this collection of Analytics
299
+ # account links. Format: organizations/\\{org_id}
300
+ # @param page_size [::Integer]
301
+ # Optional. The maximum number of Analytics account links to return in one
302
+ # call. The service may return fewer than this value.
303
+ #
304
+ # If unspecified, at most 50 Analytics account links will be returned. The
305
+ # maximum value is 1000; values above 1000 will be coerced to 1000.
306
+ # @param page_token [::String]
307
+ # Optional. A page token, received from a previous ListAnalyticsAccountLinks
308
+ # call. Provide this to retrieve the subsequent page.
309
+ #
310
+ # When paginating, all other parameters provided to
311
+ # `ListAnalyticsAccountLinks` must match the call that provided the page
312
+ # token.
313
+ #
314
+ # @yield [response, operation] Access the result along with the RPC operation
315
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink>]
316
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
317
+ #
318
+ # @return [::Gapic::PagedEnumerable<::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink>]
319
+ #
320
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
321
+ #
322
+ # @example Basic example
323
+ # require "google/ads/marketing_platform/admin/v1alpha"
324
+ #
325
+ # # Create a client object. The client can be reused for multiple calls.
326
+ # client = Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
327
+ #
328
+ # # Create a request. To set request fields, pass in keyword arguments.
329
+ # request = Google::Ads::MarketingPlatform::Admin::V1alpha::ListAnalyticsAccountLinksRequest.new
330
+ #
331
+ # # Call the list_analytics_account_links method.
332
+ # result = client.list_analytics_account_links request
333
+ #
334
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
335
+ # # over elements, and API calls will be issued to fetch pages as needed.
336
+ # result.each do |item|
337
+ # # Each element is of type ::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink.
338
+ # p item
339
+ # end
340
+ #
341
+ def list_analytics_account_links request, options = nil
342
+ raise ::ArgumentError, "request must be provided" if request.nil?
343
+
344
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Ads::MarketingPlatform::Admin::V1alpha::ListAnalyticsAccountLinksRequest
345
+
346
+ # Converts hash and nil to an options object
347
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
348
+
349
+ # Customize the options with defaults
350
+ metadata = @config.rpcs.list_analytics_account_links.metadata.to_h
351
+
352
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
353
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
354
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
355
+ gapic_version: ::Google::Ads::MarketingPlatform::Admin::V1alpha::VERSION
356
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
357
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
+
359
+ header_params = {}
360
+ if request.parent
361
+ header_params["parent"] = request.parent
362
+ end
363
+
364
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
365
+ metadata[:"x-goog-request-params"] ||= request_params_header
366
+
367
+ options.apply_defaults timeout: @config.rpcs.list_analytics_account_links.timeout,
368
+ metadata: metadata,
369
+ retry_policy: @config.rpcs.list_analytics_account_links.retry_policy
370
+
371
+ options.apply_defaults timeout: @config.timeout,
372
+ metadata: @config.metadata,
373
+ retry_policy: @config.retry_policy
374
+
375
+ @marketingplatform_admin_service_stub.call_rpc :list_analytics_account_links, request, options: options do |response, operation|
376
+ response = ::Gapic::PagedEnumerable.new @marketingplatform_admin_service_stub, :list_analytics_account_links, request, response, operation, options
377
+ yield response, operation if block_given?
378
+ throw :response, response
379
+ end
380
+ rescue ::GRPC::BadStatus => e
381
+ raise ::Google::Cloud::Error.from_error(e)
382
+ end
383
+
384
+ ##
385
+ # Creates the link between the Analytics account and the Google Marketing
386
+ # Platform organization.
387
+ #
388
+ # User needs to be an org user, and admin on the Analytics account to create
389
+ # the link. If the account is already linked to an organization, user needs
390
+ # to unlink the account from the current organization, then try link again.
391
+ #
392
+ # @overload create_analytics_account_link(request, options = nil)
393
+ # Pass arguments to `create_analytics_account_link` via a request object, either of type
394
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::CreateAnalyticsAccountLinkRequest} or an equivalent Hash.
395
+ #
396
+ # @param request [::Google::Ads::MarketingPlatform::Admin::V1alpha::CreateAnalyticsAccountLinkRequest, ::Hash]
397
+ # A request object representing the call parameters. Required. To specify no
398
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
399
+ # @param options [::Gapic::CallOptions, ::Hash]
400
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
401
+ #
402
+ # @overload create_analytics_account_link(parent: nil, analytics_account_link: nil)
403
+ # Pass arguments to `create_analytics_account_link` via keyword arguments. Note that at
404
+ # least one keyword argument is required. To specify no parameters, or to keep all
405
+ # the default parameter values, pass an empty Hash as a request object (see above).
406
+ #
407
+ # @param parent [::String]
408
+ # Required. The parent resource where this Analytics account link will be
409
+ # created. Format: organizations/\\{org_id}
410
+ # @param analytics_account_link [::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink, ::Hash]
411
+ # Required. The Analytics account link to create.
412
+ #
413
+ # @yield [response, operation] Access the result along with the RPC operation
414
+ # @yieldparam response [::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink]
415
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
416
+ #
417
+ # @return [::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink]
418
+ #
419
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
420
+ #
421
+ # @example Basic example
422
+ # require "google/ads/marketing_platform/admin/v1alpha"
423
+ #
424
+ # # Create a client object. The client can be reused for multiple calls.
425
+ # client = Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
426
+ #
427
+ # # Create a request. To set request fields, pass in keyword arguments.
428
+ # request = Google::Ads::MarketingPlatform::Admin::V1alpha::CreateAnalyticsAccountLinkRequest.new
429
+ #
430
+ # # Call the create_analytics_account_link method.
431
+ # result = client.create_analytics_account_link request
432
+ #
433
+ # # The returned object is of type Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsAccountLink.
434
+ # p result
435
+ #
436
+ def create_analytics_account_link request, options = nil
437
+ raise ::ArgumentError, "request must be provided" if request.nil?
438
+
439
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Ads::MarketingPlatform::Admin::V1alpha::CreateAnalyticsAccountLinkRequest
440
+
441
+ # Converts hash and nil to an options object
442
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
443
+
444
+ # Customize the options with defaults
445
+ metadata = @config.rpcs.create_analytics_account_link.metadata.to_h
446
+
447
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
448
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
449
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
450
+ gapic_version: ::Google::Ads::MarketingPlatform::Admin::V1alpha::VERSION
451
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
452
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
453
+
454
+ header_params = {}
455
+ if request.parent
456
+ header_params["parent"] = request.parent
457
+ end
458
+
459
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
460
+ metadata[:"x-goog-request-params"] ||= request_params_header
461
+
462
+ options.apply_defaults timeout: @config.rpcs.create_analytics_account_link.timeout,
463
+ metadata: metadata,
464
+ retry_policy: @config.rpcs.create_analytics_account_link.retry_policy
465
+
466
+ options.apply_defaults timeout: @config.timeout,
467
+ metadata: @config.metadata,
468
+ retry_policy: @config.retry_policy
469
+
470
+ @marketingplatform_admin_service_stub.call_rpc :create_analytics_account_link, request, options: options do |response, operation|
471
+ yield response, operation if block_given?
472
+ end
473
+ rescue ::GRPC::BadStatus => e
474
+ raise ::Google::Cloud::Error.from_error(e)
475
+ end
476
+
477
+ ##
478
+ # Deletes the AnalyticsAccountLink, which detaches the Analytics account from
479
+ # the Google Marketing Platform organization.
480
+ #
481
+ # User needs to be an org user, and admin on the Analytics account in order
482
+ # to delete the link.
483
+ #
484
+ # @overload delete_analytics_account_link(request, options = nil)
485
+ # Pass arguments to `delete_analytics_account_link` via a request object, either of type
486
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::DeleteAnalyticsAccountLinkRequest} or an equivalent Hash.
487
+ #
488
+ # @param request [::Google::Ads::MarketingPlatform::Admin::V1alpha::DeleteAnalyticsAccountLinkRequest, ::Hash]
489
+ # A request object representing the call parameters. Required. To specify no
490
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
491
+ # @param options [::Gapic::CallOptions, ::Hash]
492
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
493
+ #
494
+ # @overload delete_analytics_account_link(name: nil)
495
+ # Pass arguments to `delete_analytics_account_link` via keyword arguments. Note that at
496
+ # least one keyword argument is required. To specify no parameters, or to keep all
497
+ # the default parameter values, pass an empty Hash as a request object (see above).
498
+ #
499
+ # @param name [::String]
500
+ # Required. The name of the Analytics account link to delete.
501
+ # Format:
502
+ # organizations/\\{org_id}/analyticsAccountLinks/\\{analytics_account_link_id}
503
+ #
504
+ # @yield [response, operation] Access the result along with the RPC operation
505
+ # @yieldparam response [::Google::Protobuf::Empty]
506
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
507
+ #
508
+ # @return [::Google::Protobuf::Empty]
509
+ #
510
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
511
+ #
512
+ # @example Basic example
513
+ # require "google/ads/marketing_platform/admin/v1alpha"
514
+ #
515
+ # # Create a client object. The client can be reused for multiple calls.
516
+ # client = Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
517
+ #
518
+ # # Create a request. To set request fields, pass in keyword arguments.
519
+ # request = Google::Ads::MarketingPlatform::Admin::V1alpha::DeleteAnalyticsAccountLinkRequest.new
520
+ #
521
+ # # Call the delete_analytics_account_link method.
522
+ # result = client.delete_analytics_account_link request
523
+ #
524
+ # # The returned object is of type Google::Protobuf::Empty.
525
+ # p result
526
+ #
527
+ def delete_analytics_account_link request, options = nil
528
+ raise ::ArgumentError, "request must be provided" if request.nil?
529
+
530
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Ads::MarketingPlatform::Admin::V1alpha::DeleteAnalyticsAccountLinkRequest
531
+
532
+ # Converts hash and nil to an options object
533
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
534
+
535
+ # Customize the options with defaults
536
+ metadata = @config.rpcs.delete_analytics_account_link.metadata.to_h
537
+
538
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
539
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
540
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
541
+ gapic_version: ::Google::Ads::MarketingPlatform::Admin::V1alpha::VERSION
542
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
543
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
544
+
545
+ header_params = {}
546
+ if request.name
547
+ header_params["name"] = request.name
548
+ end
549
+
550
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
551
+ metadata[:"x-goog-request-params"] ||= request_params_header
552
+
553
+ options.apply_defaults timeout: @config.rpcs.delete_analytics_account_link.timeout,
554
+ metadata: metadata,
555
+ retry_policy: @config.rpcs.delete_analytics_account_link.retry_policy
556
+
557
+ options.apply_defaults timeout: @config.timeout,
558
+ metadata: @config.metadata,
559
+ retry_policy: @config.retry_policy
560
+
561
+ @marketingplatform_admin_service_stub.call_rpc :delete_analytics_account_link, request, options: options do |response, operation|
562
+ yield response, operation if block_given?
563
+ end
564
+ rescue ::GRPC::BadStatus => e
565
+ raise ::Google::Cloud::Error.from_error(e)
566
+ end
567
+
568
+ ##
569
+ # Updates the service level for an Analytics property.
570
+ #
571
+ # @overload set_property_service_level(request, options = nil)
572
+ # Pass arguments to `set_property_service_level` via a request object, either of type
573
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelRequest} or an equivalent Hash.
574
+ #
575
+ # @param request [::Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelRequest, ::Hash]
576
+ # A request object representing the call parameters. Required. To specify no
577
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
578
+ # @param options [::Gapic::CallOptions, ::Hash]
579
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
580
+ #
581
+ # @overload set_property_service_level(analytics_account_link: nil, analytics_property: nil, service_level: nil)
582
+ # Pass arguments to `set_property_service_level` via keyword arguments. Note that at
583
+ # least one keyword argument is required. To specify no parameters, or to keep all
584
+ # the default parameter values, pass an empty Hash as a request object (see above).
585
+ #
586
+ # @param analytics_account_link [::String]
587
+ # Required. The parent AnalyticsAccountLink scope where this property is in.
588
+ # Format:
589
+ # organizations/\\{org_id}/analyticsAccountLinks/\\{analytics_account_link_id}
590
+ # @param analytics_property [::String]
591
+ # Required. The Analytics property to change the ServiceLevel setting. This
592
+ # field is the name of the Google Analytics Admin API property resource.
593
+ #
594
+ # Format: analyticsadmin.googleapis.com/properties/\\{property_id}
595
+ # @param service_level [::Google::Ads::MarketingPlatform::Admin::V1alpha::AnalyticsServiceLevel]
596
+ # Required. The service level to set for this property.
597
+ #
598
+ # @yield [response, operation] Access the result along with the RPC operation
599
+ # @yieldparam response [::Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelResponse]
600
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
601
+ #
602
+ # @return [::Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelResponse]
603
+ #
604
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
605
+ #
606
+ # @example Basic example
607
+ # require "google/ads/marketing_platform/admin/v1alpha"
608
+ #
609
+ # # Create a client object. The client can be reused for multiple calls.
610
+ # client = Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new
611
+ #
612
+ # # Create a request. To set request fields, pass in keyword arguments.
613
+ # request = Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelRequest.new
614
+ #
615
+ # # Call the set_property_service_level method.
616
+ # result = client.set_property_service_level request
617
+ #
618
+ # # The returned object is of type Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelResponse.
619
+ # p result
620
+ #
621
+ def set_property_service_level request, options = nil
622
+ raise ::ArgumentError, "request must be provided" if request.nil?
623
+
624
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Ads::MarketingPlatform::Admin::V1alpha::SetPropertyServiceLevelRequest
625
+
626
+ # Converts hash and nil to an options object
627
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
628
+
629
+ # Customize the options with defaults
630
+ metadata = @config.rpcs.set_property_service_level.metadata.to_h
631
+
632
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
633
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
634
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
635
+ gapic_version: ::Google::Ads::MarketingPlatform::Admin::V1alpha::VERSION
636
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
637
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
638
+
639
+ header_params = {}
640
+ if request.analytics_account_link
641
+ header_params["analytics_account_link"] = request.analytics_account_link
642
+ end
643
+
644
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
645
+ metadata[:"x-goog-request-params"] ||= request_params_header
646
+
647
+ options.apply_defaults timeout: @config.rpcs.set_property_service_level.timeout,
648
+ metadata: metadata,
649
+ retry_policy: @config.rpcs.set_property_service_level.retry_policy
650
+
651
+ options.apply_defaults timeout: @config.timeout,
652
+ metadata: @config.metadata,
653
+ retry_policy: @config.retry_policy
654
+
655
+ @marketingplatform_admin_service_stub.call_rpc :set_property_service_level, request, options: options do |response, operation|
656
+ yield response, operation if block_given?
657
+ end
658
+ rescue ::GRPC::BadStatus => e
659
+ raise ::Google::Cloud::Error.from_error(e)
660
+ end
661
+
662
+ ##
663
+ # Configuration class for the MarketingplatformAdminService API.
664
+ #
665
+ # This class represents the configuration for MarketingplatformAdminService,
666
+ # providing control over timeouts, retry behavior, logging, transport
667
+ # parameters, and other low-level controls. Certain parameters can also be
668
+ # applied individually to specific RPCs. See
669
+ # {::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client::Configuration::Rpcs}
670
+ # for a list of RPCs that can be configured independently.
671
+ #
672
+ # Configuration can be applied globally to all clients, or to a single client
673
+ # on construction.
674
+ #
675
+ # @example
676
+ #
677
+ # # Modify the global config, setting the timeout for
678
+ # # get_organization to 20 seconds,
679
+ # # and all remaining timeouts to 10 seconds.
680
+ # ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.configure do |config|
681
+ # config.timeout = 10.0
682
+ # config.rpcs.get_organization.timeout = 20.0
683
+ # end
684
+ #
685
+ # # Apply the above configuration only to a new client.
686
+ # client = ::Google::Ads::MarketingPlatform::Admin::V1alpha::MarketingplatformAdminService::Client.new do |config|
687
+ # config.timeout = 10.0
688
+ # config.rpcs.get_organization.timeout = 20.0
689
+ # end
690
+ #
691
+ # @!attribute [rw] endpoint
692
+ # A custom service endpoint, as a hostname or hostname:port. The default is
693
+ # nil, indicating to use the default endpoint in the current universe domain.
694
+ # @return [::String,nil]
695
+ # @!attribute [rw] credentials
696
+ # Credentials to send with calls. You may provide any of the following types:
697
+ # * (`String`) The path to a service account key file in JSON format
698
+ # * (`Hash`) A service account key as a Hash
699
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
700
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
701
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
702
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
703
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
704
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
705
+ # * (`nil`) indicating no credentials
706
+ #
707
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
708
+ # external source for authentication to Google Cloud, you must validate it before
709
+ # providing it to a Google API client library. Providing an unvalidated credential
710
+ # configuration to Google APIs can compromise the security of your systems and data.
711
+ # For more information, refer to [Validate credential configurations from external
712
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
713
+ # @return [::Object]
714
+ # @!attribute [rw] scope
715
+ # The OAuth scopes
716
+ # @return [::Array<::String>]
717
+ # @!attribute [rw] lib_name
718
+ # The library name as recorded in instrumentation and logging
719
+ # @return [::String]
720
+ # @!attribute [rw] lib_version
721
+ # The library version as recorded in instrumentation and logging
722
+ # @return [::String]
723
+ # @!attribute [rw] channel_args
724
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
725
+ # `GRPC::Core::Channel` object is provided as the credential.
726
+ # @return [::Hash]
727
+ # @!attribute [rw] interceptors
728
+ # An array of interceptors that are run before calls are executed.
729
+ # @return [::Array<::GRPC::ClientInterceptor>]
730
+ # @!attribute [rw] timeout
731
+ # The call timeout in seconds.
732
+ # @return [::Numeric]
733
+ # @!attribute [rw] metadata
734
+ # Additional gRPC headers to be sent with the call.
735
+ # @return [::Hash{::Symbol=>::String}]
736
+ # @!attribute [rw] retry_policy
737
+ # The retry policy. The value is a hash with the following keys:
738
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
739
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
740
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
741
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
742
+ # trigger a retry.
743
+ # @return [::Hash]
744
+ # @!attribute [rw] quota_project
745
+ # A separate project against which to charge quota.
746
+ # @return [::String]
747
+ # @!attribute [rw] universe_domain
748
+ # The universe domain within which to make requests. This determines the
749
+ # default endpoint URL. The default value of nil uses the environment
750
+ # universe (usually the default "googleapis.com" universe).
751
+ # @return [::String,nil]
752
+ # @!attribute [rw] logger
753
+ # A custom logger to use for request/response debug logging, or the value
754
+ # `:default` (the default) to construct a default logger, or `nil` to
755
+ # explicitly disable logging.
756
+ # @return [::Logger,:default,nil]
757
+ #
758
+ class Configuration
759
+ extend ::Gapic::Config
760
+
761
+ # @private
762
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
763
+ DEFAULT_ENDPOINT = "marketingplatformadmin.googleapis.com"
764
+
765
+ config_attr :endpoint, nil, ::String, nil
766
+ config_attr :credentials, nil do |value|
767
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
768
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
769
+ allowed.any? { |klass| klass === value }
770
+ end
771
+ config_attr :scope, nil, ::String, ::Array, nil
772
+ config_attr :lib_name, nil, ::String, nil
773
+ config_attr :lib_version, nil, ::String, nil
774
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
775
+ config_attr :interceptors, nil, ::Array, nil
776
+ config_attr :timeout, nil, ::Numeric, nil
777
+ config_attr :metadata, nil, ::Hash, nil
778
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
779
+ config_attr :quota_project, nil, ::String, nil
780
+ config_attr :universe_domain, nil, ::String, nil
781
+ config_attr :logger, :default, ::Logger, nil, :default
782
+
783
+ # @private
784
+ def initialize parent_config = nil
785
+ @parent_config = parent_config unless parent_config.nil?
786
+
787
+ yield self if block_given?
788
+ end
789
+
790
+ ##
791
+ # Configurations for individual RPCs
792
+ # @return [Rpcs]
793
+ #
794
+ def rpcs
795
+ @rpcs ||= begin
796
+ parent_rpcs = nil
797
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
798
+ Rpcs.new parent_rpcs
799
+ end
800
+ end
801
+
802
+ ##
803
+ # Configuration for the channel pool
804
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
805
+ #
806
+ def channel_pool
807
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
808
+ end
809
+
810
+ ##
811
+ # Configuration RPC class for the MarketingplatformAdminService API.
812
+ #
813
+ # Includes fields providing the configuration for each RPC in this service.
814
+ # Each configuration object is of type `Gapic::Config::Method` and includes
815
+ # the following configuration fields:
816
+ #
817
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
818
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
819
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
820
+ # include the following keys:
821
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
822
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
823
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
824
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
825
+ # trigger a retry.
826
+ #
827
+ class Rpcs
828
+ ##
829
+ # RPC-specific configuration for `get_organization`
830
+ # @return [::Gapic::Config::Method]
831
+ #
832
+ attr_reader :get_organization
833
+ ##
834
+ # RPC-specific configuration for `list_analytics_account_links`
835
+ # @return [::Gapic::Config::Method]
836
+ #
837
+ attr_reader :list_analytics_account_links
838
+ ##
839
+ # RPC-specific configuration for `create_analytics_account_link`
840
+ # @return [::Gapic::Config::Method]
841
+ #
842
+ attr_reader :create_analytics_account_link
843
+ ##
844
+ # RPC-specific configuration for `delete_analytics_account_link`
845
+ # @return [::Gapic::Config::Method]
846
+ #
847
+ attr_reader :delete_analytics_account_link
848
+ ##
849
+ # RPC-specific configuration for `set_property_service_level`
850
+ # @return [::Gapic::Config::Method]
851
+ #
852
+ attr_reader :set_property_service_level
853
+
854
+ # @private
855
+ def initialize parent_rpcs = nil
856
+ get_organization_config = parent_rpcs.get_organization if parent_rpcs.respond_to? :get_organization
857
+ @get_organization = ::Gapic::Config::Method.new get_organization_config
858
+ list_analytics_account_links_config = parent_rpcs.list_analytics_account_links if parent_rpcs.respond_to? :list_analytics_account_links
859
+ @list_analytics_account_links = ::Gapic::Config::Method.new list_analytics_account_links_config
860
+ create_analytics_account_link_config = parent_rpcs.create_analytics_account_link if parent_rpcs.respond_to? :create_analytics_account_link
861
+ @create_analytics_account_link = ::Gapic::Config::Method.new create_analytics_account_link_config
862
+ delete_analytics_account_link_config = parent_rpcs.delete_analytics_account_link if parent_rpcs.respond_to? :delete_analytics_account_link
863
+ @delete_analytics_account_link = ::Gapic::Config::Method.new delete_analytics_account_link_config
864
+ set_property_service_level_config = parent_rpcs.set_property_service_level if parent_rpcs.respond_to? :set_property_service_level
865
+ @set_property_service_level = ::Gapic::Config::Method.new set_property_service_level_config
866
+
867
+ yield self if block_given?
868
+ end
869
+ end
870
+ end
871
+ end
872
+ end
873
+ end
874
+ end
875
+ end
876
+ end
877
+ end