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.
@@ -942,7 +942,7 @@ module Google
942
942
  # @param options [::Gapic::CallOptions, ::Hash]
943
943
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
944
944
  #
945
- # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil)
945
+ # @overload list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, instance_deadline: nil)
946
946
  # Pass arguments to `list_instances` via keyword arguments. Note that at
947
947
  # least one keyword argument is required. To specify no parameters, or to keep all
948
948
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -978,11 +978,18 @@ module Google
978
978
  # * `name:howl labels.env:dev` --> The instance's name contains "howl" and
979
979
  # it has the label "env" with its value
980
980
  # containing "dev".
981
+ # @param instance_deadline [::Google::Protobuf::Timestamp, ::Hash]
982
+ # Deadline used while retrieving metadata for instances.
983
+ # Instances whose metadata cannot be retrieved within this deadline will be
984
+ # added to
985
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse#unreachable unreachable}
986
+ # in
987
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse ListInstancesResponse}.
981
988
  # @yield [result, operation] Access the result along with the TransportOperation object
982
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>]
989
+ # @yieldparam result [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse]
983
990
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
984
991
  #
985
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>]
992
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesResponse]
986
993
  #
987
994
  # @raise [::Google::Cloud::Error] if the REST call is aborted.
988
995
  #
@@ -1033,7 +1040,104 @@ module Google
1033
1040
  retry_policy: @config.retry_policy
1034
1041
 
1035
1042
  @instance_admin_stub.list_instances request, options do |result, operation|
1036
- result = ::Gapic::Rest::PagedEnumerable.new @instance_admin_stub, :list_instances, "instances", request, result, options
1043
+ yield result, operation if block_given?
1044
+ return result
1045
+ end
1046
+ rescue ::Gapic::Rest::Error => e
1047
+ raise ::Google::Cloud::Error.from_error(e)
1048
+ end
1049
+
1050
+ ##
1051
+ # Lists all instance partitions for the given instance.
1052
+ #
1053
+ # @overload list_instance_partitions(request, options = nil)
1054
+ # Pass arguments to `list_instance_partitions` via a request object, either of type
1055
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest} or an equivalent Hash.
1056
+ #
1057
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest, ::Hash]
1058
+ # A request object representing the call parameters. Required. To specify no
1059
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1060
+ # @param options [::Gapic::CallOptions, ::Hash]
1061
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1062
+ #
1063
+ # @overload list_instance_partitions(parent: nil, page_size: nil, page_token: nil, instance_partition_deadline: nil)
1064
+ # Pass arguments to `list_instance_partitions` via keyword arguments. Note that at
1065
+ # least one keyword argument is required. To specify no parameters, or to keep all
1066
+ # the default parameter values, pass an empty Hash as a request object (see above).
1067
+ #
1068
+ # @param parent [::String]
1069
+ # Required. The instance whose instance partitions should be listed. Values
1070
+ # are of the form `projects/<project>/instances/<instance>`.
1071
+ # @param page_size [::Integer]
1072
+ # Number of instance partitions to be returned in the response. If 0 or less,
1073
+ # defaults to the server's maximum allowed page size.
1074
+ # @param page_token [::String]
1075
+ # If non-empty, `page_token` should contain a
1076
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse#next_page_token next_page_token}
1077
+ # from a previous
1078
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse ListInstancePartitionsResponse}.
1079
+ # @param instance_partition_deadline [::Google::Protobuf::Timestamp, ::Hash]
1080
+ # Optional. Deadline used while retrieving metadata for instance partitions.
1081
+ # Instance partitions whose metadata cannot be retrieved within this deadline
1082
+ # will be added to
1083
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse#unreachable unreachable}
1084
+ # in
1085
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse ListInstancePartitionsResponse}.
1086
+ # @yield [result, operation] Access the result along with the TransportOperation object
1087
+ # @yieldparam result [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse]
1088
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1089
+ #
1090
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsResponse]
1091
+ #
1092
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1093
+ #
1094
+ # @example Basic example
1095
+ # require "google/cloud/spanner/admin/instance/v1"
1096
+ #
1097
+ # # Create a client object. The client can be reused for multiple calls.
1098
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
1099
+ #
1100
+ # # Create a request. To set request fields, pass in keyword arguments.
1101
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest.new
1102
+ #
1103
+ # # Call the list_instance_partitions method.
1104
+ # result = client.list_instance_partitions request
1105
+ #
1106
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1107
+ # # over elements, and API calls will be issued to fetch pages as needed.
1108
+ # result.each do |item|
1109
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition.
1110
+ # p item
1111
+ # end
1112
+ #
1113
+ def list_instance_partitions request, options = nil
1114
+ raise ::ArgumentError, "request must be provided" if request.nil?
1115
+
1116
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionsRequest
1117
+
1118
+ # Converts hash and nil to an options object
1119
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1120
+
1121
+ # Customize the options with defaults
1122
+ call_metadata = @config.rpcs.list_instance_partitions.metadata.to_h
1123
+
1124
+ # Set x-goog-api-client and x-goog-user-project headers
1125
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1126
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1127
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1128
+ transports_version_send: [:rest]
1129
+
1130
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1131
+
1132
+ options.apply_defaults timeout: @config.rpcs.list_instance_partitions.timeout,
1133
+ metadata: call_metadata,
1134
+ retry_policy: @config.rpcs.list_instance_partitions.retry_policy
1135
+
1136
+ options.apply_defaults timeout: @config.timeout,
1137
+ metadata: @config.metadata,
1138
+ retry_policy: @config.retry_policy
1139
+
1140
+ @instance_admin_stub.list_instance_partitions request, options do |result, operation|
1037
1141
  yield result, operation if block_given?
1038
1142
  return result
1039
1143
  end
@@ -1744,6 +1848,605 @@ module Google
1744
1848
  raise ::Google::Cloud::Error.from_error(e)
1745
1849
  end
1746
1850
 
1851
+ ##
1852
+ # Gets information about a particular instance partition.
1853
+ #
1854
+ # @overload get_instance_partition(request, options = nil)
1855
+ # Pass arguments to `get_instance_partition` via a request object, either of type
1856
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest} or an equivalent Hash.
1857
+ #
1858
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest, ::Hash]
1859
+ # A request object representing the call parameters. Required. To specify no
1860
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1861
+ # @param options [::Gapic::CallOptions, ::Hash]
1862
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1863
+ #
1864
+ # @overload get_instance_partition(name: nil)
1865
+ # Pass arguments to `get_instance_partition` via keyword arguments. Note that at
1866
+ # least one keyword argument is required. To specify no parameters, or to keep all
1867
+ # the default parameter values, pass an empty Hash as a request object (see above).
1868
+ #
1869
+ # @param name [::String]
1870
+ # Required. The name of the requested instance partition. Values are of
1871
+ # the form
1872
+ # `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`.
1873
+ # @yield [result, operation] Access the result along with the TransportOperation object
1874
+ # @yieldparam result [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition]
1875
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1876
+ #
1877
+ # @return [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition]
1878
+ #
1879
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1880
+ #
1881
+ # @example Basic example
1882
+ # require "google/cloud/spanner/admin/instance/v1"
1883
+ #
1884
+ # # Create a client object. The client can be reused for multiple calls.
1885
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
1886
+ #
1887
+ # # Create a request. To set request fields, pass in keyword arguments.
1888
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest.new
1889
+ #
1890
+ # # Call the get_instance_partition method.
1891
+ # result = client.get_instance_partition request
1892
+ #
1893
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition.
1894
+ # p result
1895
+ #
1896
+ def get_instance_partition request, options = nil
1897
+ raise ::ArgumentError, "request must be provided" if request.nil?
1898
+
1899
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstancePartitionRequest
1900
+
1901
+ # Converts hash and nil to an options object
1902
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1903
+
1904
+ # Customize the options with defaults
1905
+ call_metadata = @config.rpcs.get_instance_partition.metadata.to_h
1906
+
1907
+ # Set x-goog-api-client and x-goog-user-project headers
1908
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1909
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1910
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
1911
+ transports_version_send: [:rest]
1912
+
1913
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1914
+
1915
+ options.apply_defaults timeout: @config.rpcs.get_instance_partition.timeout,
1916
+ metadata: call_metadata,
1917
+ retry_policy: @config.rpcs.get_instance_partition.retry_policy
1918
+
1919
+ options.apply_defaults timeout: @config.timeout,
1920
+ metadata: @config.metadata,
1921
+ retry_policy: @config.retry_policy
1922
+
1923
+ @instance_admin_stub.get_instance_partition request, options do |result, operation|
1924
+ yield result, operation if block_given?
1925
+ return result
1926
+ end
1927
+ rescue ::Gapic::Rest::Error => e
1928
+ raise ::Google::Cloud::Error.from_error(e)
1929
+ end
1930
+
1931
+ ##
1932
+ # Creates an instance partition and begins preparing it to be used. The
1933
+ # returned {::Google::Longrunning::Operation long-running operation}
1934
+ # can be used to track the progress of preparing the new instance partition.
1935
+ # The instance partition name is assigned by the caller. If the named
1936
+ # instance partition already exists, `CreateInstancePartition` returns
1937
+ # `ALREADY_EXISTS`.
1938
+ #
1939
+ # Immediately upon completion of this request:
1940
+ #
1941
+ # * The instance partition is readable via the API, with all requested
1942
+ # attributes but no allocated resources. Its state is `CREATING`.
1943
+ #
1944
+ # Until completion of the returned operation:
1945
+ #
1946
+ # * Cancelling the operation renders the instance partition immediately
1947
+ # unreadable via the API.
1948
+ # * The instance partition can be deleted.
1949
+ # * All other attempts to modify the instance partition are rejected.
1950
+ #
1951
+ # Upon completion of the returned operation:
1952
+ #
1953
+ # * Billing for all successfully-allocated resources begins (some types
1954
+ # may have lower than the requested levels).
1955
+ # * Databases can start using this instance partition.
1956
+ # * The instance partition's allocated resource levels are readable via the
1957
+ # API.
1958
+ # * The instance partition's state becomes `READY`.
1959
+ #
1960
+ # The returned {::Google::Longrunning::Operation long-running operation} will
1961
+ # have a name of the format
1962
+ # `<instance_partition_name>/operations/<operation_id>` and can be used to
1963
+ # track creation of the instance partition. The
1964
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
1965
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}.
1966
+ # The {::Google::Longrunning::Operation#response response} field type is
1967
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}, if
1968
+ # successful.
1969
+ #
1970
+ # @overload create_instance_partition(request, options = nil)
1971
+ # Pass arguments to `create_instance_partition` via a request object, either of type
1972
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest} or an equivalent Hash.
1973
+ #
1974
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest, ::Hash]
1975
+ # A request object representing the call parameters. Required. To specify no
1976
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1977
+ # @param options [::Gapic::CallOptions, ::Hash]
1978
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1979
+ #
1980
+ # @overload create_instance_partition(parent: nil, instance_partition_id: nil, instance_partition: nil)
1981
+ # Pass arguments to `create_instance_partition` via keyword arguments. Note that at
1982
+ # least one keyword argument is required. To specify no parameters, or to keep all
1983
+ # the default parameter values, pass an empty Hash as a request object (see above).
1984
+ #
1985
+ # @param parent [::String]
1986
+ # Required. The name of the instance in which to create the instance
1987
+ # partition. Values are of the form
1988
+ # `projects/<project>/instances/<instance>`.
1989
+ # @param instance_partition_id [::String]
1990
+ # Required. The ID of the instance partition to create. Valid identifiers are
1991
+ # of the form `[a-z][-a-z0-9]*[a-z0-9]` and must be between 2 and 64
1992
+ # characters in length.
1993
+ # @param instance_partition [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition, ::Hash]
1994
+ # Required. The instance partition to create. The instance_partition.name may
1995
+ # be omitted, but if specified must be
1996
+ # `<parent>/instancePartitions/<instance_partition_id>`.
1997
+ # @yield [result, operation] Access the result along with the TransportOperation object
1998
+ # @yieldparam result [::Gapic::Operation]
1999
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2000
+ #
2001
+ # @return [::Gapic::Operation]
2002
+ #
2003
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2004
+ #
2005
+ # @example Basic example
2006
+ # require "google/cloud/spanner/admin/instance/v1"
2007
+ #
2008
+ # # Create a client object. The client can be reused for multiple calls.
2009
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
2010
+ #
2011
+ # # Create a request. To set request fields, pass in keyword arguments.
2012
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest.new
2013
+ #
2014
+ # # Call the create_instance_partition method.
2015
+ # result = client.create_instance_partition request
2016
+ #
2017
+ # # The returned object is of type Gapic::Operation. You can use it to
2018
+ # # check the status of an operation, cancel it, or wait for results.
2019
+ # # Here is how to wait for a response.
2020
+ # result.wait_until_done! timeout: 60
2021
+ # if result.response?
2022
+ # p result.response
2023
+ # else
2024
+ # puts "No response received."
2025
+ # end
2026
+ #
2027
+ def create_instance_partition request, options = nil
2028
+ raise ::ArgumentError, "request must be provided" if request.nil?
2029
+
2030
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionRequest
2031
+
2032
+ # Converts hash and nil to an options object
2033
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2034
+
2035
+ # Customize the options with defaults
2036
+ call_metadata = @config.rpcs.create_instance_partition.metadata.to_h
2037
+
2038
+ # Set x-goog-api-client and x-goog-user-project headers
2039
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2040
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2041
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
2042
+ transports_version_send: [:rest]
2043
+
2044
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2045
+
2046
+ options.apply_defaults timeout: @config.rpcs.create_instance_partition.timeout,
2047
+ metadata: call_metadata,
2048
+ retry_policy: @config.rpcs.create_instance_partition.retry_policy
2049
+
2050
+ options.apply_defaults timeout: @config.timeout,
2051
+ metadata: @config.metadata,
2052
+ retry_policy: @config.retry_policy
2053
+
2054
+ @instance_admin_stub.create_instance_partition request, options do |result, operation|
2055
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2056
+ yield result, operation if block_given?
2057
+ return result
2058
+ end
2059
+ rescue ::Gapic::Rest::Error => e
2060
+ raise ::Google::Cloud::Error.from_error(e)
2061
+ end
2062
+
2063
+ ##
2064
+ # Deletes an existing instance partition. Requires that the
2065
+ # instance partition is not used by any database or backup and is not the
2066
+ # default instance partition of an instance.
2067
+ #
2068
+ # Authorization requires `spanner.instancePartitions.delete` permission on
2069
+ # the resource
2070
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition#name name}.
2071
+ #
2072
+ # @overload delete_instance_partition(request, options = nil)
2073
+ # Pass arguments to `delete_instance_partition` via a request object, either of type
2074
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest} or an equivalent Hash.
2075
+ #
2076
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest, ::Hash]
2077
+ # A request object representing the call parameters. Required. To specify no
2078
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2079
+ # @param options [::Gapic::CallOptions, ::Hash]
2080
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2081
+ #
2082
+ # @overload delete_instance_partition(name: nil, etag: nil)
2083
+ # Pass arguments to `delete_instance_partition` via keyword arguments. Note that at
2084
+ # least one keyword argument is required. To specify no parameters, or to keep all
2085
+ # the default parameter values, pass an empty Hash as a request object (see above).
2086
+ #
2087
+ # @param name [::String]
2088
+ # Required. The name of the instance partition to be deleted.
2089
+ # Values are of the form
2090
+ # `projects/{project}/instances/{instance}/instancePartitions/{instance_partition}`
2091
+ # @param etag [::String]
2092
+ # Optional. If not empty, the API only deletes the instance partition when
2093
+ # the etag provided matches the current status of the requested instance
2094
+ # partition. Otherwise, deletes the instance partition without checking the
2095
+ # current status of the requested instance partition.
2096
+ # @yield [result, operation] Access the result along with the TransportOperation object
2097
+ # @yieldparam result [::Google::Protobuf::Empty]
2098
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2099
+ #
2100
+ # @return [::Google::Protobuf::Empty]
2101
+ #
2102
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2103
+ #
2104
+ # @example Basic example
2105
+ # require "google/cloud/spanner/admin/instance/v1"
2106
+ #
2107
+ # # Create a client object. The client can be reused for multiple calls.
2108
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
2109
+ #
2110
+ # # Create a request. To set request fields, pass in keyword arguments.
2111
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest.new
2112
+ #
2113
+ # # Call the delete_instance_partition method.
2114
+ # result = client.delete_instance_partition request
2115
+ #
2116
+ # # The returned object is of type Google::Protobuf::Empty.
2117
+ # p result
2118
+ #
2119
+ def delete_instance_partition request, options = nil
2120
+ raise ::ArgumentError, "request must be provided" if request.nil?
2121
+
2122
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstancePartitionRequest
2123
+
2124
+ # Converts hash and nil to an options object
2125
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2126
+
2127
+ # Customize the options with defaults
2128
+ call_metadata = @config.rpcs.delete_instance_partition.metadata.to_h
2129
+
2130
+ # Set x-goog-api-client and x-goog-user-project headers
2131
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2132
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2133
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
2134
+ transports_version_send: [:rest]
2135
+
2136
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2137
+
2138
+ options.apply_defaults timeout: @config.rpcs.delete_instance_partition.timeout,
2139
+ metadata: call_metadata,
2140
+ retry_policy: @config.rpcs.delete_instance_partition.retry_policy
2141
+
2142
+ options.apply_defaults timeout: @config.timeout,
2143
+ metadata: @config.metadata,
2144
+ retry_policy: @config.retry_policy
2145
+
2146
+ @instance_admin_stub.delete_instance_partition request, options do |result, operation|
2147
+ yield result, operation if block_given?
2148
+ return result
2149
+ end
2150
+ rescue ::Gapic::Rest::Error => e
2151
+ raise ::Google::Cloud::Error.from_error(e)
2152
+ end
2153
+
2154
+ ##
2155
+ # Updates an instance partition, and begins allocating or releasing resources
2156
+ # as requested. The returned [long-running
2157
+ # operation][google.longrunning.Operation] can be used to track the
2158
+ # progress of updating the instance partition. If the named instance
2159
+ # partition does not exist, returns `NOT_FOUND`.
2160
+ #
2161
+ # Immediately upon completion of this request:
2162
+ #
2163
+ # * For resource types for which a decrease in the instance partition's
2164
+ # allocation has been requested, billing is based on the newly-requested
2165
+ # level.
2166
+ #
2167
+ # Until completion of the returned operation:
2168
+ #
2169
+ # * Cancelling the operation sets its metadata's
2170
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionMetadata#cancel_time cancel_time},
2171
+ # and begins restoring resources to their pre-request values. The
2172
+ # operation is guaranteed to succeed at undoing all resource changes,
2173
+ # after which point it terminates with a `CANCELLED` status.
2174
+ # * All other attempts to modify the instance partition are rejected.
2175
+ # * Reading the instance partition via the API continues to give the
2176
+ # pre-request resource levels.
2177
+ #
2178
+ # Upon completion of the returned operation:
2179
+ #
2180
+ # * Billing begins for all successfully-allocated resources (some types
2181
+ # may have lower than the requested levels).
2182
+ # * All newly-reserved resources are available for serving the instance
2183
+ # partition's tables.
2184
+ # * The instance partition's new resource levels are readable via the API.
2185
+ #
2186
+ # The returned {::Google::Longrunning::Operation long-running operation} will
2187
+ # have a name of the format
2188
+ # `<instance_partition_name>/operations/<operation_id>` and can be used to
2189
+ # track the instance partition modification. The
2190
+ # {::Google::Longrunning::Operation#metadata metadata} field type is
2191
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionMetadata UpdateInstancePartitionMetadata}.
2192
+ # The {::Google::Longrunning::Operation#response response} field type is
2193
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}, if
2194
+ # successful.
2195
+ #
2196
+ # Authorization requires `spanner.instancePartitions.update` permission on
2197
+ # the resource
2198
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition#name name}.
2199
+ #
2200
+ # @overload update_instance_partition(request, options = nil)
2201
+ # Pass arguments to `update_instance_partition` via a request object, either of type
2202
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest} or an equivalent Hash.
2203
+ #
2204
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest, ::Hash]
2205
+ # A request object representing the call parameters. Required. To specify no
2206
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2207
+ # @param options [::Gapic::CallOptions, ::Hash]
2208
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2209
+ #
2210
+ # @overload update_instance_partition(instance_partition: nil, field_mask: nil)
2211
+ # Pass arguments to `update_instance_partition` via keyword arguments. Note that at
2212
+ # least one keyword argument is required. To specify no parameters, or to keep all
2213
+ # the default parameter values, pass an empty Hash as a request object (see above).
2214
+ #
2215
+ # @param instance_partition [::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition, ::Hash]
2216
+ # Required. The instance partition to update, which must always include the
2217
+ # instance partition name. Otherwise, only fields mentioned in
2218
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest#field_mask field_mask}
2219
+ # need be included.
2220
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
2221
+ # Required. A mask specifying which fields in
2222
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}
2223
+ # should be updated. The field mask must always be specified; this prevents
2224
+ # any future fields in
2225
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::InstancePartition InstancePartition}
2226
+ # from being erased accidentally by clients that do not know about them.
2227
+ # @yield [result, operation] Access the result along with the TransportOperation object
2228
+ # @yieldparam result [::Gapic::Operation]
2229
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2230
+ #
2231
+ # @return [::Gapic::Operation]
2232
+ #
2233
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2234
+ #
2235
+ # @example Basic example
2236
+ # require "google/cloud/spanner/admin/instance/v1"
2237
+ #
2238
+ # # Create a client object. The client can be reused for multiple calls.
2239
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
2240
+ #
2241
+ # # Create a request. To set request fields, pass in keyword arguments.
2242
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest.new
2243
+ #
2244
+ # # Call the update_instance_partition method.
2245
+ # result = client.update_instance_partition request
2246
+ #
2247
+ # # The returned object is of type Gapic::Operation. You can use it to
2248
+ # # check the status of an operation, cancel it, or wait for results.
2249
+ # # Here is how to wait for a response.
2250
+ # result.wait_until_done! timeout: 60
2251
+ # if result.response?
2252
+ # p result.response
2253
+ # else
2254
+ # puts "No response received."
2255
+ # end
2256
+ #
2257
+ def update_instance_partition request, options = nil
2258
+ raise ::ArgumentError, "request must be provided" if request.nil?
2259
+
2260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstancePartitionRequest
2261
+
2262
+ # Converts hash and nil to an options object
2263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2264
+
2265
+ # Customize the options with defaults
2266
+ call_metadata = @config.rpcs.update_instance_partition.metadata.to_h
2267
+
2268
+ # Set x-goog-api-client and x-goog-user-project headers
2269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2271
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
2272
+ transports_version_send: [:rest]
2273
+
2274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2275
+
2276
+ options.apply_defaults timeout: @config.rpcs.update_instance_partition.timeout,
2277
+ metadata: call_metadata,
2278
+ retry_policy: @config.rpcs.update_instance_partition.retry_policy
2279
+
2280
+ options.apply_defaults timeout: @config.timeout,
2281
+ metadata: @config.metadata,
2282
+ retry_policy: @config.retry_policy
2283
+
2284
+ @instance_admin_stub.update_instance_partition request, options do |result, operation|
2285
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2286
+ yield result, operation if block_given?
2287
+ return result
2288
+ end
2289
+ rescue ::Gapic::Rest::Error => e
2290
+ raise ::Google::Cloud::Error.from_error(e)
2291
+ end
2292
+
2293
+ ##
2294
+ # Lists instance partition [long-running
2295
+ # operations][google.longrunning.Operation] in the given instance.
2296
+ # An instance partition operation has a name of the form
2297
+ # `projects/<project>/instances/<instance>/instancePartitions/<instance_partition>/operations/<operation>`.
2298
+ # The long-running operation
2299
+ # {::Google::Longrunning::Operation#metadata metadata} field type
2300
+ # `metadata.type_url` describes the type of the metadata. Operations returned
2301
+ # include those that have completed/failed/canceled within the last 7 days,
2302
+ # and pending operations. Operations returned are ordered by
2303
+ # `operation.metadata.value.start_time` in descending order starting from the
2304
+ # most recently started operation.
2305
+ #
2306
+ # Authorization requires `spanner.instancePartitionOperations.list`
2307
+ # permission on the resource
2308
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest#parent parent}.
2309
+ #
2310
+ # @overload list_instance_partition_operations(request, options = nil)
2311
+ # Pass arguments to `list_instance_partition_operations` via a request object, either of type
2312
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest} or an equivalent Hash.
2313
+ #
2314
+ # @param request [::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest, ::Hash]
2315
+ # A request object representing the call parameters. Required. To specify no
2316
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
2317
+ # @param options [::Gapic::CallOptions, ::Hash]
2318
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
2319
+ #
2320
+ # @overload list_instance_partition_operations(parent: nil, filter: nil, page_size: nil, page_token: nil, instance_partition_deadline: nil)
2321
+ # Pass arguments to `list_instance_partition_operations` via keyword arguments. Note that at
2322
+ # least one keyword argument is required. To specify no parameters, or to keep all
2323
+ # the default parameter values, pass an empty Hash as a request object (see above).
2324
+ #
2325
+ # @param parent [::String]
2326
+ # Required. The parent instance of the instance partition operations.
2327
+ # Values are of the form `projects/<project>/instances/<instance>`.
2328
+ # @param filter [::String]
2329
+ # Optional. An expression that filters the list of returned operations.
2330
+ #
2331
+ # A filter expression consists of a field name, a
2332
+ # comparison operator, and a value for filtering.
2333
+ # The value must be a string, a number, or a boolean. The comparison operator
2334
+ # must be one of: `<`, `>`, `<=`, `>=`, `!=`, `=`, or `:`.
2335
+ # Colon `:` is the contains operator. Filter rules are not case sensitive.
2336
+ #
2337
+ # The following fields in the {::Google::Longrunning::Operation Operation}
2338
+ # are eligible for filtering:
2339
+ #
2340
+ # * `name` - The name of the long-running operation
2341
+ # * `done` - False if the operation is in progress, else true.
2342
+ # * `metadata.@type` - the type of metadata. For example, the type string
2343
+ # for
2344
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}
2345
+ # is
2346
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata`.
2347
+ # * `metadata.<field_name>` - any field in metadata.value.
2348
+ # `metadata.@type` must be specified first, if filtering on metadata
2349
+ # fields.
2350
+ # * `error` - Error associated with the long-running operation.
2351
+ # * `response.@type` - the type of response.
2352
+ # * `response.<field_name>` - any field in response.value.
2353
+ #
2354
+ # You can combine multiple expressions by enclosing each expression in
2355
+ # parentheses. By default, expressions are combined with AND logic. However,
2356
+ # you can specify AND, OR, and NOT logic explicitly.
2357
+ #
2358
+ # Here are a few examples:
2359
+ #
2360
+ # * `done:true` - The operation is complete.
2361
+ # * `(metadata.@type=` \
2362
+ # `type.googleapis.com/google.spanner.admin.instance.v1.CreateInstancePartitionMetadata)
2363
+ # AND` \
2364
+ # `(metadata.instance_partition.name:custom-instance-partition) AND` \
2365
+ # `(metadata.start_time < \"2021-03-28T14:50:00Z\") AND` \
2366
+ # `(error:*)` - Return operations where:
2367
+ # * The operation's metadata type is
2368
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstancePartitionMetadata CreateInstancePartitionMetadata}.
2369
+ # * The instance partition name contains "custom-instance-partition".
2370
+ # * The operation started before 2021-03-28T14:50:00Z.
2371
+ # * The operation resulted in an error.
2372
+ # @param page_size [::Integer]
2373
+ # Optional. Number of operations to be returned in the response. If 0 or
2374
+ # less, defaults to the server's maximum allowed page size.
2375
+ # @param page_token [::String]
2376
+ # Optional. If non-empty, `page_token` should contain a
2377
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse#next_page_token next_page_token}
2378
+ # from a previous
2379
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse ListInstancePartitionOperationsResponse}
2380
+ # to the same `parent` and with the same `filter`.
2381
+ # @param instance_partition_deadline [::Google::Protobuf::Timestamp, ::Hash]
2382
+ # Optional. Deadline used while retrieving metadata for instance partition
2383
+ # operations. Instance partitions whose operation metadata cannot be
2384
+ # retrieved within this deadline will be added to
2385
+ # [unreachable][ListInstancePartitionOperationsResponse.unreachable] in
2386
+ # {::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsResponse ListInstancePartitionOperationsResponse}.
2387
+ # @yield [result, operation] Access the result along with the TransportOperation object
2388
+ # @yieldparam result [::Gapic::Operation]
2389
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
2390
+ #
2391
+ # @return [::Gapic::Operation]
2392
+ #
2393
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
2394
+ #
2395
+ # @example Basic example
2396
+ # require "google/cloud/spanner/admin/instance/v1"
2397
+ #
2398
+ # # Create a client object. The client can be reused for multiple calls.
2399
+ # client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Rest::Client.new
2400
+ #
2401
+ # # Create a request. To set request fields, pass in keyword arguments.
2402
+ # request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest.new
2403
+ #
2404
+ # # Call the list_instance_partition_operations method.
2405
+ # result = client.list_instance_partition_operations request
2406
+ #
2407
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
2408
+ # # over elements, and API calls will be issued to fetch pages as needed.
2409
+ # result.each do |item|
2410
+ # # Each element is of type ::Google::Longrunning::Operation.
2411
+ # p item
2412
+ # end
2413
+ #
2414
+ def list_instance_partition_operations request, options = nil
2415
+ raise ::ArgumentError, "request must be provided" if request.nil?
2416
+
2417
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancePartitionOperationsRequest
2418
+
2419
+ # Converts hash and nil to an options object
2420
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
2421
+
2422
+ # Customize the options with defaults
2423
+ call_metadata = @config.rpcs.list_instance_partition_operations.metadata.to_h
2424
+
2425
+ # Set x-goog-api-client and x-goog-user-project headers
2426
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2427
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
2428
+ gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
2429
+ transports_version_send: [:rest]
2430
+
2431
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2432
+
2433
+ options.apply_defaults timeout: @config.rpcs.list_instance_partition_operations.timeout,
2434
+ metadata: call_metadata,
2435
+ retry_policy: @config.rpcs.list_instance_partition_operations.retry_policy
2436
+
2437
+ options.apply_defaults timeout: @config.timeout,
2438
+ metadata: @config.metadata,
2439
+ retry_policy: @config.retry_policy
2440
+
2441
+ @instance_admin_stub.list_instance_partition_operations request, options do |result, operation|
2442
+ result = ::Gapic::Operation.new result, @operations_client, options: options
2443
+ yield result, operation if block_given?
2444
+ return result
2445
+ end
2446
+ rescue ::Gapic::Rest::Error => e
2447
+ raise ::Google::Cloud::Error.from_error(e)
2448
+ end
2449
+
1747
2450
  ##
1748
2451
  # Configuration class for the InstanceAdmin REST API.
1749
2452
  #
@@ -1913,6 +2616,11 @@ module Google
1913
2616
  #
1914
2617
  attr_reader :list_instances
1915
2618
  ##
2619
+ # RPC-specific configuration for `list_instance_partitions`
2620
+ # @return [::Gapic::Config::Method]
2621
+ #
2622
+ attr_reader :list_instance_partitions
2623
+ ##
1916
2624
  # RPC-specific configuration for `get_instance`
1917
2625
  # @return [::Gapic::Config::Method]
1918
2626
  #
@@ -1947,6 +2655,31 @@ module Google
1947
2655
  # @return [::Gapic::Config::Method]
1948
2656
  #
1949
2657
  attr_reader :test_iam_permissions
2658
+ ##
2659
+ # RPC-specific configuration for `get_instance_partition`
2660
+ # @return [::Gapic::Config::Method]
2661
+ #
2662
+ attr_reader :get_instance_partition
2663
+ ##
2664
+ # RPC-specific configuration for `create_instance_partition`
2665
+ # @return [::Gapic::Config::Method]
2666
+ #
2667
+ attr_reader :create_instance_partition
2668
+ ##
2669
+ # RPC-specific configuration for `delete_instance_partition`
2670
+ # @return [::Gapic::Config::Method]
2671
+ #
2672
+ attr_reader :delete_instance_partition
2673
+ ##
2674
+ # RPC-specific configuration for `update_instance_partition`
2675
+ # @return [::Gapic::Config::Method]
2676
+ #
2677
+ attr_reader :update_instance_partition
2678
+ ##
2679
+ # RPC-specific configuration for `list_instance_partition_operations`
2680
+ # @return [::Gapic::Config::Method]
2681
+ #
2682
+ attr_reader :list_instance_partition_operations
1950
2683
 
1951
2684
  # @private
1952
2685
  def initialize parent_rpcs = nil
@@ -1964,6 +2697,8 @@ module Google
1964
2697
  @list_instance_config_operations = ::Gapic::Config::Method.new list_instance_config_operations_config
1965
2698
  list_instances_config = parent_rpcs.list_instances if parent_rpcs.respond_to? :list_instances
1966
2699
  @list_instances = ::Gapic::Config::Method.new list_instances_config
2700
+ list_instance_partitions_config = parent_rpcs.list_instance_partitions if parent_rpcs.respond_to? :list_instance_partitions
2701
+ @list_instance_partitions = ::Gapic::Config::Method.new list_instance_partitions_config
1967
2702
  get_instance_config = parent_rpcs.get_instance if parent_rpcs.respond_to? :get_instance
1968
2703
  @get_instance = ::Gapic::Config::Method.new get_instance_config
1969
2704
  create_instance_config = parent_rpcs.create_instance if parent_rpcs.respond_to? :create_instance
@@ -1978,6 +2713,16 @@ module Google
1978
2713
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
1979
2714
  test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
1980
2715
  @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
2716
+ get_instance_partition_config = parent_rpcs.get_instance_partition if parent_rpcs.respond_to? :get_instance_partition
2717
+ @get_instance_partition = ::Gapic::Config::Method.new get_instance_partition_config
2718
+ create_instance_partition_config = parent_rpcs.create_instance_partition if parent_rpcs.respond_to? :create_instance_partition
2719
+ @create_instance_partition = ::Gapic::Config::Method.new create_instance_partition_config
2720
+ delete_instance_partition_config = parent_rpcs.delete_instance_partition if parent_rpcs.respond_to? :delete_instance_partition
2721
+ @delete_instance_partition = ::Gapic::Config::Method.new delete_instance_partition_config
2722
+ update_instance_partition_config = parent_rpcs.update_instance_partition if parent_rpcs.respond_to? :update_instance_partition
2723
+ @update_instance_partition = ::Gapic::Config::Method.new update_instance_partition_config
2724
+ list_instance_partition_operations_config = parent_rpcs.list_instance_partition_operations if parent_rpcs.respond_to? :list_instance_partition_operations
2725
+ @list_instance_partition_operations = ::Gapic::Config::Method.new list_instance_partition_operations_config
1981
2726
 
1982
2727
  yield self if block_given?
1983
2728
  end