move method
Moves an instance to the target instance configuration.
You can use the returned long-running operation to track the progress of
moving the instance. MoveInstance
returns FAILED_PRECONDITION
if the
instance meets any of the following criteria: * Is undergoing a move to a
different instance configuration * Has backups * Has an ongoing update *
Contains any CMEK-enabled databases * Is a free trial instance While the
operation is pending: * All other attempts to modify the instance,
including changes to its compute capacity, are rejected. * The following
database and backup admin operations are rejected: *
DatabaseAdmin.CreateDatabase
* DatabaseAdmin.UpdateDatabaseDdl
(disabled if default_leader is specified in the request.) *
DatabaseAdmin.RestoreDatabase
* DatabaseAdmin.CreateBackup
*
DatabaseAdmin.CopyBackup
* Both the source and target instance
configurations are subject to hourly compute and storage charges. * The
instance might experience higher read-write latencies and a higher
transaction abort rate. However, moving an instance doesn't cause any
downtime. The returned long-running operation has a name of the format
/operations/
and can be used to track the move instance operation. The
metadata field type is MoveInstanceMetadata. The response field type is
Instance, if successful. Cancelling the operation sets its metadata's
cancel_time. Cancellation is not immediate because it involves moving any
data previously moved to the target instance configuration back to the
original instance configuration. You can use this operation to track the
progress of the cancellation. Upon successful completion of the
cancellation, the operation terminates with CANCELLED
status. If not
cancelled, upon completion of the returned operation: * The instance
successfully moves to the target instance configuration. * You are billed
for compute and storage in target instance configuration. Authorization
requires the spanner.instances.update
permission on the resource
instance. For more details, see
Move an instance.
request
- The metadata request object.
Request parameters:
name
- Required. The instance to move. Values are of the form
projects//instances/
.
Value must have pattern ^projects/\[^/\]+/instances/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Operation> move(
MoveInstanceRequest request,
core.String name, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$name') + ':move';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}