fetchForResourceType method

Future<FetchBackupsForResourceTypeResponse> fetchForResourceType(
  1. String parent, {
  2. String? filter,
  3. String? orderBy,
  4. int? pageSize,
  5. String? pageToken,
  6. String? resourceType,
  7. String? view,
  8. String? $fields,
})

Fetch Backups for a given resource type.

Request parameters:

parent - Required. Datasources are the parent resource for the backups. Format: projects/{project}/locations/{location}/backupVaults/{backupVaultId}/dataSources/{datasourceId} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/backupVaults/\[^/\]+/dataSources/\[^/\]+$.

filter - Optional. A filter expression that filters the results fetched in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. Supported fields: * name * state * backup_type * create_time * expire_time * enforced_retention_end_time * gcp_backup_plan_info.backup_plan * cloud_sql_instance_backup_properties.instance_tier * cloud_sql_instance_backup_properties.database_installed_version

orderBy - Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields: * name

pageSize - Optional. The maximum number of Backups to return. The service may return fewer than this value. If unspecified, at most 50 Backups will be returned. The maximum value is 100; values above 100 will be coerced to 100.

pageToken - Optional. A page token, received from a previous call of FetchBackupsForResourceType. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to FetchBackupsForResourceType must match the call that provided the page token.

resourceType - Required. The type of the Google Cloud resource. Ex: sqladmin.googleapis.com/Instance

view - Optional. This parameter is used to specify the view of the backup. If not specified, the default view is BASIC. Possible string values are:

  • "BACKUP_VIEW_UNSPECIFIED" : If the value is not set, the default 'FULL' view is used.
  • "BACKUP_VIEW_BASIC" : Includes basic data about the Backup, but not the full contents.
  • "BACKUP_VIEW_FULL" : Includes all data about the Backup. This is the default value (for both ListBackups and GetBackup).

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

Completes with a FetchBackupsForResourceTypeResponse.

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<FetchBackupsForResourceTypeResponse> fetchForResourceType(
  core.String parent, {
  core.String? filter,
  core.String? orderBy,
  core.int? pageSize,
  core.String? pageToken,
  core.String? resourceType,
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    'filter': ?filter == null ? null : [filter],
    'orderBy': ?orderBy == null ? null : [orderBy],
    'pageSize': ?pageSize == null ? null : ['${pageSize}'],
    'pageToken': ?pageToken == null ? null : [pageToken],
    'resourceType': ?resourceType == null ? null : [resourceType],
    'view': ?view == null ? null : [view],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'v1/' +
      core.Uri.encodeFull('$parent') +
      '/backups:fetchForResourceType';

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