Class: Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb

Overview

Client for the InstanceAdmin service.

Cloud Spanner Instance Admin API

The Cloud Spanner Instance Admin API can be used to create, delete, modify and list instances. Instances are dedicated Cloud Spanner serving and storage resources to be used by Cloud Spanner databases.

Each instance has a "configuration", which dictates where the serving resources for the Cloud Spanner instance are located (e.g., US-central, Europe). Configurations are created by Google based on resource availability.

Cloud Spanner billing is based on the instances that exist and their sizes. After an instance exists, there are no additional per-database or per-operation charges for use of the instance (though there may be additional network bandwidth charges). Instances offer isolation: problems with databases in one instance will not affect other instances. However, within an instance databases can affect each other. For example, if one database in an instance receives a lot of requests and consumes most of the instance resources, fewer resources are available for other databases in that instance, and their performance may suffer.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#instance_config_path, #instance_path, #project_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new InstanceAdmin client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the InstanceAdmin client.

Yield Parameters:



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 181

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/spanner/admin/instance/v1/spanner_instance_admin_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @instance_admin_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool
  )
end

Instance Attribute Details

#operations_client::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Operations (readonly)

Get the associated client for long-running operations.



233
234
235
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 233

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the InstanceAdmin Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all InstanceAdmin clients
::Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 81

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Spanner", "Admin", "Instance", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.list_instance_configs.timeout = 3600.0
    default_config.rpcs.list_instance_configs.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.get_instance_config.timeout = 3600.0
    default_config.rpcs.get_instance_config.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.list_instances.timeout = 3600.0
    default_config.rpcs.list_instances.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.get_instance.timeout = 3600.0
    default_config.rpcs.get_instance.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.create_instance.timeout = 3600.0

    default_config.rpcs.update_instance.timeout = 3600.0

    default_config.rpcs.delete_instance.timeout = 3600.0
    default_config.rpcs.delete_instance.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.set_iam_policy.timeout = 30.0

    default_config.rpcs.get_iam_policy.timeout = 30.0
    default_config.rpcs.get_iam_policy.retry_policy = {
      initial_delay: 1.0, max_delay: 32.0, multiplier: 1.3, retry_codes: [14, 4]
    }

    default_config.rpcs.test_iam_permissions.timeout = 30.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#configure {|config| ... } ⇒ Client::Configuration

Configure the InstanceAdmin Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



151
152
153
154
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 151

def configure
  yield @config if block_given?
  @config
end

#create_instance(request, options = nil) ⇒ ::Gapic::Operation #create_instance(parent: nil, instance_id: nil, instance: nil) ⇒ ::Gapic::Operation

Creates an instance and begins preparing it to begin serving. The returned long-running operation can be used to track the progress of preparing the new instance. The instance name is assigned by the caller. If the named instance already exists, CreateInstance returns ALREADY_EXISTS.

Immediately upon completion of this request:

  • The instance is readable via the API, with all requested attributes but no allocated resources. Its state is CREATING.

Until completion of the returned operation:

  • Cancelling the operation renders the instance immediately unreadable via the API.
  • The instance can be deleted.
  • All other attempts to modify the instance are rejected.

Upon completion of the returned operation:

  • Billing for all successfully-allocated resources begins (some types may have lower than the requested levels).
  • Databases can be created in the instance.
  • The instance's allocated resource levels are readable via the API.
  • The instance's state becomes READY.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track creation of the instance. The metadata field type is CreateInstanceMetadata. The response field type is Instance, if successful.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest.new

# Call the create_instance method.
result = client.create_instance request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #create_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance via a request object, either of type CreateInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_instance(parent: nil, instance_id: nil, instance: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the project in which to create the instance. Values are of the form projects/<project>.

    • instance_id (::String) (defaults to: nil)

      Required. The ID of the instance to create. Valid identifiers are of the form [a-z][-a-z0-9]*[a-z0-9] and must be between 2 and 64 characters in length.

    • instance (::Google::Cloud::Spanner::Admin::Instance::V1::Instance, ::Hash) (defaults to: nil)

      Required. The instance to create. The name may be omitted, but if specified must be <parent>/instances/<instance_id>.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1284

def create_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :create_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_instance_config(request, options = nil) ⇒ ::Gapic::Operation #create_instance_config(parent: nil, instance_config_id: nil, instance_config: nil, validate_only: nil) ⇒ ::Gapic::Operation

Creates an instance config and begins preparing it to be used. The returned long-running operation can be used to track the progress of preparing the new instance config. The instance config name is assigned by the caller. If the named instance config already exists, CreateInstanceConfig returns ALREADY_EXISTS.

Immediately after the request returns:

  • The instance config is readable via the API, with all requested attributes. The instance config's reconciling field is set to true. Its state is CREATING.

While the operation is pending:

  • Cancelling the operation renders the instance config immediately unreadable via the API.
  • Except for deleting the creating resource, all other attempts to modify the instance config are rejected.

Upon completion of the returned operation:

  • Instances can be created using the instance configuration.
  • The instance config's reconciling field becomes false. Its state becomes READY.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track creation of the instance config. The metadata field type is CreateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.create permission on the resource parent.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest.new

# Call the create_instance_config method.
result = client.create_instance_config request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #create_instance_config(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance_config via a request object, either of type CreateInstanceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_instance_config(parent: nil, instance_config_id: nil, instance_config: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the project in which to create the instance config. Values are of the form projects/<project>.

    • instance_config_id (::String) (defaults to: nil)

      Required. The ID of the instance config to create. Valid identifiers are of the form custom-[-a-z0-9]*[a-z0-9] and must be between 2 and 64 characters in length. The custom- prefix is required to avoid name conflicts with Google managed configurations.

    • instance_config (::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig, ::Hash) (defaults to: nil)

      Required. The InstanceConfig proto of the configuration to create. instance_config.name must be <parent>/instanceConfigs/<instance_config_id>. instance_config.base_config must be a Google managed configuration name, e.g. /instanceConfigs/us-east1, /instanceConfigs/nam3.

    • validate_only (::Boolean) (defaults to: nil)

      An option to validate, but not actually execute, a request, and provide the same response.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 529

def create_instance_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::CreateInstanceConfigRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_instance_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_instance_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_instance_config.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :create_instance_config, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_instance(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_instance(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an instance.

Immediately upon completion of the request:

  • Billing ceases for all of the instance's reserved resources.

Soon afterward:

  • The instance and all of its databases immediately and irrevocably disappear from the API. All data in the databases is permanently deleted.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest.new

# Call the delete_instance method.
result = client.delete_instance request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_instance(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_instance via a request object, either of type DeleteInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_instance(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_instance via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the instance to be deleted. Values are of the form projects/<project>/instances/<instance>

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1522

def delete_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :delete_instance, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_instance_config(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_instance_config(name: nil, etag: nil, validate_only: nil) ⇒ ::Google::Protobuf::Empty

Deletes the instance config. Deletion is only allowed when no instances are using the configuration. If any instances are using the config, returns FAILED_PRECONDITION.

Only user managed configurations can be deleted.

Authorization requires spanner.instanceConfigs.delete permission on the resource name.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest.new

# Call the delete_instance_config method.
result = client.delete_instance_config request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_instance_config(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_instance_config via a request object, either of type DeleteInstanceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_instance_config(name: nil, etag: nil, validate_only: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_instance_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the instance configuration to be deleted. Values are of the form projects/<project>/instanceConfigs/<instance_config>

    • etag (::String) (defaults to: nil)

      Used for optimistic concurrency control as a way to help prevent simultaneous deletes of an instance config from overwriting each other. If not empty, the API only deletes the instance config when the etag provided matches the current status of the requested instance config. Otherwise, deletes the instance config without checking the current status of the requested instance config.

    • validate_only (::Boolean) (defaults to: nil)

      An option to validate, but not actually execute, a request, and provide the same response.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 786

def delete_instance_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::DeleteInstanceConfigRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_instance_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_instance_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_instance_config.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :delete_instance_config, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy

Gets the access control policy for an instance resource. Returns an empty policy if an instance exists but does not have a policy set.

Authorization requires spanner.instances.getIamPolicy on resource.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

Overloads:

  • #get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::GetIamPolicyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to get_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

    • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) (defaults to: nil)

      OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1716

def get_iam_policy request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::GetIamPolicyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_iam_policy..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_iam_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_iam_policy.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_instance(request, options = nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::Instance #get_instance(name: nil, field_mask: nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::Instance

Gets information about a particular instance.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest.new

# Call the get_instance method.
result = client.get_instance request

# The returned object is of type Google::Cloud::Spanner::Admin::Instance::V1::Instance.
p result

Overloads:

  • #get_instance(request, options = nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::Instance

    Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_instance(name: nil, field_mask: nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::Instance

    Pass arguments to get_instance via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the requested instance. Values are of the form projects/<project>/instances/<instance>.

    • field_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      If field_mask is present, specifies the subset of Instance fields that should be returned. If absent, all Instance fields are returned.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1151

def get_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :get_instance, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_instance_config(request, options = nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig #get_instance_config(name: nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig

Gets information about a particular instance configuration.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest.new

# Call the get_instance_config method.
result = client.get_instance_config request

# The returned object is of type Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig.
p result

Overloads:

  • #get_instance_config(request, options = nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig

    Pass arguments to get_instance_config via a request object, either of type GetInstanceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_instance_config(name: nil) ⇒ ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig

    Pass arguments to get_instance_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the requested instance configuration. Values are of the form projects/<project>/instanceConfigs/<config>.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 382

def get_instance_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::GetInstanceConfigRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_instance_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_instance_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instance_config.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :get_instance_config, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_instance_config_operations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation> #list_instance_config_operations(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

Lists the user-managed instance config [long-running operations][google.longrunning.Operation] in the given project. An instance config operation has a name of the form projects/<project>/instanceConfigs/<instance_config>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.start_time in descending order starting from the most recently started operation.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsRequest.new

# Call the list_instance_config_operations method.
result = client.list_instance_config_operations request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Longrunning::Operation.
  p item
end

Overloads:

  • #list_instance_config_operations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

    Pass arguments to list_instance_config_operations via a request object, either of type ListInstanceConfigOperationsRequest or an equivalent Hash.

    Parameters:

  • #list_instance_config_operations(parent: nil, filter: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Gapic::Operation>

    Pass arguments to list_instance_config_operations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The project of the instance config operations. Values are of the form projects/<project>.

    • filter (::String) (defaults to: nil)

      An expression that filters the list of returned operations.

      A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string, a number, or a boolean. The comparison operator must be one of: <, >, <=, >=, !=, =, or :. Colon : is the contains operator. Filter rules are not case sensitive.

      The following fields in the Operation are eligible for filtering:

      • name - The name of the long-running operation
      • done - False if the operation is in progress, else true.
      • metadata.@type - the type of metadata. For example, the type string for CreateInstanceConfigMetadata is type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata.
      • metadata.<field_name> - any field in metadata.value. metadata.@type must be specified first, if filtering on metadata fields.
      • error - Error associated with the long-running operation.
      • response.@type - the type of response.
      • response.<field_name> - any field in response.value.

      You can combine multiple expressions by enclosing each expression in parentheses. By default, expressions are combined with AND logic. However, you can specify AND, OR, and NOT logic explicitly.

      Here are a few examples:

      • done:true - The operation is complete.
      • (metadata.@type= \ type.googleapis.com/google.spanner.admin.instance.v1.CreateInstanceConfigMetadata) AND \ (metadata.instance_config.name:custom-config) AND \ (metadata.progress.start_time < \"2021-03-28T14:50:00Z\") AND \ (error:*) - Return operations where:
        • The operation's metadata type is CreateInstanceConfigMetadata.
        • The instance config name contains "custom-config".
        • The operation started before 2021-03-28T14:50:00Z.
        • The operation resulted in an error.
    • page_size (::Integer) (defaults to: nil)

      Number of operations to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size.

    • page_token (::String) (defaults to: nil)

      If non-empty, page_token should contain a next_page_token from a previous ListInstanceConfigOperationsResponse to the same parent and with the same filter.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::PagedEnumerable<::Gapic::Operation>)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::PagedEnumerable<::Gapic::Operation>)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 939

def list_instance_config_operations request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigOperationsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_instance_config_operations..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_instance_config_operations.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instance_config_operations.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :list_instance_config_operations, request, options: options do |response, operation|
    wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
    response = ::Gapic::PagedEnumerable.new @instance_admin_stub, :list_instance_config_operations, request, response, operation, options, format_resource: wrap_lro_operation
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_instance_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig> #list_instance_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig>

Lists the supported instance configurations for a given project.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest.new

# Call the list_instance_configs method.
result = client.list_instance_configs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig.
  p item
end

Overloads:

  • #list_instance_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig>

    Pass arguments to list_instance_configs via a request object, either of type ListInstanceConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_instance_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig>

    Pass arguments to list_instance_configs via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the project for which a list of supported instance configurations is requested. Values are of the form projects/<project>.

    • page_size (::Integer) (defaults to: nil)

      Number of instance configurations to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size.

    • page_token (::String) (defaults to: nil)

      If non-empty, page_token should contain a next_page_token from a previous ListInstanceConfigsResponse.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 295

def list_instance_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstanceConfigsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_instance_configs..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_instance_configs.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instance_configs.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :list_instance_configs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @instance_admin_stub, :list_instance_configs, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_instances(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance> #list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>

Lists all instances in the given project.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest.new

# Call the list_instances method.
result = client.list_instances request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Spanner::Admin::Instance::V1::Instance.
  p item
end

Overloads:

  • #list_instances(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>

    Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Spanner::Admin::Instance::V1::Instance>

    Pass arguments to list_instances via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the project for which a list of instances is requested. Values are of the form projects/<project>.

    • page_size (::Integer) (defaults to: nil)

      Number of instances to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size.

    • page_token (::String) (defaults to: nil)

      If non-empty, page_token should contain a next_page_token from a previous ListInstancesResponse.

    • filter (::String) (defaults to: nil)

      An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are:

      • name
      • display_name
      • labels.key where key is the name of a label

      Some examples of using filters are:

      • name:* --> The instance has a name.
      • name:Howl --> The instance's name contains the string "howl".
      • name:HOWL --> Equivalent to above.
      • NAME:howl --> Equivalent to above.
      • labels.env:* --> The instance has the label "env".
      • labels.env:dev --> The instance has the label "env" and the value of the label contains the string "dev".
      • name:howl labels.env:dev --> The instance's name contains "howl" and it has the label "env" with its value containing "dev".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1059

def list_instances request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::ListInstancesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_instances..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_instances.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instances.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :list_instances, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @instance_admin_stub, :list_instances, request, response, operation, options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #set_iam_policy(resource: nil, policy: nil, update_mask: nil) ⇒ ::Google::Iam::V1::Policy

Sets the access control policy on an instance resource. Replaces any existing policy.

Authorization requires spanner.instances.setIamPolicy on resource.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

Overloads:

  • #set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::SetIamPolicyRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #set_iam_policy(resource: nil, policy: nil, update_mask: nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to set_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

    • policy (::Google::Iam::V1::Policy, ::Hash) (defaults to: nil)

      REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

      paths: "bindings, etag"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1623

def set_iam_policy request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::SetIamPolicyRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.set_iam_policy..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.set_iam_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.set_iam_policy.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

Returns permissions that the caller has on the specified instance resource.

Attempting this RPC on a non-existent Cloud Spanner instance resource will result in a NOT_FOUND error if the user has spanner.instances.list permission on the containing Google Cloud Project. Otherwise returns an empty set of permissions.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result

Overloads:

  • #test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

    Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::TestIamPermissionsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

    Pass arguments to test_iam_permissions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

    • permissions (::Array<::String>) (defaults to: nil)

      The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1812

def test_iam_permissions request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V1::TestIamPermissionsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.test_iam_permissions..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.test_iam_permissions.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.test_iam_permissions.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


161
162
163
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 161

def universe_domain
  @instance_admin_stub.universe_domain
end

#update_instance(request, options = nil) ⇒ ::Gapic::Operation #update_instance(instance: nil, field_mask: nil) ⇒ ::Gapic::Operation

Updates an instance, and begins allocating or releasing resources as requested. The returned [long-running operation][google.longrunning.Operation] can be used to track the progress of updating the instance. If the named instance does not exist, returns NOT_FOUND.

Immediately upon completion of this request:

  • For resource types for which a decrease in the instance's allocation has been requested, billing is based on the newly-requested level.

Until completion of the returned operation:

  • Cancelling the operation sets its metadata's cancel_time, and begins restoring resources to their pre-request values. The operation is guaranteed to succeed at undoing all resource changes, after which point it terminates with a CANCELLED status.
  • All other attempts to modify the instance are rejected.
  • Reading the instance via the API continues to give the pre-request resource levels.

Upon completion of the returned operation:

  • Billing begins for all successfully-allocated resources (some types may have lower than the requested levels).
  • All newly-reserved resources are available for serving the instance's tables.
  • The instance's new resource levels are readable via the API.

The returned long-running operation will have a name of the format <instance_name>/operations/<operation_id> and can be used to track the instance modification. The metadata field type is UpdateInstanceMetadata. The response field type is Instance, if successful.

Authorization requires spanner.instances.update permission on the resource name.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest.new

# Call the update_instance method.
result = client.update_instance request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #update_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_instance via a request object, either of type UpdateInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_instance(instance: nil, field_mask: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_instance via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 1425

def update_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.instance&.name
    header_params["instance.name"] = request.instance.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :update_instance, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_instance_config(request, options = nil) ⇒ ::Gapic::Operation #update_instance_config(instance_config: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

Updates an instance config. The returned long-running operation can be used to track the progress of updating the instance. If the named instance config does not exist, returns NOT_FOUND.

Only user managed configurations can be updated.

Immediately after the request returns:

  • The instance config's reconciling field is set to true.

While the operation is pending:

  • Cancelling the operation sets its metadata's cancel_time. The operation is guaranteed to succeed at undoing all changes, after which point it terminates with a CANCELLED status.
  • All other attempts to modify the instance config are rejected.
  • Reading the instance config via the API continues to give the pre-request values.

Upon completion of the returned operation:

  • Creating instances using the instance configuration uses the new values.
  • The instance config's new values are readable via the API.
  • The instance config's reconciling field becomes false.

The returned long-running operation will have a name of the format <instance_config_name>/operations/<operation_id> and can be used to track the instance config modification. The metadata field type is UpdateInstanceConfigMetadata. The response field type is InstanceConfig, if successful.

Authorization requires spanner.instanceConfigs.update permission on the resource name.

Examples:

Basic example

require "google/cloud/spanner/admin/instance/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Spanner::Admin::Instance::V1::InstanceAdmin::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest.new

# Call the update_instance_config method.
result = client.update_instance_config request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #update_instance_config(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to update_instance_config via a request object, either of type UpdateInstanceConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_instance_config(instance_config: nil, update_mask: nil, validate_only: nil) ⇒ ::Gapic::Operation

    Pass arguments to update_instance_config via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • instance_config (::Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig, ::Hash) (defaults to: nil)

      Required. The user instance config to update, which must always include the instance config name. Otherwise, only fields mentioned in update_mask need be included. To prevent conflicts of concurrent updates, etag can be used.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      Required. A mask specifying which fields in InstanceConfig should be updated. The field mask must always be specified; this prevents any future fields in InstanceConfig from being erased accidentally by clients that do not know about them. Only display_name and labels can be updated.

    • validate_only (::Boolean) (defaults to: nil)

      An option to validate, but not actually execute, a request, and provide the same response.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb', line 680

def update_instance_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Spanner::Admin::Instance::V1::UpdateInstanceConfigRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_instance_config..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.instance_config&.name
    header_params["instance_config.name"] = request.instance_config.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_instance_config.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_instance_config.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @instance_admin_stub.call_rpc :update_instance_config, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    return response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end