update method

Future<Dataset> update(
  1. Dataset request,
  2. String projectId,
  3. String datasetId, {
  4. int? accessPolicyVersion,
  5. String? updateMode,
  6. 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.

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.

updateMode - Optional. Specifies the fields of dataset that update/patch operation is targeting By default, both metadata and ACL fields are updated. Possible string values are:

  • "UPDATE_MODE_UNSPECIFIED" : The default value. Default to the UPDATE_FULL.
  • "UPDATE_METADATA" : Includes metadata information for the dataset, such as friendlyName, description, labels, etc.
  • "UPDATE_ACL" : Includes ACL information for the dataset, which defines dataset access for one or more entities.
  • "UPDATE_FULL" : Includes both dataset metadata and ACL information.

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

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

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