google-cloud-spanner-admin-instance-v1 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -992,7 +992,7 @@ module Google
992
992
  # @param options [::Gapic::CallOptions, ::Hash]
993
993
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
994
994
  #
995
- # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil)
995
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, instance_deadline: nil)
996
996
  # Pass arguments to `list_instances` via keyword arguments. Note that at
997
997
  # least one keyword argument is required. To specify no parameters, or to keep all
998
998
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1028,6 +1028,13 @@ module Google
1028
1028
  # * `name:howl labels.env:dev` --> The instance's name contains "howl" and
1029
1029
  # it has the label "env" with its value
1030
1030
  # containing "dev".
1031
+ # @param instance_deadline [::Google::Protobuf::Timestamp, ::Hash]
1032
+ # Deadline used while retrieving metadata for instances.
1033
+ # Instances whose metadata cannot be retrieved within this deadline will be
1034
+ # added to
1035
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse#unreachable unreachable}
1036
+ # in
1037
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse ListInstancesResponse}.
1031
1038
  #
1032
1039
  # @yield [response, operation] Access the result along with the RPC operation
1033
1040
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>]
@@ -1098,6 +1105,112 @@ module Google
1098
1105
  raise ::Google::Cloud::Error.from_error(e)
1099
1106
  end
1100
1107
 
1108
+ ##
1109
+ # Lists all instance partitions for the given instance.
1110
+ #
1111
+ # @overload list_instance_partitions(request, options = nil)
1112
+ # Pass arguments to `list_instance_partitions` via a request object, either of type
1113
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest} or an equivalent Hash.
1114
+ #
1115
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest, ::Hash]
1116
+ # A request object representing the call parameters. Required. To specify no
1117
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1118
+ # @param options [::Gapic::CallOptions, ::Hash]
1119
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1120
+ #
1121
+ # @overload list_instance_partitions(parent: nil, page_size: nil, page_token: nil, instance_partition_deadline: nil)
1122
+ # Pass arguments to `list_instance_partitions` via keyword arguments. Note that at
1123
+ # least one keyword argument is required. To specify no parameters, or to keep all
1124
+ # the default parameter values, pass an empty Hash as a request object (see above).
1125
+ #
1126
+ # @param parent [::String]
1127
+ # Required. The instance whose instance partitions should be listed. Values
1128
+ # are of the form `projects/<project>/instances/<instance>`.
1129
+ # @param page_size [::Integer]
1130
+ # Number of instance partitions to be returned in the response. If 0 or less,
1131
+ # defaults to the server's maximum allowed page size.
1132
+ # @param page_token [::String]
1133
+ # If non-empty, `page_token` should contain a
1134
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse#next_page_token next_page_token}
1135
+ # from a previous
1136
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse ListInstancePartitionsResponse}.
1137
+ # @param instance_partition_deadline [::Google::Protobuf::Timestamp, ::Hash]
1138
+ # Optional. Deadline used while retrieving metadata for instance partitions.
1139
+ # Instance partitions whose metadata cannot be retrieved within this deadline
1140
+ # will be added to
1141
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse#unreachable unreachable}
1142
+ # in
1143
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse ListInstancePartitionsResponse}.
1144
+ #
1145
+ # @yield [response, operation] Access the result along with the RPC operation
1146
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition>]
1147
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1148
+ #
1149
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition>]
1150
+ #
1151
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1152
+ #
1153
+ # @example Basic example
1154
+ # require "google/cloud/spanner/admin/instance/v1"
1155
+ #
1156
+ # # Create a client object. The client can be reused for multiple calls.
1157
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
1158
+ #
1159
+ # # Create a request. To set request fields, pass in keyword arguments.
1160
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest.new
1161
+ #
1162
+ # # Call the list_instance_partitions method.
1163
+ # result = client.list_instance_partitions request
1164
+ #
1165
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1166
+ # # over elements, and API calls will be issued to fetch pages as needed.
1167
+ # result.each do |item|
1168
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition.
1169
+ # p item
1170
+ # end
1171
+ #
1172
+ def list_instance_partitions request, options = nil
1173
+ raise ::ArgumentError, "request must be provided" if request.nil?
1174
+
1175
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest
1176
+
1177
+ # Converts hash and nil to an options object
1178
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1179
+
1180
+ # Customize the options with defaults
1181
+ metadata = @config.rpcs.list_instance_partitions.metadata.to_h
1182
+
1183
+ # Set x-goog-api-client and x-goog-user-project headers
1184
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1185
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1186
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
1187
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1188
+
1189
+ header_params = {}
1190
+ if request.parent
1191
+ header_params["parent"] = request.parent
1192
+ end
1193
+
1194
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1195
+ metadata[:"x-goog-request-params"] ||= request_params_header
1196
+
1197
+ options.apply_defaults timeout: @config.rpcs.list_instance_partitions.timeout,
1198
+ metadata: metadata,
1199
+ retry_policy: @config.rpcs.list_instance_partitions.retry_policy
1200
+
1201
+ options.apply_defaults timeout: @config.timeout,
1202
+ metadata: @config.metadata,
1203
+ retry_policy: @config.retry_policy
1204
+
1205
+ @instance_admin_stub.call_rpc :list_instance_partitions, request, options: options do |response, operation|
1206
+ response = ::Gapic::PagedEnumerable.new @instance_admin_stub, :list_instance_partitions, request, response, operation, options
1207
+ yield response, operation if block_given?
1208
+ return response
1209
+ end
1210
+ rescue ::GRPC::BadStatus => e
1211
+ raise ::Google::Cloud::Error.from_error(e)
1212
+ end
1213
+
1101
1214
  ##
1102
1215
  # Gets information about a particular instance.
1103
1216
  #
@@ -1851,156 +1964,791 @@ module Google
1851
1964
  end
1852
1965
 
1853
1966
  ##
1854
- # Configuration class for the InstanceAdmin API.
1967
+ # Gets information about a particular instance partition.
1855
1968
  #
1856
- # This class represents the configuration for InstanceAdmin,
1857
- # providing control over timeouts, retry behavior, logging, transport
1858
- # parameters, and other low-level controls. Certain parameters can also be
1859
- # applied individually to specific RPCs. See
1860
- # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client::Configuration::Rpcs}
1861
- # for a list of RPCs that can be configured independently.
1969
+ # @overload get_instance_partition(request, options = nil)
1970
+ # Pass arguments to `get_instance_partition` via a request object, either of type
1971
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest} or an equivalent Hash.
1862
1972
  #
1863
- # Configuration can be applied globally to all clients, or to a single client
1864
- # on construction.
1973
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest, ::Hash]
1974
+ # A request object representing the call parameters. Required. To specify no
1975
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1976
+ # @param options [::Gapic::CallOptions, ::Hash]
1977
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1865
1978
  #
1866
- # @example
1979
+ # @overload get_instance_partition(name: nil)
1980
+ # Pass arguments to `get_instance_partition` via keyword arguments. Note that at
1981
+ # least one keyword argument is required. To specify no parameters, or to keep all
1982
+ # the default parameter values, pass an empty Hash as a request object (see above).
1867
1983
  #
1868
- # # Modify the global config, setting the timeout for
1869
- # # list_instance_configs to 20 seconds,
1870
- # # and all remaining timeouts to 10 seconds.
1871
- # ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.configure do |config|
1872
- # config.timeout = 10.0
1873
- # config.rpcs.list_instance_configs.timeout = 20.0
1874
- # end
1984
+ # @param name [::String]
1985
+ # Required. The name of the requested instance partition. Values are of
1986
+ # the form
1987
+ # `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
1875
1988
  #
1876
- # # Apply the above configuration only to a new client.
1877
- # client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new do |config|
1878
- # config.timeout = 10.0
1879
- # config.rpcs.list_instance_configs.timeout = 20.0
1880
- # end
1989
+ # @yield [response, operation] Access the result along with the RPC operation
1990
+ # @yieldparam response [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition]
1991
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1881
1992
  #
1882
- # @!attribute [rw] endpoint
1883
- # A custom service endpoint, as a hostname or hostname:port. The default is
1884
- # nil, indicating to use the default endpoint in the current universe domain.
1885
- # @return [::String,nil]
1886
- # @!attribute [rw] credentials
1887
- # Credentials to send with calls. You may provide any of the following types:
1888
- # * (`String`) The path to a service account key file in JSON format
1889
- # * (`Hash`) A service account key as a Hash
1890
- # * (`Google::Auth::Credentials`) A googleauth credentials object
1891
- # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1892
- # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1893
- # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1894
- # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1895
- # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1896
- # * (`nil`) indicating no credentials
1897
- # @return [::Object]
1898
- # @!attribute [rw] scope
1899
- # The OAuth scopes
1900
- # @return [::Array<::String>]
1901
- # @!attribute [rw] lib_name
1902
- # The library name as recorded in instrumentation and logging
1903
- # @return [::String]
1904
- # @!attribute [rw] lib_version
1905
- # The library version as recorded in instrumentation and logging
1906
- # @return [::String]
1907
- # @!attribute [rw] channel_args
1908
- # Extra parameters passed to the gRPC channel. Note: this is ignored if a
1909
- # `GRPC::Core::Channel` object is provided as the credential.
1910
- # @return [::Hash]
1911
- # @!attribute [rw] interceptors
1912
- # An array of interceptors that are run before calls are executed.
1913
- # @return [::Array<::GRPC::ClientInterceptor>]
1914
- # @!attribute [rw] timeout
1915
- # The call timeout in seconds.
1916
- # @return [::Numeric]
1917
- # @!attribute [rw] metadata
1918
- # Additional gRPC headers to be sent with the call.
1919
- # @return [::Hash{::Symbol=>::String}]
1920
- # @!attribute [rw] retry_policy
1921
- # The retry policy. The value is a hash with the following keys:
1922
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1923
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1924
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1925
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1926
- # trigger a retry.
1927
- # @return [::Hash]
1928
- # @!attribute [rw] quota_project
1929
- # A separate project against which to charge quota.
1930
- # @return [::String]
1931
- # @!attribute [rw] universe_domain
1932
- # The universe domain within which to make requests. This determines the
1933
- # default endpoint URL. The default value of nil uses the environment
1934
- # universe (usually the default "googleapis.com" universe).
1935
- # @return [::String,nil]
1993
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition]
1936
1994
  #
1937
- class Configuration
1938
- extend ::Gapic::Config
1995
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1996
+ #
1997
+ # @example Basic example
1998
+ # require "google/cloud/spanner/admin/instance/v1"
1999
+ #
2000
+ # # Create a client object. The client can be reused for multiple calls.
2001
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
2002
+ #
2003
+ # # Create a request. To set request fields, pass in keyword arguments.
2004
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest.new
2005
+ #
2006
+ # # Call the get_instance_partition method.
2007
+ # result = client.get_instance_partition request
2008
+ #
2009
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition.
2010
+ # p result
2011
+ #
2012
+ def get_instance_partition request, options = nil
2013
+ raise ::ArgumentError, "request must be provided" if request.nil?
1939
2014
 
1940
- # @private
1941
- # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1942
- DEFAULT_ENDPOINT = "spanner.googleapis.com"
2015
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest
1943
2016
 
1944
- config_attr :endpoint, nil, ::String, nil
1945
- config_attr :credentials, nil do |value|
1946
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1947
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1948
- allowed.any? { |klass| klass === value }
1949
- end
1950
- config_attr :scope, nil, ::String, ::Array, nil
1951
- config_attr :lib_name, nil, ::String, nil
1952
- config_attr :lib_version, nil, ::String, nil
1953
- config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
1954
- config_attr :interceptors, nil, ::Array, nil
1955
- config_attr :timeout, nil, ::Numeric, nil
1956
- config_attr :metadata, nil, ::Hash, nil
1957
- config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1958
- config_attr :quota_project, nil, ::String, nil
1959
- config_attr :universe_domain, nil, ::String, nil
2017
+ # Converts hash and nil to an options object
2018
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1960
2019
 
1961
- # @private
1962
- def initialize parent_config = nil
1963
- @parent_config = parent_config unless parent_config.nil?
2020
+ # Customize the options with defaults
2021
+ metadata = @config.rpcs.get_instance_partition.metadata.to_h
1964
2022
 
1965
- yield self if block_given?
1966
- end
2023
+ # Set x-goog-api-client and x-goog-user-project headers
2024
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2025
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2026
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
2027
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1967
2028
 
1968
- ##
1969
- # Configurations for individual RPCs
1970
- # @return [Rpcs]
1971
- #
1972
- def rpcs
1973
- @rpcs ||= begin
1974
- parent_rpcs = nil
1975
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1976
- Rpcs.new parent_rpcs
1977
- end
2029
+ header_params = {}
2030
+ if request.name
2031
+ header_params["name"] = request.name
1978
2032
  end
1979
2033
 
1980
- ##
1981
- # Configuration for the channel pool
1982
- # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1983
- #
1984
- def channel_pool
1985
- @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
2034
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2035
+ metadata[:"x-goog-request-params"] ||= request_params_header
2036
+
2037
+ options.apply_defaults timeout: @config.rpcs.get_instance_partition.timeout,
2038
+ metadata: metadata,
2039
+ retry_policy: @config.rpcs.get_instance_partition.retry_policy
2040
+
2041
+ options.apply_defaults timeout: @config.timeout,
2042
+ metadata: @config.metadata,
2043
+ retry_policy: @config.retry_policy
2044
+
2045
+ @instance_admin_stub.call_rpc :get_instance_partition, request, options: options do |response, operation|
2046
+ yield response, operation if block_given?
2047
+ return response
1986
2048
  end
2049
+ rescue ::GRPC::BadStatus => e
2050
+ raise ::Google::Cloud::Error.from_error(e)
2051
+ end
1987
2052
 
1988
- ##
1989
- # Configuration RPC class for the InstanceAdmin API.
1990
- #
1991
- # Includes fields providing the configuration for each RPC in this service.
1992
- # Each configuration object is of type `Gapic::Config::Method` and includes
1993
- # the following configuration fields:
1994
- #
1995
- # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1996
- # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1997
- # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1998
- # include the following keys:
1999
- # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2000
- # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2001
- # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2002
- # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2003
- # trigger a retry.
2053
+ ##
2054
+ # Creates an instance partition and begins preparing it to be used. The
2055
+ # returned {::Google::Longrunning::Operation long-running operation}
2056
+ # can be used to track the progress of preparing the new instance partition.
2057
+ # The instance partition name is assigned by the caller. If the named
2058
+ # instance partition already exists, `CreateInstancePartition` returns
2059
+ # `ALREADY_EXISTS`.
2060
+ #
2061
+ # Immediately upon completion of this request:
2062
+ #
2063
+ # * The instance partition is readable via the API, with all requested
2064
+ # attributes but no allocated resources. Its state is `CREATING`.
2065
+ #
2066
+ # Until completion of the returned operation:
2067
+ #
2068
+ # * Cancelling the operation renders the instance partition immediately
2069
+ # unreadable via the API.
2070
+ # * The instance partition can be deleted.
2071
+ # * All other attempts to modify the instance partition are rejected.
2072
+ #
2073
+ # Upon completion of the returned operation:
2074
+ #
2075
+ # * Billing for all successfully-allocated resources begins (some types
2076
+ # may have lower than the requested levels).
2077
+ # * Databases can start using this instance partition.
2078
+ # * The instance partition's allocated resource levels are readable via the
2079
+ # API.
2080
+ # * The instance partition's state becomes `READY`.
2081
+ #
2082
+ # The returned {::Google::Longrunning::Operation long-running operation} will
2083
+ # have a name of the format
2084
+ # `<instance_partition_name>/operations/<operation_id>` and can be used to
2085
+ # track creation of the instance partition. The
2086
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
2087
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}.
2088
+ # The {::Google::Longrunning::Operation#response response} field type is
2089
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}, if
2090
+ # successful.
2091
+ #
2092
+ # @overload create_instance_partition(request, options = nil)
2093
+ # Pass arguments to `create_instance_partition` via a request object, either of type
2094
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest} or an equivalent Hash.
2095
+ #
2096
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest, ::Hash]
2097
+ # A request object representing the call parameters. Required. To specify no
2098
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2099
+ # @param options [::Gapic::CallOptions, ::Hash]
2100
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2101
+ #
2102
+ # @overload create_instance_partition(parent: nil, instance_partition_id: nil, instance_partition: nil)
2103
+ # Pass arguments to `create_instance_partition` via keyword arguments. Note that at
2104
+ # least one keyword argument is required. To specify no parameters, or to keep all
2105
+ # the default parameter values, pass an empty Hash as a request object (see above).
2106
+ #
2107
+ # @param parent [::String]
2108
+ # Required. The name of the instance in which to create the instance
2109
+ # partition. Values are of the form
2110
+ # `projects/<project>/instances/<instance>`.
2111
+ # @param instance_partition_id [::String]
2112
+ # Required. The ID of the instance partition to create. Valid identifiers are
2113
+ # of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
2114
+ # characters in length.
2115
+ # @param instance_partition [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition, ::Hash]
2116
+ # Required. The instance partition to create. The instance_partition.name may
2117
+ # be omitted, but if specified must be
2118
+ # `<parent>/instancePartitions/<instance_partition_id>`.
2119
+ #
2120
+ # @yield [response, operation] Access the result along with the RPC operation
2121
+ # @yieldparam response [::Gapic::Operation]
2122
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2123
+ #
2124
+ # @return [::Gapic::Operation]
2125
+ #
2126
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2127
+ #
2128
+ # @example Basic example
2129
+ # require "google/cloud/spanner/admin/instance/v1"
2130
+ #
2131
+ # # Create a client object. The client can be reused for multiple calls.
2132
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
2133
+ #
2134
+ # # Create a request. To set request fields, pass in keyword arguments.
2135
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest.new
2136
+ #
2137
+ # # Call the create_instance_partition method.
2138
+ # result = client.create_instance_partition request
2139
+ #
2140
+ # # The returned object is of type Gapic::Operation. You can use it to
2141
+ # # check the status of an operation, cancel it, or wait for results.
2142
+ # # Here is how to wait for a response.
2143
+ # result.wait_until_done! timeout: 60
2144
+ # if result.response?
2145
+ # p result.response
2146
+ # else
2147
+ # puts "No response received."
2148
+ # end
2149
+ #
2150
+ def create_instance_partition request, options = nil
2151
+ raise ::ArgumentError, "request must be provided" if request.nil?
2152
+
2153
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest
2154
+
2155
+ # Converts hash and nil to an options object
2156
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2157
+
2158
+ # Customize the options with defaults
2159
+ metadata = @config.rpcs.create_instance_partition.metadata.to_h
2160
+
2161
+ # Set x-goog-api-client and x-goog-user-project headers
2162
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2163
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2164
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
2165
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2166
+
2167
+ header_params = {}
2168
+ if request.parent
2169
+ header_params["parent"] = request.parent
2170
+ end
2171
+
2172
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2173
+ metadata[:"x-goog-request-params"] ||= request_params_header
2174
+
2175
+ options.apply_defaults timeout: @config.rpcs.create_instance_partition.timeout,
2176
+ metadata: metadata,
2177
+ retry_policy: @config.rpcs.create_instance_partition.retry_policy
2178
+
2179
+ options.apply_defaults timeout: @config.timeout,
2180
+ metadata: @config.metadata,
2181
+ retry_policy: @config.retry_policy
2182
+
2183
+ @instance_admin_stub.call_rpc :create_instance_partition, request, options: options do |response, operation|
2184
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2185
+ yield response, operation if block_given?
2186
+ return response
2187
+ end
2188
+ rescue ::GRPC::BadStatus => e
2189
+ raise ::Google::Cloud::Error.from_error(e)
2190
+ end
2191
+
2192
+ ##
2193
+ # Deletes an existing instance partition. Requires that the
2194
+ # instance partition is not used by any database or backup and is not the
2195
+ # default instance partition of an instance.
2196
+ #
2197
+ # Authorization requires `spanner.instancePartitions.delete` permission on
2198
+ # the resource
2199
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition#name name}.
2200
+ #
2201
+ # @overload delete_instance_partition(request, options = nil)
2202
+ # Pass arguments to `delete_instance_partition` via a request object, either of type
2203
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest} or an equivalent Hash.
2204
+ #
2205
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest, ::Hash]
2206
+ # A request object representing the call parameters. Required. To specify no
2207
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2208
+ # @param options [::Gapic::CallOptions, ::Hash]
2209
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2210
+ #
2211
+ # @overload delete_instance_partition(name: nil, etag: nil)
2212
+ # Pass arguments to `delete_instance_partition` via keyword arguments. Note that at
2213
+ # least one keyword argument is required. To specify no parameters, or to keep all
2214
+ # the default parameter values, pass an empty Hash as a request object (see above).
2215
+ #
2216
+ # @param name [::String]
2217
+ # Required. The name of the instance partition to be deleted.
2218
+ # Values are of the form
2219
+ # `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
2220
+ # @param etag [::String]
2221
+ # Optional. If not empty, the API only deletes the instance partition when
2222
+ # the etag provided matches the current status of the requested instance
2223
+ # partition. Otherwise, deletes the instance partition without checking the
2224
+ # current status of the requested instance partition.
2225
+ #
2226
+ # @yield [response, operation] Access the result along with the RPC operation
2227
+ # @yieldparam response [::Google::Protobuf::Empty]
2228
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2229
+ #
2230
+ # @return [::Google::Protobuf::Empty]
2231
+ #
2232
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2233
+ #
2234
+ # @example Basic example
2235
+ # require "google/cloud/spanner/admin/instance/v1"
2236
+ #
2237
+ # # Create a client object. The client can be reused for multiple calls.
2238
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
2239
+ #
2240
+ # # Create a request. To set request fields, pass in keyword arguments.
2241
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest.new
2242
+ #
2243
+ # # Call the delete_instance_partition method.
2244
+ # result = client.delete_instance_partition request
2245
+ #
2246
+ # # The returned object is of type Google::Protobuf::Empty.
2247
+ # p result
2248
+ #
2249
+ def delete_instance_partition request, options = nil
2250
+ raise ::ArgumentError, "request must be provided" if request.nil?
2251
+
2252
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest
2253
+
2254
+ # Converts hash and nil to an options object
2255
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2256
+
2257
+ # Customize the options with defaults
2258
+ metadata = @config.rpcs.delete_instance_partition.metadata.to_h
2259
+
2260
+ # Set x-goog-api-client and x-goog-user-project headers
2261
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2262
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2263
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
2264
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2265
+
2266
+ header_params = {}
2267
+ if request.name
2268
+ header_params["name"] = request.name
2269
+ end
2270
+
2271
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2272
+ metadata[:"x-goog-request-params"] ||= request_params_header
2273
+
2274
+ options.apply_defaults timeout: @config.rpcs.delete_instance_partition.timeout,
2275
+ metadata: metadata,
2276
+ retry_policy: @config.rpcs.delete_instance_partition.retry_policy
2277
+
2278
+ options.apply_defaults timeout: @config.timeout,
2279
+ metadata: @config.metadata,
2280
+ retry_policy: @config.retry_policy
2281
+
2282
+ @instance_admin_stub.call_rpc :delete_instance_partition, request, options: options do |response, operation|
2283
+ yield response, operation if block_given?
2284
+ return response
2285
+ end
2286
+ rescue ::GRPC::BadStatus => e
2287
+ raise ::Google::Cloud::Error.from_error(e)
2288
+ end
2289
+
2290
+ ##
2291
+ # Updates an instance partition, and begins allocating or releasing resources
2292
+ # as requested. The returned [long-running
2293
+ # operation][google.longrunning.Operation] can be used to track the
2294
+ # progress of updating the instance partition. If the named instance
2295
+ # partition does not exist, returns `NOT_FOUND`.
2296
+ #
2297
+ # Immediately upon completion of this request:
2298
+ #
2299
+ # * For resource types for which a decrease in the instance partition's
2300
+ # allocation has been requested, billing is based on the newly-requested
2301
+ # level.
2302
+ #
2303
+ # Until completion of the returned operation:
2304
+ #
2305
+ # * Cancelling the operation sets its metadata's
2306
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionMetadata#cancel_time cancel_time},
2307
+ # and begins restoring resources to their pre-request values. The
2308
+ # operation is guaranteed to succeed at undoing all resource changes,
2309
+ # after which point it terminates with a `CANCELLED` status.
2310
+ # * All other attempts to modify the instance partition are rejected.
2311
+ # * Reading the instance partition via the API continues to give the
2312
+ # pre-request resource levels.
2313
+ #
2314
+ # Upon completion of the returned operation:
2315
+ #
2316
+ # * Billing begins for all successfully-allocated resources (some types
2317
+ # may have lower than the requested levels).
2318
+ # * All newly-reserved resources are available for serving the instance
2319
+ # partition's tables.
2320
+ # * The instance partition's new resource levels are readable via the API.
2321
+ #
2322
+ # The returned {::Google::Longrunning::Operation long-running operation} will
2323
+ # have a name of the format
2324
+ # `<instance_partition_name>/operations/<operation_id>` and can be used to
2325
+ # track the instance partition modification. The
2326
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
2327
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionMetadata UpdateInstancePartitionMetadata}.
2328
+ # The {::Google::Longrunning::Operation#response response} field type is
2329
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}, if
2330
+ # successful.
2331
+ #
2332
+ # Authorization requires `spanner.instancePartitions.update` permission on
2333
+ # the resource
2334
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition#name name}.
2335
+ #
2336
+ # @overload update_instance_partition(request, options = nil)
2337
+ # Pass arguments to `update_instance_partition` via a request object, either of type
2338
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest} or an equivalent Hash.
2339
+ #
2340
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest, ::Hash]
2341
+ # A request object representing the call parameters. Required. To specify no
2342
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2343
+ # @param options [::Gapic::CallOptions, ::Hash]
2344
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2345
+ #
2346
+ # @overload update_instance_partition(instance_partition: nil, field_mask: nil)
2347
+ # Pass arguments to `update_instance_partition` via keyword arguments. Note that at
2348
+ # least one keyword argument is required. To specify no parameters, or to keep all
2349
+ # the default parameter values, pass an empty Hash as a request object (see above).
2350
+ #
2351
+ # @param instance_partition [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition, ::Hash]
2352
+ # Required. The instance partition to update, which must always include the
2353
+ # instance partition name. Otherwise, only fields mentioned in
2354
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest#field_mask field_mask}
2355
+ # need be included.
2356
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
2357
+ # Required. A mask specifying which fields in
2358
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}
2359
+ # should be updated. The field mask must always be specified; this prevents
2360
+ # any future fields in
2361
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}
2362
+ # from being erased accidentally by clients that do not know about them.
2363
+ #
2364
+ # @yield [response, operation] Access the result along with the RPC operation
2365
+ # @yieldparam response [::Gapic::Operation]
2366
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2367
+ #
2368
+ # @return [::Gapic::Operation]
2369
+ #
2370
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2371
+ #
2372
+ # @example Basic example
2373
+ # require "google/cloud/spanner/admin/instance/v1"
2374
+ #
2375
+ # # Create a client object. The client can be reused for multiple calls.
2376
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
2377
+ #
2378
+ # # Create a request. To set request fields, pass in keyword arguments.
2379
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest.new
2380
+ #
2381
+ # # Call the update_instance_partition method.
2382
+ # result = client.update_instance_partition request
2383
+ #
2384
+ # # The returned object is of type Gapic::Operation. You can use it to
2385
+ # # check the status of an operation, cancel it, or wait for results.
2386
+ # # Here is how to wait for a response.
2387
+ # result.wait_until_done! timeout: 60
2388
+ # if result.response?
2389
+ # p result.response
2390
+ # else
2391
+ # puts "No response received."
2392
+ # end
2393
+ #
2394
+ def update_instance_partition request, options = nil
2395
+ raise ::ArgumentError, "request must be provided" if request.nil?
2396
+
2397
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest
2398
+
2399
+ # Converts hash and nil to an options object
2400
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2401
+
2402
+ # Customize the options with defaults
2403
+ metadata = @config.rpcs.update_instance_partition.metadata.to_h
2404
+
2405
+ # Set x-goog-api-client and x-goog-user-project headers
2406
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2407
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2408
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
2409
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2410
+
2411
+ header_params = {}
2412
+ if request.instance_partition&.name
2413
+ header_params["instance_partition.name"] = request.instance_partition.name
2414
+ end
2415
+
2416
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2417
+ metadata[:"x-goog-request-params"] ||= request_params_header
2418
+
2419
+ options.apply_defaults timeout: @config.rpcs.update_instance_partition.timeout,
2420
+ metadata: metadata,
2421
+ retry_policy: @config.rpcs.update_instance_partition.retry_policy
2422
+
2423
+ options.apply_defaults timeout: @config.timeout,
2424
+ metadata: @config.metadata,
2425
+ retry_policy: @config.retry_policy
2426
+
2427
+ @instance_admin_stub.call_rpc :update_instance_partition, request, options: options do |response, operation|
2428
+ response = ::Gapic::Operation.new response, @operations_client, options: options
2429
+ yield response, operation if block_given?
2430
+ return response
2431
+ end
2432
+ rescue ::GRPC::BadStatus => e
2433
+ raise ::Google::Cloud::Error.from_error(e)
2434
+ end
2435
+
2436
+ ##
2437
+ # Lists instance partition [long-running
2438
+ # operations][google.longrunning.Operation] in the given instance.
2439
+ # An instance partition operation has a name of the form
2440
+ # `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
2441
+ # The long-running operation
2442
+ # {::Google::Longrunning::Operation#metadata metadata} field type
2443
+ # `metadata.type_url` describes the type of the metadata. Operations returned
2444
+ # include those that have completed/failed/canceled within the last 7 days,
2445
+ # and pending operations. Operations returned are ordered by
2446
+ # `operation.metadata.value.start_time` in descending order starting from the
2447
+ # most recently started operation.
2448
+ #
2449
+ # Authorization requires `spanner.instancePartitionOperations.list`
2450
+ # permission on the resource
2451
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest#parent parent}.
2452
+ #
2453
+ # @overload list_instance_partition_operations(request, options = nil)
2454
+ # Pass arguments to `list_instance_partition_operations` via a request object, either of type
2455
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest} or an equivalent Hash.
2456
+ #
2457
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest, ::Hash]
2458
+ # A request object representing the call parameters. Required. To specify no
2459
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2460
+ # @param options [::Gapic::CallOptions, ::Hash]
2461
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
2462
+ #
2463
+ # @overload list_instance_partition_operations(parent: nil, filter: nil, page_size: nil, page_token: nil, instance_partition_deadline: nil)
2464
+ # Pass arguments to `list_instance_partition_operations` via keyword arguments. Note that at
2465
+ # least one keyword argument is required. To specify no parameters, or to keep all
2466
+ # the default parameter values, pass an empty Hash as a request object (see above).
2467
+ #
2468
+ # @param parent [::String]
2469
+ # Required. The parent instance of the instance partition operations.
2470
+ # Values are of the form `projects/<project>/instances/<instance>`.
2471
+ # @param filter [::String]
2472
+ # Optional. An expression that filters the list of returned operations.
2473
+ #
2474
+ # A filter expression consists of a field name, a
2475
+ # comparison operator, and a value for filtering.
2476
+ # The value must be a string, a number, or a boolean. The comparison operator
2477
+ # must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
2478
+ # Colon `:` is the contains operator. Filter rules are not case sensitive.
2479
+ #
2480
+ # The following fields in the {::Google::Longrunning::Operation Operation}
2481
+ # are eligible for filtering:
2482
+ #
2483
+ # * `name` - The name of the long-running operation
2484
+ # * `done` - False if the operation is in progress, else true.
2485
+ # * `metadata.@type` - the type of metadata. For example, the type string
2486
+ # for
2487
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}
2488
+ # is
2489
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
2490
+ # * `metadata.<field_name>` - any field in metadata.value.
2491
+ # `metadata.@type` must be specified first, if filtering on metadata
2492
+ # fields.
2493
+ # * `error` - Error associated with the long-running operation.
2494
+ # * `response.@type` - the type of response.
2495
+ # * `response.<field_name>` - any field in response.value.
2496
+ #
2497
+ # You can combine multiple expressions by enclosing each expression in
2498
+ # parentheses. By default, expressions are combined with AND logic. However,
2499
+ # you can specify AND, OR, and NOT logic explicitly.
2500
+ #
2501
+ # Here are a few examples:
2502
+ #
2503
+ # * `done:true` - The operation is complete.
2504
+ # * `(metadata.@type=` \
2505
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
2506
+ # AND` \
2507
+ # `(metadata.instance_partition.name:custom-instance-partition) AND` \
2508
+ # `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
2509
+ # `(error:*)` - Return operations where:
2510
+ # * The operation's metadata type is
2511
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}.
2512
+ # * The instance partition name contains "custom-instance-partition".
2513
+ # * The operation started before 2021-03-28T14:50:00Z.
2514
+ # * The operation resulted in an error.
2515
+ # @param page_size [::Integer]
2516
+ # Optional. Number of operations to be returned in the response. If 0 or
2517
+ # less, defaults to the server's maximum allowed page size.
2518
+ # @param page_token [::String]
2519
+ # Optional. If non-empty, `page_token` should contain a
2520
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse#next_page_token next_page_token}
2521
+ # from a previous
2522
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse ListInstancePartitionOperationsResponse}
2523
+ # to the same `parent` and with the same `filter`.
2524
+ # @param instance_partition_deadline [::Google::Protobuf::Timestamp, ::Hash]
2525
+ # Optional. Deadline used while retrieving metadata for instance partition
2526
+ # operations. Instance partitions whose operation metadata cannot be
2527
+ # retrieved within this deadline will be added to
2528
+ # [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
2529
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse ListInstancePartitionOperationsResponse}.
2530
+ #
2531
+ # @yield [response, operation] Access the result along with the RPC operation
2532
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
2533
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
2534
+ #
2535
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
2536
+ #
2537
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
2538
+ #
2539
+ # @example Basic example
2540
+ # require "google/cloud/spanner/admin/instance/v1"
2541
+ #
2542
+ # # Create a client object. The client can be reused for multiple calls.
2543
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new
2544
+ #
2545
+ # # Create a request. To set request fields, pass in keyword arguments.
2546
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest.new
2547
+ #
2548
+ # # Call the list_instance_partition_operations method.
2549
+ # result = client.list_instance_partition_operations request
2550
+ #
2551
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2552
+ # # over elements, and API calls will be issued to fetch pages as needed.
2553
+ # result.each do |item|
2554
+ # # Each element is of type ::Google::Longrunning::Operation.
2555
+ # p item
2556
+ # end
2557
+ #
2558
+ def list_instance_partition_operations request, options = nil
2559
+ raise ::ArgumentError, "request must be provided" if request.nil?
2560
+
2561
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest
2562
+
2563
+ # Converts hash and nil to an options object
2564
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2565
+
2566
+ # Customize the options with defaults
2567
+ metadata = @config.rpcs.list_instance_partition_operations.metadata.to_h
2568
+
2569
+ # Set x-goog-api-client and x-goog-user-project headers
2570
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2571
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2572
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
2573
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2574
+
2575
+ header_params = {}
2576
+ if request.parent
2577
+ header_params["parent"] = request.parent
2578
+ end
2579
+
2580
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
2581
+ metadata[:"x-goog-request-params"] ||= request_params_header
2582
+
2583
+ options.apply_defaults timeout: @config.rpcs.list_instance_partition_operations.timeout,
2584
+ metadata: metadata,
2585
+ retry_policy: @config.rpcs.list_instance_partition_operations.retry_policy
2586
+
2587
+ options.apply_defaults timeout: @config.timeout,
2588
+ metadata: @config.metadata,
2589
+ retry_policy: @config.retry_policy
2590
+
2591
+ @instance_admin_stub.call_rpc :list_instance_partition_operations, request, options: options do |response, operation|
2592
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
2593
+ response = ::Gapic::PagedEnumerable.new @instance_admin_stub, :list_instance_partition_operations, request, response, operation, options, format_resource: wrap_lro_operation
2594
+ yield response, operation if block_given?
2595
+ return response
2596
+ end
2597
+ rescue ::GRPC::BadStatus => e
2598
+ raise ::Google::Cloud::Error.from_error(e)
2599
+ end
2600
+
2601
+ ##
2602
+ # Configuration class for the InstanceAdmin API.
2603
+ #
2604
+ # This class represents the configuration for InstanceAdmin,
2605
+ # providing control over timeouts, retry behavior, logging, transport
2606
+ # parameters, and other low-level controls. Certain parameters can also be
2607
+ # applied individually to specific RPCs. See
2608
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client::Configuration::Rpcs}
2609
+ # for a list of RPCs that can be configured independently.
2610
+ #
2611
+ # Configuration can be applied globally to all clients, or to a single client
2612
+ # on construction.
2613
+ #
2614
+ # @example
2615
+ #
2616
+ # # Modify the global config, setting the timeout for
2617
+ # # list_instance_configs to 20 seconds,
2618
+ # # and all remaining timeouts to 10 seconds.
2619
+ # ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.configure do |config|
2620
+ # config.timeout = 10.0
2621
+ # config.rpcs.list_instance_configs.timeout = 20.0
2622
+ # end
2623
+ #
2624
+ # # Apply the above configuration only to a new client.
2625
+ # client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new do |config|
2626
+ # config.timeout = 10.0
2627
+ # config.rpcs.list_instance_configs.timeout = 20.0
2628
+ # end
2629
+ #
2630
+ # @!attribute [rw] endpoint
2631
+ # A custom service endpoint, as a hostname or hostname:port. The default is
2632
+ # nil, indicating to use the default endpoint in the current universe domain.
2633
+ # @return [::String,nil]
2634
+ # @!attribute [rw] credentials
2635
+ # Credentials to send with calls. You may provide any of the following types:
2636
+ # * (`String`) The path to a service account key file in JSON format
2637
+ # * (`Hash`) A service account key as a Hash
2638
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
2639
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
2640
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2641
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2642
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2643
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2644
+ # * (`nil`) indicating no credentials
2645
+ # @return [::Object]
2646
+ # @!attribute [rw] scope
2647
+ # The OAuth scopes
2648
+ # @return [::Array<::String>]
2649
+ # @!attribute [rw] lib_name
2650
+ # The library name as recorded in instrumentation and logging
2651
+ # @return [::String]
2652
+ # @!attribute [rw] lib_version
2653
+ # The library version as recorded in instrumentation and logging
2654
+ # @return [::String]
2655
+ # @!attribute [rw] channel_args
2656
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
2657
+ # `GRPC::Core::Channel` object is provided as the credential.
2658
+ # @return [::Hash]
2659
+ # @!attribute [rw] interceptors
2660
+ # An array of interceptors that are run before calls are executed.
2661
+ # @return [::Array<::GRPC::ClientInterceptor>]
2662
+ # @!attribute [rw] timeout
2663
+ # The call timeout in seconds.
2664
+ # @return [::Numeric]
2665
+ # @!attribute [rw] metadata
2666
+ # Additional gRPC headers to be sent with the call.
2667
+ # @return [::Hash{::Symbol=>::String}]
2668
+ # @!attribute [rw] retry_policy
2669
+ # The retry policy. The value is a hash with the following keys:
2670
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2671
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2672
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2673
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2674
+ # trigger a retry.
2675
+ # @return [::Hash]
2676
+ # @!attribute [rw] quota_project
2677
+ # A separate project against which to charge quota.
2678
+ # @return [::String]
2679
+ # @!attribute [rw] universe_domain
2680
+ # The universe domain within which to make requests. This determines the
2681
+ # default endpoint URL. The default value of nil uses the environment
2682
+ # universe (usually the default "googleapis.com" universe).
2683
+ # @return [::String,nil]
2684
+ #
2685
+ class Configuration
2686
+ extend ::Gapic::Config
2687
+
2688
+ # @private
2689
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
2690
+ DEFAULT_ENDPOINT = "spanner.googleapis.com"
2691
+
2692
+ config_attr :endpoint, nil, ::String, nil
2693
+ config_attr :credentials, nil do |value|
2694
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
2695
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
2696
+ allowed.any? { |klass| klass === value }
2697
+ end
2698
+ config_attr :scope, nil, ::String, ::Array, nil
2699
+ config_attr :lib_name, nil, ::String, nil
2700
+ config_attr :lib_version, nil, ::String, nil
2701
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
2702
+ config_attr :interceptors, nil, ::Array, nil
2703
+ config_attr :timeout, nil, ::Numeric, nil
2704
+ config_attr :metadata, nil, ::Hash, nil
2705
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2706
+ config_attr :quota_project, nil, ::String, nil
2707
+ config_attr :universe_domain, nil, ::String, nil
2708
+
2709
+ # @private
2710
+ def initialize parent_config = nil
2711
+ @parent_config = parent_config unless parent_config.nil?
2712
+
2713
+ yield self if block_given?
2714
+ end
2715
+
2716
+ ##
2717
+ # Configurations for individual RPCs
2718
+ # @return [Rpcs]
2719
+ #
2720
+ def rpcs
2721
+ @rpcs ||= begin
2722
+ parent_rpcs = nil
2723
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
2724
+ Rpcs.new parent_rpcs
2725
+ end
2726
+ end
2727
+
2728
+ ##
2729
+ # Configuration for the channel pool
2730
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
2731
+ #
2732
+ def channel_pool
2733
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
2734
+ end
2735
+
2736
+ ##
2737
+ # Configuration RPC class for the InstanceAdmin API.
2738
+ #
2739
+ # Includes fields providing the configuration for each RPC in this service.
2740
+ # Each configuration object is of type `Gapic::Config::Method` and includes
2741
+ # the following configuration fields:
2742
+ #
2743
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
2744
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
2745
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
2746
+ # include the following keys:
2747
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
2748
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
2749
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
2750
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
2751
+ # trigger a retry.
2004
2752
  #
2005
2753
  class Rpcs
2006
2754
  ##
@@ -2039,6 +2787,11 @@ module Google
2039
2787
  #
2040
2788
  attr_reader :list_instances
2041
2789
  ##
2790
+ # RPC-specific configuration for `list_instance_partitions`
2791
+ # @return [::Gapic::Config::Method]
2792
+ #
2793
+ attr_reader :list_instance_partitions
2794
+ ##
2042
2795
  # RPC-specific configuration for `get_instance`
2043
2796
  # @return [::Gapic::Config::Method]
2044
2797
  #
@@ -2073,6 +2826,31 @@ module Google
2073
2826
  # @return [::Gapic::Config::Method]
2074
2827
  #
2075
2828
  attr_reader :test_iam_permissions
2829
+ ##
2830
+ # RPC-specific configuration for `get_instance_partition`
2831
+ # @return [::Gapic::Config::Method]
2832
+ #
2833
+ attr_reader :get_instance_partition
2834
+ ##
2835
+ # RPC-specific configuration for `create_instance_partition`
2836
+ # @return [::Gapic::Config::Method]
2837
+ #
2838
+ attr_reader :create_instance_partition
2839
+ ##
2840
+ # RPC-specific configuration for `delete_instance_partition`
2841
+ # @return [::Gapic::Config::Method]
2842
+ #
2843
+ attr_reader :delete_instance_partition
2844
+ ##
2845
+ # RPC-specific configuration for `update_instance_partition`
2846
+ # @return [::Gapic::Config::Method]
2847
+ #
2848
+ attr_reader :update_instance_partition
2849
+ ##
2850
+ # RPC-specific configuration for `list_instance_partition_operations`
2851
+ # @return [::Gapic::Config::Method]
2852
+ #
2853
+ attr_reader :list_instance_partition_operations
2076
2854
 
2077
2855
  # @private
2078
2856
  def initialize parent_rpcs = nil
@@ -2090,6 +2868,8 @@ module Google
2090
2868
  @list_instance_config_operations = ::Gapic::Config::Method.new list_instance_config_operations_config
2091
2869
  list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
2092
2870
  @list_instances = ::Gapic::Config::Method.new list_instances_config
2871
+ list_instance_partitions_config = parent_rpcs.list_instance_partitions if parent_rpcs.respond_to? :list_instance_partitions
2872
+ @list_instance_partitions = ::Gapic::Config::Method.new list_instance_partitions_config
2093
2873
  get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
2094
2874
  @get_instance = ::Gapic::Config::Method.new get_instance_config
2095
2875
  create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
@@ -2104,6 +2884,16 @@ module Google
2104
2884
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
2105
2885
  test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
2106
2886
  @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
2887
+ get_instance_partition_config = parent_rpcs.get_instance_partition if parent_rpcs.respond_to? :get_instance_partition
2888
+ @get_instance_partition = ::Gapic::Config::Method.new get_instance_partition_config
2889
+ create_instance_partition_config = parent_rpcs.create_instance_partition if parent_rpcs.respond_to? :create_instance_partition
2890
+ @create_instance_partition = ::Gapic::Config::Method.new create_instance_partition_config
2891
+ delete_instance_partition_config = parent_rpcs.delete_instance_partition if parent_rpcs.respond_to? :delete_instance_partition
2892
+ @delete_instance_partition = ::Gapic::Config::Method.new delete_instance_partition_config
2893
+ update_instance_partition_config = parent_rpcs.update_instance_partition if parent_rpcs.respond_to? :update_instance_partition
2894
+ @update_instance_partition = ::Gapic::Config::Method.new update_instance_partition_config
2895
+ list_instance_partition_operations_config = parent_rpcs.list_instance_partition_operations if parent_rpcs.respond_to? :list_instance_partition_operations
2896
+ @list_instance_partition_operations = ::Gapic::Config::Method.new list_instance_partition_operations_config
2107
2897
 
2108
2898
  yield self if block_given?
2109
2899
  end