google-cloud-bigquery-analytics_hub-v1 0.3.0 → 0.5.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.
@@ -36,6 +36,9 @@ module Google
36
36
  # dataset in your project.
37
37
  #
38
38
  class Client
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "analyticshub.$UNIVERSE_DOMAIN$"
41
+
39
42
  include Paths
40
43
 
41
44
  # @private
@@ -101,6 +104,15 @@ module Google
101
104
  @config
102
105
  end
103
106
 
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @analytics_hub_service_stub.universe_domain
114
+ end
115
+
104
116
  ##
105
117
  # Create a new AnalyticsHubService client object.
106
118
  #
@@ -134,8 +146,9 @@ module Google
134
146
  credentials = @config.credentials
135
147
  # Use self-signed JWT if the endpoint is unchanged from default,
136
148
  # but only if the default endpoint does not have a region prefix.
137
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
138
- !@config.endpoint.split(".").first.include?("-")
149
+ enable_self_signed_jwt = @config.endpoint.nil? ||
150
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
151
+ !@config.endpoint.split(".").first.include?("-"))
139
152
  credentials ||= Credentials.default scope: @config.scope,
140
153
  enable_self_signed_jwt: enable_self_signed_jwt
141
154
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -144,16 +157,32 @@ module Google
144
157
  @quota_project_id = @config.quota_project
145
158
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
159
 
160
+ @operations_client = Operations.new do |config|
161
+ config.credentials = credentials
162
+ config.quota_project = @quota_project_id
163
+ config.endpoint = @config.endpoint
164
+ config.universe_domain = @config.universe_domain
165
+ end
166
+
147
167
  @analytics_hub_service_stub = ::Gapic::ServiceStub.new(
148
168
  ::Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Stub,
149
- credentials: credentials,
150
- endpoint: @config.endpoint,
169
+ credentials: credentials,
170
+ endpoint: @config.endpoint,
171
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
172
+ universe_domain: @config.universe_domain,
151
173
  channel_args: @config.channel_args,
152
174
  interceptors: @config.interceptors,
153
175
  channel_pool_config: @config.channel_pool
154
176
  )
155
177
  end
156
178
 
179
+ ##
180
+ # Get the associated client for long-running operations.
181
+ #
182
+ # @return [::Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Operations]
183
+ #
184
+ attr_reader :operations_client
185
+
157
186
  # Service calls
158
187
 
159
188
  ##
@@ -273,8 +302,8 @@ module Google
273
302
  # the default parameter values, pass an empty Hash as a request object (see above).
274
303
  #
275
304
  # @param organization [::String]
276
- # Required. The organization resource path of the projects containing DataExchanges.
277
- # e.g. `organizations/myorg/locations/US`.
305
+ # Required. The organization resource path of the projects containing
306
+ # DataExchanges. e.g. `organizations/myorg/locations/US`.
278
307
  # @param page_size [::Integer]
279
308
  # The maximum number of results to return in a single response page. Leverage
280
309
  # the page tokens to iterate through the entire collection.
@@ -639,8 +668,8 @@ module Google
639
668
  # the default parameter values, pass an empty Hash as a request object (see above).
640
669
  #
641
670
  # @param name [::String]
642
- # Required. The full name of the data exchange resource that you want to delete.
643
- # For example, `projects/myproject/locations/US/dataExchanges/123`.
671
+ # Required. The full name of the data exchange resource that you want to
672
+ # delete. For example, `projects/myproject/locations/US/dataExchanges/123`.
644
673
  #
645
674
  # @yield [response, operation] Access the result along with the RPC operation
646
675
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -1002,9 +1031,9 @@ module Google
1002
1031
  # the default parameter values, pass an empty Hash as a request object (see above).
1003
1032
  #
1004
1033
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1005
- # Required. Field mask specifies the fields to update in the listing resource. The
1006
- # fields specified in the `updateMask` are relative to the resource and are
1007
- # not a full request.
1034
+ # Required. Field mask specifies the fields to update in the listing
1035
+ # resource. The fields specified in the `updateMask` are relative to the
1036
+ # resource and are not a full request.
1008
1037
  # @param listing [::Google::Cloud::Bigquery::AnalyticsHub::V1::Listing, ::Hash]
1009
1038
  # Required. The listing to update.
1010
1039
  #
@@ -1251,6 +1280,668 @@ module Google
1251
1280
  raise ::Google::Cloud::Error.from_error(e)
1252
1281
  end
1253
1282
 
1283
+ ##
1284
+ # Creates a Subscription to a Data Exchange. This is a long-running operation
1285
+ # as it will create one or more linked datasets.
1286
+ #
1287
+ # @overload subscribe_data_exchange(request, options = nil)
1288
+ # Pass arguments to `subscribe_data_exchange` via a request object, either of type
1289
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::SubscribeDataExchangeRequest} or an equivalent Hash.
1290
+ #
1291
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::SubscribeDataExchangeRequest, ::Hash]
1292
+ # A request object representing the call parameters. Required. To specify no
1293
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1294
+ # @param options [::Gapic::CallOptions, ::Hash]
1295
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1296
+ #
1297
+ # @overload subscribe_data_exchange(name: nil, destination: nil, subscription: nil, subscriber_contact: nil)
1298
+ # Pass arguments to `subscribe_data_exchange` via keyword arguments. Note that at
1299
+ # least one keyword argument is required. To specify no parameters, or to keep all
1300
+ # the default parameter values, pass an empty Hash as a request object (see above).
1301
+ #
1302
+ # @param name [::String]
1303
+ # Required. Resource name of the Data Exchange.
1304
+ # e.g. `projects/publisherproject/locations/US/dataExchanges/123`
1305
+ # @param destination [::String]
1306
+ # Required. The parent resource path of the Subscription.
1307
+ # e.g. `projects/subscriberproject/locations/US`
1308
+ # @param subscription [::String]
1309
+ # Required. Name of the subscription to create.
1310
+ # e.g. `subscription1`
1311
+ # @param subscriber_contact [::String]
1312
+ # Email of the subscriber.
1313
+ #
1314
+ # @yield [response, operation] Access the result along with the RPC operation
1315
+ # @yieldparam response [::Gapic::Operation]
1316
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1317
+ #
1318
+ # @return [::Gapic::Operation]
1319
+ #
1320
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1321
+ #
1322
+ # @example Basic example
1323
+ # require "google/cloud/bigquery/analytics_hub/v1"
1324
+ #
1325
+ # # Create a client object. The client can be reused for multiple calls.
1326
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1327
+ #
1328
+ # # Create a request. To set request fields, pass in keyword arguments.
1329
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::SubscribeDataExchangeRequest.new
1330
+ #
1331
+ # # Call the subscribe_data_exchange method.
1332
+ # result = client.subscribe_data_exchange request
1333
+ #
1334
+ # # The returned object is of type Gapic::Operation. You can use it to
1335
+ # # check the status of an operation, cancel it, or wait for results.
1336
+ # # Here is how to wait for a response.
1337
+ # result.wait_until_done! timeout: 60
1338
+ # if result.response?
1339
+ # p result.response
1340
+ # else
1341
+ # puts "No response received."
1342
+ # end
1343
+ #
1344
+ def subscribe_data_exchange request, options = nil
1345
+ raise ::ArgumentError, "request must be provided" if request.nil?
1346
+
1347
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::SubscribeDataExchangeRequest
1348
+
1349
+ # Converts hash and nil to an options object
1350
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1351
+
1352
+ # Customize the options with defaults
1353
+ metadata = @config.rpcs.subscribe_data_exchange.metadata.to_h
1354
+
1355
+ # Set x-goog-api-client and x-goog-user-project headers
1356
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1357
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1358
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1359
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1360
+
1361
+ header_params = {}
1362
+ if request.name
1363
+ header_params["name"] = request.name
1364
+ end
1365
+
1366
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1367
+ metadata[:"x-goog-request-params"] ||= request_params_header
1368
+
1369
+ options.apply_defaults timeout: @config.rpcs.subscribe_data_exchange.timeout,
1370
+ metadata: metadata,
1371
+ retry_policy: @config.rpcs.subscribe_data_exchange.retry_policy
1372
+
1373
+ options.apply_defaults timeout: @config.timeout,
1374
+ metadata: @config.metadata,
1375
+ retry_policy: @config.retry_policy
1376
+
1377
+ @analytics_hub_service_stub.call_rpc :subscribe_data_exchange, request, options: options do |response, operation|
1378
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1379
+ yield response, operation if block_given?
1380
+ return response
1381
+ end
1382
+ rescue ::GRPC::BadStatus => e
1383
+ raise ::Google::Cloud::Error.from_error(e)
1384
+ end
1385
+
1386
+ ##
1387
+ # Refreshes a Subscription to a Data Exchange. A Data Exchange can become
1388
+ # stale when a publisher adds or removes data. This is a long-running
1389
+ # operation as it may create many linked datasets.
1390
+ #
1391
+ # @overload refresh_subscription(request, options = nil)
1392
+ # Pass arguments to `refresh_subscription` via a request object, either of type
1393
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::RefreshSubscriptionRequest} or an equivalent Hash.
1394
+ #
1395
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::RefreshSubscriptionRequest, ::Hash]
1396
+ # A request object representing the call parameters. Required. To specify no
1397
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1398
+ # @param options [::Gapic::CallOptions, ::Hash]
1399
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1400
+ #
1401
+ # @overload refresh_subscription(name: nil)
1402
+ # Pass arguments to `refresh_subscription` via keyword arguments. Note that at
1403
+ # least one keyword argument is required. To specify no parameters, or to keep all
1404
+ # the default parameter values, pass an empty Hash as a request object (see above).
1405
+ #
1406
+ # @param name [::String]
1407
+ # Required. Resource name of the Subscription to refresh.
1408
+ # e.g. `projects/subscriberproject/locations/US/subscriptions/123`
1409
+ #
1410
+ # @yield [response, operation] Access the result along with the RPC operation
1411
+ # @yieldparam response [::Gapic::Operation]
1412
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1413
+ #
1414
+ # @return [::Gapic::Operation]
1415
+ #
1416
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1417
+ #
1418
+ # @example Basic example
1419
+ # require "google/cloud/bigquery/analytics_hub/v1"
1420
+ #
1421
+ # # Create a client object. The client can be reused for multiple calls.
1422
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1423
+ #
1424
+ # # Create a request. To set request fields, pass in keyword arguments.
1425
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::RefreshSubscriptionRequest.new
1426
+ #
1427
+ # # Call the refresh_subscription method.
1428
+ # result = client.refresh_subscription request
1429
+ #
1430
+ # # The returned object is of type Gapic::Operation. You can use it to
1431
+ # # check the status of an operation, cancel it, or wait for results.
1432
+ # # Here is how to wait for a response.
1433
+ # result.wait_until_done! timeout: 60
1434
+ # if result.response?
1435
+ # p result.response
1436
+ # else
1437
+ # puts "No response received."
1438
+ # end
1439
+ #
1440
+ def refresh_subscription request, options = nil
1441
+ raise ::ArgumentError, "request must be provided" if request.nil?
1442
+
1443
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::RefreshSubscriptionRequest
1444
+
1445
+ # Converts hash and nil to an options object
1446
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1447
+
1448
+ # Customize the options with defaults
1449
+ metadata = @config.rpcs.refresh_subscription.metadata.to_h
1450
+
1451
+ # Set x-goog-api-client and x-goog-user-project headers
1452
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1453
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1454
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1455
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1456
+
1457
+ header_params = {}
1458
+ if request.name
1459
+ header_params["name"] = request.name
1460
+ end
1461
+
1462
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1463
+ metadata[:"x-goog-request-params"] ||= request_params_header
1464
+
1465
+ options.apply_defaults timeout: @config.rpcs.refresh_subscription.timeout,
1466
+ metadata: metadata,
1467
+ retry_policy: @config.rpcs.refresh_subscription.retry_policy
1468
+
1469
+ options.apply_defaults timeout: @config.timeout,
1470
+ metadata: @config.metadata,
1471
+ retry_policy: @config.retry_policy
1472
+
1473
+ @analytics_hub_service_stub.call_rpc :refresh_subscription, request, options: options do |response, operation|
1474
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1475
+ yield response, operation if block_given?
1476
+ return response
1477
+ end
1478
+ rescue ::GRPC::BadStatus => e
1479
+ raise ::Google::Cloud::Error.from_error(e)
1480
+ end
1481
+
1482
+ ##
1483
+ # Gets the details of a Subscription.
1484
+ #
1485
+ # @overload get_subscription(request, options = nil)
1486
+ # Pass arguments to `get_subscription` via a request object, either of type
1487
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::GetSubscriptionRequest} or an equivalent Hash.
1488
+ #
1489
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::GetSubscriptionRequest, ::Hash]
1490
+ # A request object representing the call parameters. Required. To specify no
1491
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1492
+ # @param options [::Gapic::CallOptions, ::Hash]
1493
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1494
+ #
1495
+ # @overload get_subscription(name: nil)
1496
+ # Pass arguments to `get_subscription` via keyword arguments. Note that at
1497
+ # least one keyword argument is required. To specify no parameters, or to keep all
1498
+ # the default parameter values, pass an empty Hash as a request object (see above).
1499
+ #
1500
+ # @param name [::String]
1501
+ # Required. Resource name of the subscription.
1502
+ # e.g. projects/123/locations/US/subscriptions/456
1503
+ #
1504
+ # @yield [response, operation] Access the result along with the RPC operation
1505
+ # @yieldparam response [::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription]
1506
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1507
+ #
1508
+ # @return [::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription]
1509
+ #
1510
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1511
+ #
1512
+ # @example Basic example
1513
+ # require "google/cloud/bigquery/analytics_hub/v1"
1514
+ #
1515
+ # # Create a client object. The client can be reused for multiple calls.
1516
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1517
+ #
1518
+ # # Create a request. To set request fields, pass in keyword arguments.
1519
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::GetSubscriptionRequest.new
1520
+ #
1521
+ # # Call the get_subscription method.
1522
+ # result = client.get_subscription request
1523
+ #
1524
+ # # The returned object is of type Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription.
1525
+ # p result
1526
+ #
1527
+ def get_subscription request, options = nil
1528
+ raise ::ArgumentError, "request must be provided" if request.nil?
1529
+
1530
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::GetSubscriptionRequest
1531
+
1532
+ # Converts hash and nil to an options object
1533
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1534
+
1535
+ # Customize the options with defaults
1536
+ metadata = @config.rpcs.get_subscription.metadata.to_h
1537
+
1538
+ # Set x-goog-api-client and x-goog-user-project headers
1539
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1540
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1541
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1542
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1543
+
1544
+ header_params = {}
1545
+ if request.name
1546
+ header_params["name"] = request.name
1547
+ end
1548
+
1549
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1550
+ metadata[:"x-goog-request-params"] ||= request_params_header
1551
+
1552
+ options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
1553
+ metadata: metadata,
1554
+ retry_policy: @config.rpcs.get_subscription.retry_policy
1555
+
1556
+ options.apply_defaults timeout: @config.timeout,
1557
+ metadata: @config.metadata,
1558
+ retry_policy: @config.retry_policy
1559
+
1560
+ @analytics_hub_service_stub.call_rpc :get_subscription, request, options: options do |response, operation|
1561
+ yield response, operation if block_given?
1562
+ return response
1563
+ end
1564
+ rescue ::GRPC::BadStatus => e
1565
+ raise ::Google::Cloud::Error.from_error(e)
1566
+ end
1567
+
1568
+ ##
1569
+ # Lists all subscriptions in a given project and location.
1570
+ #
1571
+ # @overload list_subscriptions(request, options = nil)
1572
+ # Pass arguments to `list_subscriptions` via a request object, either of type
1573
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSubscriptionsRequest} or an equivalent Hash.
1574
+ #
1575
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSubscriptionsRequest, ::Hash]
1576
+ # A request object representing the call parameters. Required. To specify no
1577
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1578
+ # @param options [::Gapic::CallOptions, ::Hash]
1579
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1580
+ #
1581
+ # @overload list_subscriptions(parent: nil, filter: nil, page_size: nil, page_token: nil)
1582
+ # Pass arguments to `list_subscriptions` via keyword arguments. Note that at
1583
+ # least one keyword argument is required. To specify no parameters, or to keep all
1584
+ # the default parameter values, pass an empty Hash as a request object (see above).
1585
+ #
1586
+ # @param parent [::String]
1587
+ # Required. The parent resource path of the subscription.
1588
+ # e.g. projects/myproject/locations/US
1589
+ # @param filter [::String]
1590
+ # The filter expression may be used to filter by Data Exchange or Listing.
1591
+ # @param page_size [::Integer]
1592
+ # The maximum number of results to return in a single response page.
1593
+ # @param page_token [::String]
1594
+ # Page token, returned by a previous call.
1595
+ #
1596
+ # @yield [response, operation] Access the result along with the RPC operation
1597
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription>]
1598
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1599
+ #
1600
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription>]
1601
+ #
1602
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1603
+ #
1604
+ # @example Basic example
1605
+ # require "google/cloud/bigquery/analytics_hub/v1"
1606
+ #
1607
+ # # Create a client object. The client can be reused for multiple calls.
1608
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1609
+ #
1610
+ # # Create a request. To set request fields, pass in keyword arguments.
1611
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::ListSubscriptionsRequest.new
1612
+ #
1613
+ # # Call the list_subscriptions method.
1614
+ # result = client.list_subscriptions request
1615
+ #
1616
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1617
+ # # over elements, and API calls will be issued to fetch pages as needed.
1618
+ # result.each do |item|
1619
+ # # Each element is of type ::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription.
1620
+ # p item
1621
+ # end
1622
+ #
1623
+ def list_subscriptions request, options = nil
1624
+ raise ::ArgumentError, "request must be provided" if request.nil?
1625
+
1626
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSubscriptionsRequest
1627
+
1628
+ # Converts hash and nil to an options object
1629
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1630
+
1631
+ # Customize the options with defaults
1632
+ metadata = @config.rpcs.list_subscriptions.metadata.to_h
1633
+
1634
+ # Set x-goog-api-client and x-goog-user-project headers
1635
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1636
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1637
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1638
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1639
+
1640
+ header_params = {}
1641
+ if request.parent
1642
+ header_params["parent"] = request.parent
1643
+ end
1644
+
1645
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1646
+ metadata[:"x-goog-request-params"] ||= request_params_header
1647
+
1648
+ options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
1649
+ metadata: metadata,
1650
+ retry_policy: @config.rpcs.list_subscriptions.retry_policy
1651
+
1652
+ options.apply_defaults timeout: @config.timeout,
1653
+ metadata: @config.metadata,
1654
+ retry_policy: @config.retry_policy
1655
+
1656
+ @analytics_hub_service_stub.call_rpc :list_subscriptions, request, options: options do |response, operation|
1657
+ response = ::Gapic::PagedEnumerable.new @analytics_hub_service_stub, :list_subscriptions, request, response, operation, options
1658
+ yield response, operation if block_given?
1659
+ return response
1660
+ end
1661
+ rescue ::GRPC::BadStatus => e
1662
+ raise ::Google::Cloud::Error.from_error(e)
1663
+ end
1664
+
1665
+ ##
1666
+ # Lists all subscriptions on a given Data Exchange or Listing.
1667
+ #
1668
+ # @overload list_shared_resource_subscriptions(request, options = nil)
1669
+ # Pass arguments to `list_shared_resource_subscriptions` via a request object, either of type
1670
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSharedResourceSubscriptionsRequest} or an equivalent Hash.
1671
+ #
1672
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSharedResourceSubscriptionsRequest, ::Hash]
1673
+ # A request object representing the call parameters. Required. To specify no
1674
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1675
+ # @param options [::Gapic::CallOptions, ::Hash]
1676
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1677
+ #
1678
+ # @overload list_shared_resource_subscriptions(resource: nil, include_deleted_subscriptions: nil, page_size: nil, page_token: nil)
1679
+ # Pass arguments to `list_shared_resource_subscriptions` via keyword arguments. Note that at
1680
+ # least one keyword argument is required. To specify no parameters, or to keep all
1681
+ # the default parameter values, pass an empty Hash as a request object (see above).
1682
+ #
1683
+ # @param resource [::String]
1684
+ # Required. Resource name of the requested target. This resource may be
1685
+ # either a Listing or a DataExchange. e.g.
1686
+ # projects/123/locations/US/dataExchanges/456 OR e.g.
1687
+ # projects/123/locations/US/dataExchanges/456/listings/789
1688
+ # @param include_deleted_subscriptions [::Boolean]
1689
+ # If selected, includes deleted subscriptions in the response
1690
+ # (up to 63 days after deletion).
1691
+ # @param page_size [::Integer]
1692
+ # The maximum number of results to return in a single response page.
1693
+ # @param page_token [::String]
1694
+ # Page token, returned by a previous call.
1695
+ #
1696
+ # @yield [response, operation] Access the result along with the RPC operation
1697
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription>]
1698
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1699
+ #
1700
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription>]
1701
+ #
1702
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1703
+ #
1704
+ # @example Basic example
1705
+ # require "google/cloud/bigquery/analytics_hub/v1"
1706
+ #
1707
+ # # Create a client object. The client can be reused for multiple calls.
1708
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1709
+ #
1710
+ # # Create a request. To set request fields, pass in keyword arguments.
1711
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::ListSharedResourceSubscriptionsRequest.new
1712
+ #
1713
+ # # Call the list_shared_resource_subscriptions method.
1714
+ # result = client.list_shared_resource_subscriptions request
1715
+ #
1716
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1717
+ # # over elements, and API calls will be issued to fetch pages as needed.
1718
+ # result.each do |item|
1719
+ # # Each element is of type ::Google::Cloud::Bigquery::AnalyticsHub::V1::Subscription.
1720
+ # p item
1721
+ # end
1722
+ #
1723
+ def list_shared_resource_subscriptions request, options = nil
1724
+ raise ::ArgumentError, "request must be provided" if request.nil?
1725
+
1726
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::ListSharedResourceSubscriptionsRequest
1727
+
1728
+ # Converts hash and nil to an options object
1729
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1730
+
1731
+ # Customize the options with defaults
1732
+ metadata = @config.rpcs.list_shared_resource_subscriptions.metadata.to_h
1733
+
1734
+ # Set x-goog-api-client and x-goog-user-project headers
1735
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1736
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1737
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1738
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1739
+
1740
+ header_params = {}
1741
+ if request.resource
1742
+ header_params["resource"] = request.resource
1743
+ end
1744
+
1745
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1746
+ metadata[:"x-goog-request-params"] ||= request_params_header
1747
+
1748
+ options.apply_defaults timeout: @config.rpcs.list_shared_resource_subscriptions.timeout,
1749
+ metadata: metadata,
1750
+ retry_policy: @config.rpcs.list_shared_resource_subscriptions.retry_policy
1751
+
1752
+ options.apply_defaults timeout: @config.timeout,
1753
+ metadata: @config.metadata,
1754
+ retry_policy: @config.retry_policy
1755
+
1756
+ @analytics_hub_service_stub.call_rpc :list_shared_resource_subscriptions, request, options: options do |response, operation|
1757
+ response = ::Gapic::PagedEnumerable.new @analytics_hub_service_stub, :list_shared_resource_subscriptions, request, response, operation, options
1758
+ yield response, operation if block_given?
1759
+ return response
1760
+ end
1761
+ rescue ::GRPC::BadStatus => e
1762
+ raise ::Google::Cloud::Error.from_error(e)
1763
+ end
1764
+
1765
+ ##
1766
+ # Revokes a given subscription.
1767
+ #
1768
+ # @overload revoke_subscription(request, options = nil)
1769
+ # Pass arguments to `revoke_subscription` via a request object, either of type
1770
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionRequest} or an equivalent Hash.
1771
+ #
1772
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionRequest, ::Hash]
1773
+ # A request object representing the call parameters. Required. To specify no
1774
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1775
+ # @param options [::Gapic::CallOptions, ::Hash]
1776
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1777
+ #
1778
+ # @overload revoke_subscription(name: nil)
1779
+ # Pass arguments to `revoke_subscription` via keyword arguments. Note that at
1780
+ # least one keyword argument is required. To specify no parameters, or to keep all
1781
+ # the default parameter values, pass an empty Hash as a request object (see above).
1782
+ #
1783
+ # @param name [::String]
1784
+ # Required. Resource name of the subscription to revoke.
1785
+ # e.g. projects/123/locations/US/subscriptions/456
1786
+ #
1787
+ # @yield [response, operation] Access the result along with the RPC operation
1788
+ # @yieldparam response [::Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionResponse]
1789
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1790
+ #
1791
+ # @return [::Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionResponse]
1792
+ #
1793
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1794
+ #
1795
+ # @example Basic example
1796
+ # require "google/cloud/bigquery/analytics_hub/v1"
1797
+ #
1798
+ # # Create a client object. The client can be reused for multiple calls.
1799
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1800
+ #
1801
+ # # Create a request. To set request fields, pass in keyword arguments.
1802
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionRequest.new
1803
+ #
1804
+ # # Call the revoke_subscription method.
1805
+ # result = client.revoke_subscription request
1806
+ #
1807
+ # # The returned object is of type Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionResponse.
1808
+ # p result
1809
+ #
1810
+ def revoke_subscription request, options = nil
1811
+ raise ::ArgumentError, "request must be provided" if request.nil?
1812
+
1813
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::RevokeSubscriptionRequest
1814
+
1815
+ # Converts hash and nil to an options object
1816
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1817
+
1818
+ # Customize the options with defaults
1819
+ metadata = @config.rpcs.revoke_subscription.metadata.to_h
1820
+
1821
+ # Set x-goog-api-client and x-goog-user-project headers
1822
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1823
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1824
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1825
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1826
+
1827
+ header_params = {}
1828
+ if request.name
1829
+ header_params["name"] = request.name
1830
+ end
1831
+
1832
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1833
+ metadata[:"x-goog-request-params"] ||= request_params_header
1834
+
1835
+ options.apply_defaults timeout: @config.rpcs.revoke_subscription.timeout,
1836
+ metadata: metadata,
1837
+ retry_policy: @config.rpcs.revoke_subscription.retry_policy
1838
+
1839
+ options.apply_defaults timeout: @config.timeout,
1840
+ metadata: @config.metadata,
1841
+ retry_policy: @config.retry_policy
1842
+
1843
+ @analytics_hub_service_stub.call_rpc :revoke_subscription, request, options: options do |response, operation|
1844
+ yield response, operation if block_given?
1845
+ return response
1846
+ end
1847
+ rescue ::GRPC::BadStatus => e
1848
+ raise ::Google::Cloud::Error.from_error(e)
1849
+ end
1850
+
1851
+ ##
1852
+ # Deletes a subscription.
1853
+ #
1854
+ # @overload delete_subscription(request, options = nil)
1855
+ # Pass arguments to `delete_subscription` via a request object, either of type
1856
+ # {::Google::Cloud::Bigquery::AnalyticsHub::V1::DeleteSubscriptionRequest} or an equivalent Hash.
1857
+ #
1858
+ # @param request [::Google::Cloud::Bigquery::AnalyticsHub::V1::DeleteSubscriptionRequest, ::Hash]
1859
+ # A request object representing the call parameters. Required. To specify no
1860
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1861
+ # @param options [::Gapic::CallOptions, ::Hash]
1862
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1863
+ #
1864
+ # @overload delete_subscription(name: nil)
1865
+ # Pass arguments to `delete_subscription` via keyword arguments. Note that at
1866
+ # least one keyword argument is required. To specify no parameters, or to keep all
1867
+ # the default parameter values, pass an empty Hash as a request object (see above).
1868
+ #
1869
+ # @param name [::String]
1870
+ # Required. Resource name of the subscription to delete.
1871
+ # e.g. projects/123/locations/US/subscriptions/456
1872
+ #
1873
+ # @yield [response, operation] Access the result along with the RPC operation
1874
+ # @yieldparam response [::Gapic::Operation]
1875
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1876
+ #
1877
+ # @return [::Gapic::Operation]
1878
+ #
1879
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1880
+ #
1881
+ # @example Basic example
1882
+ # require "google/cloud/bigquery/analytics_hub/v1"
1883
+ #
1884
+ # # Create a client object. The client can be reused for multiple calls.
1885
+ # client = Google::Cloud::Bigquery::AnalyticsHub::V1::AnalyticsHubService::Client.new
1886
+ #
1887
+ # # Create a request. To set request fields, pass in keyword arguments.
1888
+ # request = Google::Cloud::Bigquery::AnalyticsHub::V1::DeleteSubscriptionRequest.new
1889
+ #
1890
+ # # Call the delete_subscription method.
1891
+ # result = client.delete_subscription request
1892
+ #
1893
+ # # The returned object is of type Gapic::Operation. You can use it to
1894
+ # # check the status of an operation, cancel it, or wait for results.
1895
+ # # Here is how to wait for a response.
1896
+ # result.wait_until_done! timeout: 60
1897
+ # if result.response?
1898
+ # p result.response
1899
+ # else
1900
+ # puts "No response received."
1901
+ # end
1902
+ #
1903
+ def delete_subscription request, options = nil
1904
+ raise ::ArgumentError, "request must be provided" if request.nil?
1905
+
1906
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::AnalyticsHub::V1::DeleteSubscriptionRequest
1907
+
1908
+ # Converts hash and nil to an options object
1909
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1910
+
1911
+ # Customize the options with defaults
1912
+ metadata = @config.rpcs.delete_subscription.metadata.to_h
1913
+
1914
+ # Set x-goog-api-client and x-goog-user-project headers
1915
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1916
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1917
+ gapic_version: ::Google::Cloud::Bigquery::AnalyticsHub::V1::VERSION
1918
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1919
+
1920
+ header_params = {}
1921
+ if request.name
1922
+ header_params["name"] = request.name
1923
+ end
1924
+
1925
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1926
+ metadata[:"x-goog-request-params"] ||= request_params_header
1927
+
1928
+ options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
1929
+ metadata: metadata,
1930
+ retry_policy: @config.rpcs.delete_subscription.retry_policy
1931
+
1932
+ options.apply_defaults timeout: @config.timeout,
1933
+ metadata: @config.metadata,
1934
+ retry_policy: @config.retry_policy
1935
+
1936
+ @analytics_hub_service_stub.call_rpc :delete_subscription, request, options: options do |response, operation|
1937
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1938
+ yield response, operation if block_given?
1939
+ return response
1940
+ end
1941
+ rescue ::GRPC::BadStatus => e
1942
+ raise ::Google::Cloud::Error.from_error(e)
1943
+ end
1944
+
1254
1945
  ##
1255
1946
  # Gets the IAM policy.
1256
1947
  #
@@ -1558,9 +2249,9 @@ module Google
1558
2249
  # end
1559
2250
  #
1560
2251
  # @!attribute [rw] endpoint
1561
- # The hostname or hostname:port of the service endpoint.
1562
- # Defaults to `"analyticshub.googleapis.com"`.
1563
- # @return [::String]
2252
+ # A custom service endpoint, as a hostname or hostname:port. The default is
2253
+ # nil, indicating to use the default endpoint in the current universe domain.
2254
+ # @return [::String,nil]
1564
2255
  # @!attribute [rw] credentials
1565
2256
  # Credentials to send with calls. You may provide any of the following types:
1566
2257
  # * (`String`) The path to a service account key file in JSON format
@@ -1606,13 +2297,20 @@ module Google
1606
2297
  # @!attribute [rw] quota_project
1607
2298
  # A separate project against which to charge quota.
1608
2299
  # @return [::String]
2300
+ # @!attribute [rw] universe_domain
2301
+ # The universe domain within which to make requests. This determines the
2302
+ # default endpoint URL. The default value of nil uses the environment
2303
+ # universe (usually the default "googleapis.com" universe).
2304
+ # @return [::String,nil]
1609
2305
  #
1610
2306
  class Configuration
1611
2307
  extend ::Gapic::Config
1612
2308
 
2309
+ # @private
2310
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1613
2311
  DEFAULT_ENDPOINT = "analyticshub.googleapis.com"
1614
2312
 
1615
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
2313
+ config_attr :endpoint, nil, ::String, nil
1616
2314
  config_attr :credentials, nil do |value|
1617
2315
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1618
2316
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1627,6 +2325,7 @@ module Google
1627
2325
  config_attr :metadata, nil, ::Hash, nil
1628
2326
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1629
2327
  config_attr :quota_project, nil, ::String, nil
2328
+ config_attr :universe_domain, nil, ::String, nil
1630
2329
 
1631
2330
  # @private
1632
2331
  def initialize parent_config = nil
@@ -1734,6 +2433,41 @@ module Google
1734
2433
  #
1735
2434
  attr_reader :subscribe_listing
1736
2435
  ##
2436
+ # RPC-specific configuration for `subscribe_data_exchange`
2437
+ # @return [::Gapic::Config::Method]
2438
+ #
2439
+ attr_reader :subscribe_data_exchange
2440
+ ##
2441
+ # RPC-specific configuration for `refresh_subscription`
2442
+ # @return [::Gapic::Config::Method]
2443
+ #
2444
+ attr_reader :refresh_subscription
2445
+ ##
2446
+ # RPC-specific configuration for `get_subscription`
2447
+ # @return [::Gapic::Config::Method]
2448
+ #
2449
+ attr_reader :get_subscription
2450
+ ##
2451
+ # RPC-specific configuration for `list_subscriptions`
2452
+ # @return [::Gapic::Config::Method]
2453
+ #
2454
+ attr_reader :list_subscriptions
2455
+ ##
2456
+ # RPC-specific configuration for `list_shared_resource_subscriptions`
2457
+ # @return [::Gapic::Config::Method]
2458
+ #
2459
+ attr_reader :list_shared_resource_subscriptions
2460
+ ##
2461
+ # RPC-specific configuration for `revoke_subscription`
2462
+ # @return [::Gapic::Config::Method]
2463
+ #
2464
+ attr_reader :revoke_subscription
2465
+ ##
2466
+ # RPC-specific configuration for `delete_subscription`
2467
+ # @return [::Gapic::Config::Method]
2468
+ #
2469
+ attr_reader :delete_subscription
2470
+ ##
1737
2471
  # RPC-specific configuration for `get_iam_policy`
1738
2472
  # @return [::Gapic::Config::Method]
1739
2473
  #
@@ -1775,6 +2509,20 @@ module Google
1775
2509
  @delete_listing = ::Gapic::Config::Method.new delete_listing_config
1776
2510
  subscribe_listing_config = parent_rpcs.subscribe_listing if parent_rpcs.respond_to? :subscribe_listing
1777
2511
  @subscribe_listing = ::Gapic::Config::Method.new subscribe_listing_config
2512
+ subscribe_data_exchange_config = parent_rpcs.subscribe_data_exchange if parent_rpcs.respond_to? :subscribe_data_exchange
2513
+ @subscribe_data_exchange = ::Gapic::Config::Method.new subscribe_data_exchange_config
2514
+ refresh_subscription_config = parent_rpcs.refresh_subscription if parent_rpcs.respond_to? :refresh_subscription
2515
+ @refresh_subscription = ::Gapic::Config::Method.new refresh_subscription_config
2516
+ get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
2517
+ @get_subscription = ::Gapic::Config::Method.new get_subscription_config
2518
+ list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
2519
+ @list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
2520
+ list_shared_resource_subscriptions_config = parent_rpcs.list_shared_resource_subscriptions if parent_rpcs.respond_to? :list_shared_resource_subscriptions
2521
+ @list_shared_resource_subscriptions = ::Gapic::Config::Method.new list_shared_resource_subscriptions_config
2522
+ revoke_subscription_config = parent_rpcs.revoke_subscription if parent_rpcs.respond_to? :revoke_subscription
2523
+ @revoke_subscription = ::Gapic::Config::Method.new revoke_subscription_config
2524
+ delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
2525
+ @delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
1778
2526
  get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
1779
2527
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1780
2528
  set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy