patch method

Future<DataSource> patch(
  1. DataSource request,
  2. String name, {
  3. String? updateMask,
  4. String? $fields,
})

Updates the existing data source configuration.

The fields that are set in the update mask but not provided in the resource will be deleted.

request - The metadata request object.

Request parameters:

name - Required. Identifier. The name of the data source. Format: accounts/{account}/dataSources/{datasource} Value must have pattern ^accounts/\[^/\]+/dataSources/\[^/\]+$.

updateMask - Required. The list of data source fields to be updated. Fields specified in the update mask without a value specified in the body will be deleted from the data source. Providing special "*" value for full data source replacement is not supported. For example, If you insert updateMask=displayName in the request, it will only update the displayName leaving all other fields untouched.

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

Completes with a DataSource.

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

  final url_ = 'datasources/v1/' + core.Uri.encodeFull('$name');

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