list method

Future<InstancesListResponse> list(
  1. String project, {
  2. String? filter,
  3. int? maxResults,
  4. String? pageToken,
  5. String? $fields,
})

Lists instances under a given project.

Request parameters:

project - Project ID of the project for which to list Cloud SQL instances.

filter - A filter expression that filters resources listed in the response. The expression is in the form of field:value. For example, 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per their JSON representation, such as 'settings.userLabels.auto_start:true'. Multiple filter queries are space-separated. For example. 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly.

maxResults - The maximum number of results to return per response.

pageToken - A previously-returned page token representing part of the larger set of results to view.

$fields - Selector specifying which fields to include in a partial response.

Completes with a InstancesListResponse.

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<InstancesListResponse> list(
  core.String project, {
  core.String? filter,
  core.int? maxResults,
  core.String? pageToken,
  core.String? $fields,
}) async {
  final _queryParams = <core.String, core.List<core.String>>{
    if (filter != null) 'filter': [filter],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if ($fields != null) 'fields': [$fields],
  };

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

  final _response = await _requester.request(
    _url,
    'GET',
    queryParams: _queryParams,
  );
  return InstancesListResponse.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}