google-cloud-metastore-v1 0.8.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f790ed29bdbad8280a78fc0cb52a441658c98bf107296817a1c20c96627f01d
4
- data.tar.gz: 7d827b0f0bcc722102c4e78809f54a6effd52f3e2c63c1b8331b0785227e588f
3
+ metadata.gz: a5566303fe84248626d5886217273a4bca109b53153caf591640c5d58d373f9b
4
+ data.tar.gz: 57f360cbab2727f33d337b2cec3e3004f94433e3e995a16363ae4b02afe5e36f
5
5
  SHA512:
6
- metadata.gz: ad21098ffa773e979a05a3f5dd563f7b34471dac2375b3bd063f7d370d951c6b8950d29079494eb49ffe01766af568c2e38af4b686b531e608f7e2f0de14ff0e
7
- data.tar.gz: d275cb4f7aeae9a948fed6899c17c10a7039ebc205424fb61d66b7f0188ea43e6f7554039678871d0036f34690047f18bed1d21a4d0cd781130118ecd7606732
6
+ metadata.gz: c4942d943169e4280c9eec3158085a89d000c5db8de14bc5437e2db1c5b7dc2a1931bc14b184a4f5cd190790bb6e18f9d29d9c29950935b4790faef65bc84ab4
7
+ data.tar.gz: 2e283dedda4f288b19c05a8fcdaeb2fca8dd6d8c359cc812de11e3a52bdef65ec0267239e0cdb76966b0548c27377a1d8a14c78b12ebc496c576fdfd3c4ac2c8
@@ -164,7 +164,7 @@ module Google
164
164
  credentials = @config.credentials
165
165
  # Use self-signed JWT if the endpoint is unchanged from default,
166
166
  # but only if the default endpoint does not have a region prefix.
167
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
167
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
168
168
  !@config.endpoint.split(".").first.include?("-")
169
169
  credentials ||= Credentials.default scope: @config.scope,
170
170
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -1868,6 +1868,316 @@ module Google
1868
1868
  raise ::Google::Cloud::Error.from_error(e)
1869
1869
  end
1870
1870
 
1871
+ ##
1872
+ # Query DPMS metadata.
1873
+ #
1874
+ # @overload query_metadata(request, options = nil)
1875
+ # Pass arguments to `query_metadata` via a request object, either of type
1876
+ # {::Google::Cloud::Metastore::V1::QueryMetadataRequest} or an equivalent Hash.
1877
+ #
1878
+ # @param request [::Google::Cloud::Metastore::V1::QueryMetadataRequest, ::Hash]
1879
+ # A request object representing the call parameters. Required. To specify no
1880
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1881
+ # @param options [::Gapic::CallOptions, ::Hash]
1882
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1883
+ #
1884
+ # @overload query_metadata(service: nil, query: nil)
1885
+ # Pass arguments to `query_metadata` via keyword arguments. Note that at
1886
+ # least one keyword argument is required. To specify no parameters, or to keep all
1887
+ # the default parameter values, pass an empty Hash as a request object (see above).
1888
+ #
1889
+ # @param service [::String]
1890
+ # Required. The relative resource name of the metastore service to query
1891
+ # metadata, in the following format:
1892
+ #
1893
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1894
+ # @param query [::String]
1895
+ # Required. A read-only SQL query to execute against the metadata database.
1896
+ # The query cannot change or mutate the data.
1897
+ #
1898
+ # @yield [response, operation] Access the result along with the RPC operation
1899
+ # @yieldparam response [::Gapic::Operation]
1900
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1901
+ #
1902
+ # @return [::Gapic::Operation]
1903
+ #
1904
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1905
+ #
1906
+ # @example Basic example
1907
+ # require "google/cloud/metastore/v1"
1908
+ #
1909
+ # # Create a client object. The client can be reused for multiple calls.
1910
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
1911
+ #
1912
+ # # Create a request. To set request fields, pass in keyword arguments.
1913
+ # request = Google::Cloud::Metastore::V1::QueryMetadataRequest.new
1914
+ #
1915
+ # # Call the query_metadata method.
1916
+ # result = client.query_metadata request
1917
+ #
1918
+ # # The returned object is of type Gapic::Operation. You can use it to
1919
+ # # check the status of an operation, cancel it, or wait for results.
1920
+ # # Here is how to wait for a response.
1921
+ # result.wait_until_done! timeout: 60
1922
+ # if result.response?
1923
+ # p result.response
1924
+ # else
1925
+ # puts "No response received."
1926
+ # end
1927
+ #
1928
+ def query_metadata request, options = nil
1929
+ raise ::ArgumentError, "request must be provided" if request.nil?
1930
+
1931
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::QueryMetadataRequest
1932
+
1933
+ # Converts hash and nil to an options object
1934
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1935
+
1936
+ # Customize the options with defaults
1937
+ metadata = @config.rpcs.query_metadata.metadata.to_h
1938
+
1939
+ # Set x-goog-api-client and x-goog-user-project headers
1940
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1941
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1942
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
1943
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1944
+
1945
+ header_params = {}
1946
+ if request.service
1947
+ header_params["service"] = request.service
1948
+ end
1949
+
1950
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1951
+ metadata[:"x-goog-request-params"] ||= request_params_header
1952
+
1953
+ options.apply_defaults timeout: @config.rpcs.query_metadata.timeout,
1954
+ metadata: metadata,
1955
+ retry_policy: @config.rpcs.query_metadata.retry_policy
1956
+
1957
+ options.apply_defaults timeout: @config.timeout,
1958
+ metadata: @config.metadata,
1959
+ retry_policy: @config.retry_policy
1960
+
1961
+ @dataproc_metastore_stub.call_rpc :query_metadata, request, options: options do |response, operation|
1962
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1963
+ yield response, operation if block_given?
1964
+ return response
1965
+ end
1966
+ rescue ::GRPC::BadStatus => e
1967
+ raise ::Google::Cloud::Error.from_error(e)
1968
+ end
1969
+
1970
+ ##
1971
+ # Move a table to another database.
1972
+ #
1973
+ # @overload move_table_to_database(request, options = nil)
1974
+ # Pass arguments to `move_table_to_database` via a request object, either of type
1975
+ # {::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest} or an equivalent Hash.
1976
+ #
1977
+ # @param request [::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest, ::Hash]
1978
+ # A request object representing the call parameters. Required. To specify no
1979
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1980
+ # @param options [::Gapic::CallOptions, ::Hash]
1981
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1982
+ #
1983
+ # @overload move_table_to_database(service: nil, table_name: nil, db_name: nil, destination_db_name: nil)
1984
+ # Pass arguments to `move_table_to_database` via keyword arguments. Note that at
1985
+ # least one keyword argument is required. To specify no parameters, or to keep all
1986
+ # the default parameter values, pass an empty Hash as a request object (see above).
1987
+ #
1988
+ # @param service [::String]
1989
+ # Required. The relative resource name of the metastore service to mutate
1990
+ # metadata, in the following format:
1991
+ #
1992
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
1993
+ # @param table_name [::String]
1994
+ # Required. The name of the table to be moved.
1995
+ # @param db_name [::String]
1996
+ # Required. The name of the database where the table resides.
1997
+ # @param destination_db_name [::String]
1998
+ # Required. The name of the database where the table should be moved.
1999
+ #
2000
+ # @yield [response, operation] Access the result along with the RPC operation
2001
+ # @yieldparam response [::Gapic::Operation]
2002
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2003
+ #
2004
+ # @return [::Gapic::Operation]
2005
+ #
2006
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2007
+ #
2008
+ # @example Basic example
2009
+ # require "google/cloud/metastore/v1"
2010
+ #
2011
+ # # Create a client object. The client can be reused for multiple calls.
2012
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
2013
+ #
2014
+ # # Create a request. To set request fields, pass in keyword arguments.
2015
+ # request = Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest.new
2016
+ #
2017
+ # # Call the move_table_to_database method.
2018
+ # result = client.move_table_to_database request
2019
+ #
2020
+ # # The returned object is of type Gapic::Operation. You can use it to
2021
+ # # check the status of an operation, cancel it, or wait for results.
2022
+ # # Here is how to wait for a response.
2023
+ # result.wait_until_done! timeout: 60
2024
+ # if result.response?
2025
+ # p result.response
2026
+ # else
2027
+ # puts "No response received."
2028
+ # end
2029
+ #
2030
+ def move_table_to_database request, options = nil
2031
+ raise ::ArgumentError, "request must be provided" if request.nil?
2032
+
2033
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::MoveTableToDatabaseRequest
2034
+
2035
+ # Converts hash and nil to an options object
2036
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2037
+
2038
+ # Customize the options with defaults
2039
+ metadata = @config.rpcs.move_table_to_database.metadata.to_h
2040
+
2041
+ # Set x-goog-api-client and x-goog-user-project headers
2042
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2043
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2044
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
2045
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2046
+
2047
+ header_params = {}
2048
+ if request.service
2049
+ header_params["service"] = request.service
2050
+ end
2051
+
2052
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2053
+ metadata[:"x-goog-request-params"] ||= request_params_header
2054
+
2055
+ options.apply_defaults timeout: @config.rpcs.move_table_to_database.timeout,
2056
+ metadata: metadata,
2057
+ retry_policy: @config.rpcs.move_table_to_database.retry_policy
2058
+
2059
+ options.apply_defaults timeout: @config.timeout,
2060
+ metadata: @config.metadata,
2061
+ retry_policy: @config.retry_policy
2062
+
2063
+ @dataproc_metastore_stub.call_rpc :move_table_to_database, request, options: options do |response, operation|
2064
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2065
+ yield response, operation if block_given?
2066
+ return response
2067
+ end
2068
+ rescue ::GRPC::BadStatus => e
2069
+ raise ::Google::Cloud::Error.from_error(e)
2070
+ end
2071
+
2072
+ ##
2073
+ # Alter metadata resource location. The metadata resource can be a database,
2074
+ # table, or partition. This functionality only updates the parent directory
2075
+ # for the respective metadata resource and does not transfer any existing
2076
+ # data to the new location.
2077
+ #
2078
+ # @overload alter_metadata_resource_location(request, options = nil)
2079
+ # Pass arguments to `alter_metadata_resource_location` via a request object, either of type
2080
+ # {::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest} or an equivalent Hash.
2081
+ #
2082
+ # @param request [::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest, ::Hash]
2083
+ # A request object representing the call parameters. Required. To specify no
2084
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2085
+ # @param options [::Gapic::CallOptions, ::Hash]
2086
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2087
+ #
2088
+ # @overload alter_metadata_resource_location(service: nil, resource_name: nil, location_uri: nil)
2089
+ # Pass arguments to `alter_metadata_resource_location` via keyword arguments. Note that at
2090
+ # least one keyword argument is required. To specify no parameters, or to keep all
2091
+ # the default parameter values, pass an empty Hash as a request object (see above).
2092
+ #
2093
+ # @param service [::String]
2094
+ # Required. The relative resource name of the metastore service to mutate
2095
+ # metadata, in the following format:
2096
+ #
2097
+ # `projects/{project_id}/locations/{location_id}/services/{service_id}`.
2098
+ # @param resource_name [::String]
2099
+ # Required. The relative metadata resource name in the following format.
2100
+ #
2101
+ # `databases/{database_id}`
2102
+ # or
2103
+ # `databases/{database_id}/tables/{table_id}`
2104
+ # or
2105
+ # `databases/{database_id}/tables/{table_id}/partitions/{partition_id}`
2106
+ # @param location_uri [::String]
2107
+ # Required. The new location URI for the metadata resource.
2108
+ #
2109
+ # @yield [response, operation] Access the result along with the RPC operation
2110
+ # @yieldparam response [::Gapic::Operation]
2111
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2112
+ #
2113
+ # @return [::Gapic::Operation]
2114
+ #
2115
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2116
+ #
2117
+ # @example Basic example
2118
+ # require "google/cloud/metastore/v1"
2119
+ #
2120
+ # # Create a client object. The client can be reused for multiple calls.
2121
+ # client = Google::Cloud::Metastore::V1::DataprocMetastore::Client.new
2122
+ #
2123
+ # # Create a request. To set request fields, pass in keyword arguments.
2124
+ # request = Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest.new
2125
+ #
2126
+ # # Call the alter_metadata_resource_location method.
2127
+ # result = client.alter_metadata_resource_location request
2128
+ #
2129
+ # # The returned object is of type Gapic::Operation. You can use it to
2130
+ # # check the status of an operation, cancel it, or wait for results.
2131
+ # # Here is how to wait for a response.
2132
+ # result.wait_until_done! timeout: 60
2133
+ # if result.response?
2134
+ # p result.response
2135
+ # else
2136
+ # puts "No response received."
2137
+ # end
2138
+ #
2139
+ def alter_metadata_resource_location request, options = nil
2140
+ raise ::ArgumentError, "request must be provided" if request.nil?
2141
+
2142
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Metastore::V1::AlterMetadataResourceLocationRequest
2143
+
2144
+ # Converts hash and nil to an options object
2145
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2146
+
2147
+ # Customize the options with defaults
2148
+ metadata = @config.rpcs.alter_metadata_resource_location.metadata.to_h
2149
+
2150
+ # Set x-goog-api-client and x-goog-user-project headers
2151
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2152
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2153
+ gapic_version: ::Google::Cloud::Metastore::V1::VERSION
2154
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2155
+
2156
+ header_params = {}
2157
+ if request.service
2158
+ header_params["service"] = request.service
2159
+ end
2160
+
2161
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2162
+ metadata[:"x-goog-request-params"] ||= request_params_header
2163
+
2164
+ options.apply_defaults timeout: @config.rpcs.alter_metadata_resource_location.timeout,
2165
+ metadata: metadata,
2166
+ retry_policy: @config.rpcs.alter_metadata_resource_location.retry_policy
2167
+
2168
+ options.apply_defaults timeout: @config.timeout,
2169
+ metadata: @config.metadata,
2170
+ retry_policy: @config.retry_policy
2171
+
2172
+ @dataproc_metastore_stub.call_rpc :alter_metadata_resource_location, request, options: options do |response, operation|
2173
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2174
+ yield response, operation if block_given?
2175
+ return response
2176
+ end
2177
+ rescue ::GRPC::BadStatus => e
2178
+ raise ::Google::Cloud::Error.from_error(e)
2179
+ end
2180
+
1871
2181
  ##
1872
2182
  # Configuration class for the DataprocMetastore API.
1873
2183
  #
@@ -1950,7 +2260,9 @@ module Google
1950
2260
  class Configuration
1951
2261
  extend ::Gapic::Config
1952
2262
 
1953
- config_attr :endpoint, "metastore.googleapis.com", ::String
2263
+ DEFAULT_ENDPOINT = "metastore.googleapis.com"
2264
+
2265
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1954
2266
  config_attr :credentials, nil do |value|
1955
2267
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1956
2268
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -2078,6 +2390,21 @@ module Google
2078
2390
  # @return [::Gapic::Config::Method]
2079
2391
  #
2080
2392
  attr_reader :delete_backup
2393
+ ##
2394
+ # RPC-specific configuration for `query_metadata`
2395
+ # @return [::Gapic::Config::Method]
2396
+ #
2397
+ attr_reader :query_metadata
2398
+ ##
2399
+ # RPC-specific configuration for `move_table_to_database`
2400
+ # @return [::Gapic::Config::Method]
2401
+ #
2402
+ attr_reader :move_table_to_database
2403
+ ##
2404
+ # RPC-specific configuration for `alter_metadata_resource_location`
2405
+ # @return [::Gapic::Config::Method]
2406
+ #
2407
+ attr_reader :alter_metadata_resource_location
2081
2408
 
2082
2409
  # @private
2083
2410
  def initialize parent_rpcs = nil
@@ -2111,6 +2438,12 @@ module Google
2111
2438
  @create_backup = ::Gapic::Config::Method.new create_backup_config
2112
2439
  delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup
2113
2440
  @delete_backup = ::Gapic::Config::Method.new delete_backup_config
2441
+ query_metadata_config = parent_rpcs.query_metadata if parent_rpcs.respond_to? :query_metadata
2442
+ @query_metadata = ::Gapic::Config::Method.new query_metadata_config
2443
+ move_table_to_database_config = parent_rpcs.move_table_to_database if parent_rpcs.respond_to? :move_table_to_database
2444
+ @move_table_to_database = ::Gapic::Config::Method.new move_table_to_database_config
2445
+ alter_metadata_resource_location_config = parent_rpcs.alter_metadata_resource_location if parent_rpcs.respond_to? :alter_metadata_resource_location
2446
+ @alter_metadata_resource_location = ::Gapic::Config::Method.new alter_metadata_resource_location_config
2114
2447
 
2115
2448
  yield self if block_given?
2116
2449
  end
@@ -664,7 +664,9 @@ module Google
664
664
  class Configuration
665
665
  extend ::Gapic::Config
666
666
 
667
- config_attr :endpoint, "metastore.googleapis.com", ::String
667
+ DEFAULT_ENDPOINT = "metastore.googleapis.com"
668
+
669
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
668
670
  config_attr :credentials, nil do |value|
669
671
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
670
672
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC