promoteReplica method

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

Promotes the read replica instance to be a stand-alone Cloud SQL instance.

Using this operation might cause your instance to restart.

Request parameters:

project - ID of the project that contains the read replica.

instance - Cloud SQL read replica instance name.

failover_1 - Set to true if the promote operation should attempt to re-add the original primary as a replica when it comes back online. Otherwise, if this value is false or not set, the original primary will be a standalone instance.

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

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

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