queryAssets method

Future<QueryAssetsResponse> queryAssets(
  1. QueryAssetsRequest request,
  2. String parent, {
  3. String? $fields,
})

Issue a job that queries assets using a SQL statement compatible with BigQuery SQL.

If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the QueryAssetsResponse. Otherwise, full query results can be obtained by issuing extra requests with the job_reference from the a previous QueryAssets call. Note, the query result has approximately 10 GB limitation enforced by BigQuery. Queries return larger results will result in errors.

request - The metadata request object.

Request parameters:

parent - Required. The relative name of the root asset. This can only be an organization number (such as "organizations/123"), a project ID (such as "projects/my-project-id"), or a project number (such as "projects/12345"), or a folder number (such as "folders/123"). Only assets belonging to the parent will be returned. Value must have pattern ^\[^/\]+/\[^/\]+$.

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

Completes with a QueryAssetsResponse.

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<QueryAssetsResponse> queryAssets(
  QueryAssetsRequest request,
  core.String parent, {
  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('$parent') + ':queryAssets';

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