google-cloud-metastore-v1 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,7 +160,7 @@ module Google
160
160
  credentials = @config.credentials
161
161
  # Use self-signed JWT if the endpoint is unchanged from default,
162
162
  # but only if the default endpoint does not have a region prefix.
163
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
163
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
164
164
  !@config.endpoint.split(".").first.include?("-")
165
165
  credentials ||= Credentials.default scope: @config.scope,
166
166
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -1438,6 +1438,226 @@ module Google
1438
1438
  raise ::Google::Cloud::Error.from_error(e)
1439
1439
  end
1440
1440
 
1441
+ ##
1442
+ # Query DPMS metadata.
1443
+ #
1444
+ # @overload query_metadata(request, options = nil)
1445
+ # Pass arguments to `query_metadata` via a request object, either of type
1446
+ # {::Google::Cloud::Metastore::V1::QueryMetadataRequest} or an equivalent Hash.
1447
+ #
1448
+ # @param request [::Google::Cloud::Metastore::V1::QueryMetadataRequest, ::Hash]
1449
+ # A request object representing the call parameters. Required. To specify no
1450
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1451
+ # @param options [::Gapic::CallOptions, ::Hash]
1452
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1453
+ #
1454
+ # @overload query_metadata(service: nil, query: nil)
1455
+ # Pass arguments to `query_metadata` via keyword arguments. Note that at
1456
+ # least one keyword argument is required. To specify no parameters, or to keep all
1457
+ # the default parameter values, pass an empty Hash as a request object (see above).
1458
+ #
1459
+ # @param service [::String]
1460
+ # Required. The relative resource name of the metastore service to query
1461
+ # metadata, in the following format:
1462
+ #
1463
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1464
+ # @param query [::String]
1465
+ # Required. A read-only SQL query to execute against the metadata database.
1466
+ # The query cannot change or mutate the data.
1467
+ # @yield [result, operation] Access the result along with the TransportOperation object
1468
+ # @yieldparam result [::Gapic::Operation]
1469
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1470
+ #
1471
+ # @return [::Gapic::Operation]
1472
+ #
1473
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1474
+ def query_metadata request, options = nil
1475
+ raise ::ArgumentError, "request must be provided" if request.nil?
1476
+
1477
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::QueryMetadataRequest
1478
+
1479
+ # Converts hash and nil to an options object
1480
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1481
+
1482
+ # Customize the options with defaults
1483
+ call_metadata = @config.rpcs.query_metadata.metadata.to_h
1484
+
1485
+ # Set x-goog-api-client and x-goog-user-project headers
1486
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1487
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1488
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION,
1489
+ transports_version_send: [:rest]
1490
+
1491
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1492
+
1493
+ options.apply_defaults timeout: @config.rpcs.query_metadata.timeout,
1494
+ metadata: call_metadata,
1495
+ retry_policy: @config.rpcs.query_metadata.retry_policy
1496
+
1497
+ options.apply_defaults timeout: @config.timeout,
1498
+ metadata: @config.metadata,
1499
+ retry_policy: @config.retry_policy
1500
+
1501
+ @dataproc_metastore_stub.query_metadata request, options do |result, operation|
1502
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1503
+ yield result, operation if block_given?
1504
+ return result
1505
+ end
1506
+ rescue ::Gapic::Rest::Error => e
1507
+ raise ::Google::Cloud::Error.from_error(e)
1508
+ end
1509
+
1510
+ ##
1511
+ # Move a table to another database.
1512
+ #
1513
+ # @overload move_table_to_database(request, options = nil)
1514
+ # Pass arguments to `move_table_to_database` via a request object, either of type
1515
+ # {::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest} or an equivalent Hash.
1516
+ #
1517
+ # @param request [::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest, ::Hash]
1518
+ # A request object representing the call parameters. Required. To specify no
1519
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1520
+ # @param options [::Gapic::CallOptions, ::Hash]
1521
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1522
+ #
1523
+ # @overload move_table_to_database(service: nil, table_name: nil, db_name: nil, destination_db_name: nil)
1524
+ # Pass arguments to `move_table_to_database` via keyword arguments. Note that at
1525
+ # least one keyword argument is required. To specify no parameters, or to keep all
1526
+ # the default parameter values, pass an empty Hash as a request object (see above).
1527
+ #
1528
+ # @param service [::String]
1529
+ # Required. The relative resource name of the metastore service to mutate
1530
+ # metadata, in the following format:
1531
+ #
1532
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1533
+ # @param table_name [::String]
1534
+ # Required. The name of the table to be moved.
1535
+ # @param db_name [::String]
1536
+ # Required. The name of the database where the table resides.
1537
+ # @param destination_db_name [::String]
1538
+ # Required. The name of the database where the table should be moved.
1539
+ # @yield [result, operation] Access the result along with the TransportOperation object
1540
+ # @yieldparam result [::Gapic::Operation]
1541
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1542
+ #
1543
+ # @return [::Gapic::Operation]
1544
+ #
1545
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1546
+ def move_table_to_database request, options = nil
1547
+ raise ::ArgumentError, "request must be provided" if request.nil?
1548
+
1549
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest
1550
+
1551
+ # Converts hash and nil to an options object
1552
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1553
+
1554
+ # Customize the options with defaults
1555
+ call_metadata = @config.rpcs.move_table_to_database.metadata.to_h
1556
+
1557
+ # Set x-goog-api-client and x-goog-user-project headers
1558
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1559
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1560
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION,
1561
+ transports_version_send: [:rest]
1562
+
1563
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1564
+
1565
+ options.apply_defaults timeout: @config.rpcs.move_table_to_database.timeout,
1566
+ metadata: call_metadata,
1567
+ retry_policy: @config.rpcs.move_table_to_database.retry_policy
1568
+
1569
+ options.apply_defaults timeout: @config.timeout,
1570
+ metadata: @config.metadata,
1571
+ retry_policy: @config.retry_policy
1572
+
1573
+ @dataproc_metastore_stub.move_table_to_database request, options do |result, operation|
1574
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1575
+ yield result, operation if block_given?
1576
+ return result
1577
+ end
1578
+ rescue ::Gapic::Rest::Error => e
1579
+ raise ::Google::Cloud::Error.from_error(e)
1580
+ end
1581
+
1582
+ ##
1583
+ # Alter metadata resource location. The metadata resource can be a database,
1584
+ # table, or partition. This functionality only updates the parent directory
1585
+ # for the respective metadata resource and does not transfer any existing
1586
+ # data to the new location.
1587
+ #
1588
+ # @overload alter_metadata_resource_location(request, options = nil)
1589
+ # Pass arguments to `alter_metadata_resource_location` via a request object, either of type
1590
+ # {::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest} or an equivalent Hash.
1591
+ #
1592
+ # @param request [::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest, ::Hash]
1593
+ # A request object representing the call parameters. Required. To specify no
1594
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1595
+ # @param options [::Gapic::CallOptions, ::Hash]
1596
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1597
+ #
1598
+ # @overload alter_metadata_resource_location(service: nil, resource_name: nil, location_uri: nil)
1599
+ # Pass arguments to `alter_metadata_resource_location` via keyword arguments. Note that at
1600
+ # least one keyword argument is required. To specify no parameters, or to keep all
1601
+ # the default parameter values, pass an empty Hash as a request object (see above).
1602
+ #
1603
+ # @param service [::String]
1604
+ # Required. The relative resource name of the metastore service to mutate
1605
+ # metadata, in the following format:
1606
+ #
1607
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1608
+ # @param resource_name [::String]
1609
+ # Required. The relative metadata resource name in the following format.
1610
+ #
1611
+ # `databases/{database_id}`
1612
+ # or
1613
+ # `databases/{database_id}/tables/{table_id}`
1614
+ # or
1615
+ # `databases/{database_id}/tables/{table_id}/partitions/{partition_id}`
1616
+ # @param location_uri [::String]
1617
+ # Required. The new location URI for the metadata resource.
1618
+ # @yield [result, operation] Access the result along with the TransportOperation object
1619
+ # @yieldparam result [::Gapic::Operation]
1620
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1621
+ #
1622
+ # @return [::Gapic::Operation]
1623
+ #
1624
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1625
+ def alter_metadata_resource_location request, options = nil
1626
+ raise ::ArgumentError, "request must be provided" if request.nil?
1627
+
1628
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest
1629
+
1630
+ # Converts hash and nil to an options object
1631
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1632
+
1633
+ # Customize the options with defaults
1634
+ call_metadata = @config.rpcs.alter_metadata_resource_location.metadata.to_h
1635
+
1636
+ # Set x-goog-api-client and x-goog-user-project headers
1637
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1638
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1639
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION,
1640
+ transports_version_send: [:rest]
1641
+
1642
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1643
+
1644
+ options.apply_defaults timeout: @config.rpcs.alter_metadata_resource_location.timeout,
1645
+ metadata: call_metadata,
1646
+ retry_policy: @config.rpcs.alter_metadata_resource_location.retry_policy
1647
+
1648
+ options.apply_defaults timeout: @config.timeout,
1649
+ metadata: @config.metadata,
1650
+ retry_policy: @config.retry_policy
1651
+
1652
+ @dataproc_metastore_stub.alter_metadata_resource_location request, options do |result, operation|
1653
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1654
+ yield result, operation if block_given?
1655
+ return result
1656
+ end
1657
+ rescue ::Gapic::Rest::Error => e
1658
+ raise ::Google::Cloud::Error.from_error(e)
1659
+ end
1660
+
1441
1661
  ##
1442
1662
  # Configuration class for the DataprocMetastore REST API.
1443
1663
  #
@@ -1511,7 +1731,9 @@ module Google
1511
1731
  class Configuration
1512
1732
  extend ::Gapic::Config
1513
1733
 
1514
- config_attr :endpoint, "metastore.googleapis.com", ::String
1734
+ DEFAULT_ENDPOINT = "metastore.googleapis.com"
1735
+
1736
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1515
1737
  config_attr :credentials, nil do |value|
1516
1738
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1517
1739
  allowed.any? { |klass| klass === value }
@@ -1643,6 +1865,21 @@ module Google
1643
1865
  # @return [::Gapic::Config::Method]
1644
1866
  #
1645
1867
  attr_reader :delete_backup
1868
+ ##
1869
+ # RPC-specific configuration for `query_metadata`
1870
+ # @return [::Gapic::Config::Method]
1871
+ #
1872
+ attr_reader :query_metadata
1873
+ ##
1874
+ # RPC-specific configuration for `move_table_to_database`
1875
+ # @return [::Gapic::Config::Method]
1876
+ #
1877
+ attr_reader :move_table_to_database
1878
+ ##
1879
+ # RPC-specific configuration for `alter_metadata_resource_location`
1880
+ # @return [::Gapic::Config::Method]
1881
+ #
1882
+ attr_reader :alter_metadata_resource_location
1646
1883
 
1647
1884
  # @private
1648
1885
  def initialize parent_rpcs = nil
@@ -1676,6 +1913,12 @@ module Google
1676
1913
  @create_backup = ::Gapic::Config::Method.new create_backup_config
1677
1914
  delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
1678
1915
  @delete_backup = ::Gapic::Config::Method.new delete_backup_config
1916
+ query_metadata_config = parent_rpcs.query_metadata if parent_rpcs.respond_to? :query_metadata
1917
+ @query_metadata = ::Gapic::Config::Method.new query_metadata_config
1918
+ move_table_to_database_config = parent_rpcs.move_table_to_database if parent_rpcs.respond_to? :move_table_to_database
1919
+ @move_table_to_database = ::Gapic::Config::Method.new move_table_to_database_config
1920
+ alter_metadata_resource_location_config = parent_rpcs.alter_metadata_resource_location if parent_rpcs.respond_to? :alter_metadata_resource_location
1921
+ @alter_metadata_resource_location = ::Gapic::Config::Method.new alter_metadata_resource_location_config
1679
1922
 
1680
1923
  yield self if block_given?
1681
1924
  end
@@ -446,7 +446,9 @@ module Google
446
446
  class Configuration
447
447
  extend ::Gapic::Config
448
448
 
449
- config_attr :endpoint, "metastore.googleapis.com", ::String
449
+ DEFAULT_ENDPOINT = "metastore.googleapis.com"
450
+
451
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
450
452
  config_attr :credentials, nil do |value|
451
453
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
452
454
  allowed.any? { |klass| klass === value }
@@ -567,7 +569,7 @@ module Google
567
569
 
568
570
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
569
571
  query_string_params = if query_string_params.any?
570
- query_string_params.to_h { |p| p.split("=", 2) }
572
+ query_string_params.to_h { |p| p.split "=", 2 }
571
573
  else
572
574
  {}
573
575
  end
@@ -605,7 +607,7 @@ module Google
605
607
 
606
608
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
607
609
  query_string_params = if query_string_params.any?
608
- query_string_params.to_h { |p| p.split("=", 2) }
610
+ query_string_params.to_h { |p| p.split "=", 2 }
609
611
  else
610
612
  {}
611
613
  end
@@ -643,7 +645,7 @@ module Google
643
645
 
644
646
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
645
647
  query_string_params = if query_string_params.any?
646
- query_string_params.to_h { |p| p.split("=", 2) }
648
+ query_string_params.to_h { |p| p.split "=", 2 }
647
649
  else
648
650
  {}
649
651
  end
@@ -681,7 +683,7 @@ module Google
681
683
 
682
684
  verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
683
685
  query_string_params = if query_string_params.any?
684
- query_string_params.to_h { |p| p.split("=", 2) }
686
+ query_string_params.to_h { |p| p.split "=", 2 }
685
687
  else
686
688
  {}
687
689
  end
@@ -59,7 +59,7 @@ module Google
59
59
 
60
60
  verb, uri, query_string_params, body = ServiceStub.transcode_list_services_request request_pb
61
61
  query_string_params = if query_string_params.any?
62
- query_string_params.to_h { |p| p.split("=", 2) }
62
+ query_string_params.to_h { |p| p.split "=", 2 }
63
63
  else
64
64
  {}
65
65
  end
@@ -97,7 +97,7 @@ module Google
97
97
 
98
98
  verb, uri, query_string_params, body = ServiceStub.transcode_get_service_request request_pb
99
99
  query_string_params = if query_string_params.any?
100
- query_string_params.to_h { |p| p.split("=", 2) }
100
+ query_string_params.to_h { |p| p.split "=", 2 }
101
101
  else
102
102
  {}
103
103
  end
@@ -135,7 +135,7 @@ module Google
135
135
 
136
136
  verb, uri, query_string_params, body = ServiceStub.transcode_create_service_request request_pb
137
137
  query_string_params = if query_string_params.any?
138
- query_string_params.to_h { |p| p.split("=", 2) }
138
+ query_string_params.to_h { |p| p.split "=", 2 }
139
139
  else
140
140
  {}
141
141
  end
@@ -173,7 +173,7 @@ module Google
173
173
 
174
174
  verb, uri, query_string_params, body = ServiceStub.transcode_update_service_request request_pb
175
175
  query_string_params = if query_string_params.any?
176
- query_string_params.to_h { |p| p.split("=", 2) }
176
+ query_string_params.to_h { |p| p.split "=", 2 }
177
177
  else
178
178
  {}
179
179
  end
@@ -211,7 +211,7 @@ module Google
211
211
 
212
212
  verb, uri, query_string_params, body = ServiceStub.transcode_delete_service_request request_pb
213
213
  query_string_params = if query_string_params.any?
214
- query_string_params.to_h { |p| p.split("=", 2) }
214
+ query_string_params.to_h { |p| p.split "=", 2 }
215
215
  else
216
216
  {}
217
217
  end
@@ -249,7 +249,7 @@ module Google
249
249
 
250
250
  verb, uri, query_string_params, body = ServiceStub.transcode_list_metadata_imports_request request_pb
251
251
  query_string_params = if query_string_params.any?
252
- query_string_params.to_h { |p| p.split("=", 2) }
252
+ query_string_params.to_h { |p| p.split "=", 2 }
253
253
  else
254
254
  {}
255
255
  end
@@ -287,7 +287,7 @@ module Google
287
287
 
288
288
  verb, uri, query_string_params, body = ServiceStub.transcode_get_metadata_import_request request_pb
289
289
  query_string_params = if query_string_params.any?
290
- query_string_params.to_h { |p| p.split("=", 2) }
290
+ query_string_params.to_h { |p| p.split "=", 2 }
291
291
  else
292
292
  {}
293
293
  end
@@ -325,7 +325,7 @@ module Google
325
325
 
326
326
  verb, uri, query_string_params, body = ServiceStub.transcode_create_metadata_import_request request_pb
327
327
  query_string_params = if query_string_params.any?
328
- query_string_params.to_h { |p| p.split("=", 2) }
328
+ query_string_params.to_h { |p| p.split "=", 2 }
329
329
  else
330
330
  {}
331
331
  end
@@ -363,7 +363,7 @@ module Google
363
363
 
364
364
  verb, uri, query_string_params, body = ServiceStub.transcode_update_metadata_import_request request_pb
365
365
  query_string_params = if query_string_params.any?
366
- query_string_params.to_h { |p| p.split("=", 2) }
366
+ query_string_params.to_h { |p| p.split "=", 2 }
367
367
  else
368
368
  {}
369
369
  end
@@ -401,7 +401,7 @@ module Google
401
401
 
402
402
  verb, uri, query_string_params, body = ServiceStub.transcode_export_metadata_request request_pb
403
403
  query_string_params = if query_string_params.any?
404
- query_string_params.to_h { |p| p.split("=", 2) }
404
+ query_string_params.to_h { |p| p.split "=", 2 }
405
405
  else
406
406
  {}
407
407
  end
@@ -439,7 +439,7 @@ module Google
439
439
 
440
440
  verb, uri, query_string_params, body = ServiceStub.transcode_restore_service_request request_pb
441
441
  query_string_params = if query_string_params.any?
442
- query_string_params.to_h { |p| p.split("=", 2) }
442
+ query_string_params.to_h { |p| p.split "=", 2 }
443
443
  else
444
444
  {}
445
445
  end
@@ -477,7 +477,7 @@ module Google
477
477
 
478
478
  verb, uri, query_string_params, body = ServiceStub.transcode_list_backups_request request_pb
479
479
  query_string_params = if query_string_params.any?
480
- query_string_params.to_h { |p| p.split("=", 2) }
480
+ query_string_params.to_h { |p| p.split "=", 2 }
481
481
  else
482
482
  {}
483
483
  end
@@ -515,7 +515,7 @@ module Google
515
515
 
516
516
  verb, uri, query_string_params, body = ServiceStub.transcode_get_backup_request request_pb
517
517
  query_string_params = if query_string_params.any?
518
- query_string_params.to_h { |p| p.split("=", 2) }
518
+ query_string_params.to_h { |p| p.split "=", 2 }
519
519
  else
520
520
  {}
521
521
  end
@@ -553,7 +553,7 @@ module Google
553
553
 
554
554
  verb, uri, query_string_params, body = ServiceStub.transcode_create_backup_request request_pb
555
555
  query_string_params = if query_string_params.any?
556
- query_string_params.to_h { |p| p.split("=", 2) }
556
+ query_string_params.to_h { |p| p.split "=", 2 }
557
557
  else
558
558
  {}
559
559
  end
@@ -591,7 +591,121 @@ module Google
591
591
 
592
592
  verb, uri, query_string_params, body = ServiceStub.transcode_delete_backup_request request_pb
593
593
  query_string_params = if query_string_params.any?
594
- query_string_params.to_h { |p| p.split("=", 2) }
594
+ query_string_params.to_h { |p| p.split "=", 2 }
595
+ else
596
+ {}
597
+ end
598
+
599
+ response = @client_stub.make_http_request(
600
+ verb,
601
+ uri: uri,
602
+ body: body || "",
603
+ params: query_string_params,
604
+ options: options
605
+ )
606
+ operation = ::Gapic::Rest::TransportOperation.new response
607
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
608
+
609
+ yield result, operation if block_given?
610
+ result
611
+ end
612
+
613
+ ##
614
+ # Baseline implementation for the query_metadata REST call
615
+ #
616
+ # @param request_pb [::Google::Cloud::Metastore::V1::QueryMetadataRequest]
617
+ # A request object representing the call parameters. Required.
618
+ # @param options [::Gapic::CallOptions]
619
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
620
+ #
621
+ # @yield [result, operation] Access the result along with the TransportOperation object
622
+ # @yieldparam result [::Google::Longrunning::Operation]
623
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
624
+ #
625
+ # @return [::Google::Longrunning::Operation]
626
+ # A result object deserialized from the server's reply
627
+ def query_metadata request_pb, options = nil
628
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
629
+
630
+ verb, uri, query_string_params, body = ServiceStub.transcode_query_metadata_request request_pb
631
+ query_string_params = if query_string_params.any?
632
+ query_string_params.to_h { |p| p.split "=", 2 }
633
+ else
634
+ {}
635
+ end
636
+
637
+ response = @client_stub.make_http_request(
638
+ verb,
639
+ uri: uri,
640
+ body: body || "",
641
+ params: query_string_params,
642
+ options: options
643
+ )
644
+ operation = ::Gapic::Rest::TransportOperation.new response
645
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
646
+
647
+ yield result, operation if block_given?
648
+ result
649
+ end
650
+
651
+ ##
652
+ # Baseline implementation for the move_table_to_database REST call
653
+ #
654
+ # @param request_pb [::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest]
655
+ # A request object representing the call parameters. Required.
656
+ # @param options [::Gapic::CallOptions]
657
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
658
+ #
659
+ # @yield [result, operation] Access the result along with the TransportOperation object
660
+ # @yieldparam result [::Google::Longrunning::Operation]
661
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
662
+ #
663
+ # @return [::Google::Longrunning::Operation]
664
+ # A result object deserialized from the server's reply
665
+ def move_table_to_database request_pb, options = nil
666
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
667
+
668
+ verb, uri, query_string_params, body = ServiceStub.transcode_move_table_to_database_request request_pb
669
+ query_string_params = if query_string_params.any?
670
+ query_string_params.to_h { |p| p.split "=", 2 }
671
+ else
672
+ {}
673
+ end
674
+
675
+ response = @client_stub.make_http_request(
676
+ verb,
677
+ uri: uri,
678
+ body: body || "",
679
+ params: query_string_params,
680
+ options: options
681
+ )
682
+ operation = ::Gapic::Rest::TransportOperation.new response
683
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
684
+
685
+ yield result, operation if block_given?
686
+ result
687
+ end
688
+
689
+ ##
690
+ # Baseline implementation for the alter_metadata_resource_location REST call
691
+ #
692
+ # @param request_pb [::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest]
693
+ # A request object representing the call parameters. Required.
694
+ # @param options [::Gapic::CallOptions]
695
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
696
+ #
697
+ # @yield [result, operation] Access the result along with the TransportOperation object
698
+ # @yieldparam result [::Google::Longrunning::Operation]
699
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
700
+ #
701
+ # @return [::Google::Longrunning::Operation]
702
+ # A result object deserialized from the server's reply
703
+ def alter_metadata_resource_location request_pb, options = nil
704
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
705
+
706
+ verb, uri, query_string_params, body = ServiceStub.transcode_alter_metadata_resource_location_request request_pb
707
+ query_string_params = if query_string_params.any?
708
+ query_string_params.to_h { |p| p.split "=", 2 }
595
709
  else
596
710
  {}
597
711
  end
@@ -931,6 +1045,72 @@ module Google
931
1045
  )
932
1046
  transcoder.transcode request_pb
933
1047
  end
1048
+
1049
+ ##
1050
+ # @private
1051
+ #
1052
+ # GRPC transcoding helper method for the query_metadata REST call
1053
+ #
1054
+ # @param request_pb [::Google::Cloud::Metastore::V1::QueryMetadataRequest]
1055
+ # A request object representing the call parameters. Required.
1056
+ # @return [Array(String, [String, nil], Hash{String => String})]
1057
+ # Uri, Body, Query string parameters
1058
+ def self.transcode_query_metadata_request request_pb
1059
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1060
+ .with_bindings(
1061
+ uri_method: :post,
1062
+ uri_template: "/v1/{service}:queryMetadata",
1063
+ body: "*",
1064
+ matches: [
1065
+ ["service", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/?$}, false]
1066
+ ]
1067
+ )
1068
+ transcoder.transcode request_pb
1069
+ end
1070
+
1071
+ ##
1072
+ # @private
1073
+ #
1074
+ # GRPC transcoding helper method for the move_table_to_database REST call
1075
+ #
1076
+ # @param request_pb [::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest]
1077
+ # A request object representing the call parameters. Required.
1078
+ # @return [Array(String, [String, nil], Hash{String => String})]
1079
+ # Uri, Body, Query string parameters
1080
+ def self.transcode_move_table_to_database_request request_pb
1081
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1082
+ .with_bindings(
1083
+ uri_method: :post,
1084
+ uri_template: "/v1/{service}:moveTableToDatabase",
1085
+ body: "*",
1086
+ matches: [
1087
+ ["service", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/?$}, false]
1088
+ ]
1089
+ )
1090
+ transcoder.transcode request_pb
1091
+ end
1092
+
1093
+ ##
1094
+ # @private
1095
+ #
1096
+ # GRPC transcoding helper method for the alter_metadata_resource_location REST call
1097
+ #
1098
+ # @param request_pb [::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest]
1099
+ # A request object representing the call parameters. Required.
1100
+ # @return [Array(String, [String, nil], Hash{String => String})]
1101
+ # Uri, Body, Query string parameters
1102
+ def self.transcode_alter_metadata_resource_location_request request_pb
1103
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1104
+ .with_bindings(
1105
+ uri_method: :post,
1106
+ uri_template: "/v1/{service}:alterLocation",
1107
+ body: "*",
1108
+ matches: [
1109
+ ["service", %r{^projects/[^/]+/locations/[^/]+/services/[^/]+/?$}, false]
1110
+ ]
1111
+ )
1112
+ transcoder.transcode request_pb
1113
+ end
934
1114
  end
935
1115
  end
936
1116
  end
@@ -137,7 +137,7 @@ module Google
137
137
  credentials = @config.credentials
138
138
  # Use self-signed JWT if the endpoint is unchanged from default,
139
139
  # but only if the default endpoint does not have a region prefix.
140
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
140
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
141
  !@config.endpoint.split(".").first.include?("-")
142
142
  credentials ||= Credentials.default scope: @config.scope,
143
143
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -823,7 +823,9 @@ module Google
823
823
  class Configuration
824
824
  extend ::Gapic::Config
825
825
 
826
- config_attr :endpoint, "metastore.googleapis.com", ::String
826
+ DEFAULT_ENDPOINT = "metastore.googleapis.com"
827
+
828
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
827
829
  config_attr :credentials, nil do |value|
828
830
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
829
831
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC