switchover method

Future<Operation> switchover(
  1. String project,
  2. String instance, {
  3. String? dbTimeout,
  4. String? $fields,
})

Switches over from the primary instance to a replica instance.

Request parameters:

project - ID of the project that contains the replica.

instance - Cloud SQL read replica instance name.

dbTimeout - Optional. (MySQL only) Cloud SQL instance operations timeout, which is a sum of all database operations. Default value is 10 minutes and can be modified to a maximum value of 24 hours.

$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> switchover(
  core.String project,
  core.String instance, {
  core.String? dbTimeout,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (dbTimeout != null) 'dbTimeout': [dbTimeout],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'sql/v1beta4/projects/' +
      commons.escapeVariable('$project') +
      '/instances/' +
      commons.escapeVariable('$instance') +
      '/switchover';

  final response_ = await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
  );
  return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}