patch method

Future<Dataset> patch(
  1. Dataset request,
  2. String projectId,
  3. String datasetId, {
  4. int? accessPolicyVersion,
  5. String? $fields,
})

Updates information in an existing dataset.

The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics.

request - The metadata request object.

Request parameters:

projectId - Required. Project ID of the dataset being updated Value must have pattern ^\[^/\]+$.

datasetId - Required. Dataset ID of the dataset being updated Value must have pattern ^\[^/\]+$.

accessPolicyVersion - Optional. The version of the provided access policy schema. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. This version refers to the schema version of the access policy and not the version of access policy. This field's value can be equal or more than the access policy schema provided in the request. For example, * Operations updating conditional access policy binding in datasets must specify version 3. Some of the operations are : - Adding a new access policy entry with condition. - Removing an access policy entry with condition. - Updating an access policy entry with condition. * But dataset with no conditional role bindings in access policy may specify any valid value or leave the field unset. If unset or if 0 or 1 value is used for dataset with conditional bindings, request will be rejected. This field will be mapped to IAM Policy version (https://cloud.google.com/iam/docs/policies#versions) and will be used to set policy in IAM.

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

Completes with a Dataset.

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<Dataset> patch(
  Dataset request,
  core.String projectId,
  core.String datasetId, {
  core.int? accessPolicyVersion,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (accessPolicyVersion != null)
      'accessPolicyVersion': ['${accessPolicyVersion}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'projects/' +
      core.Uri.encodeFull('$projectId') +
      '/datasets/' +
      core.Uri.encodeFull('$datasetId');

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