move method
Moves the instance to the target instance config.
The returned long-running operation can be used to track the progress of
moving the instance. MoveInstance
returns FAILED_PRECONDITION
if the
instance meets any of the following criteria: * Has an ongoing move to a
different instance config * Has backups * Has an ongoing update * Is under
free trial * Contains any CMEK-enabled databases 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 configs are subject to hourly compute and storage
charges. * The instance may experience higher read-write latencies and a
higher transaction abort rate. However, moving an instance does not cause
any downtime. The returned long-running operation will have 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 since it involves
moving any data previously moved to target instance config back to the
original instance config. The same operation can be used to track the
progress of the cancellation. Upon successful completion of the
cancellation, the operation terminates with CANCELLED status. Upon
completion(if not cancelled) of the returned operation: * Instance would
be successfully moved to the target instance config. * You are billed for
compute and storage in target instance config. Authorization requires
spanner.instances.update
permission on the resource instance. For more
details, please see
documentation.
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>);
}