patch method

Updates a specified setting.

Returns a google.rpc.Status with google.rpc.Code.NOT_FOUND if the setting does not exist. Returns a google.rpc.Status with google.rpc.Code.FAILED_PRECONDITION if the setting is flagged as read only. Returns a google.rpc.Status with google.rpc.Code.ABORTED if the etag supplied in the request does not match the persisted etag of the setting value. On success, the response will contain only name, local_value and etag. The metadata and effective_value cannot be updated through this API. Note: the supplied setting will perform a full overwrite of the local_value field.

request - The metadata request object.

Request parameters:

name - The resource name of the setting. Must be in one of the following forms: * projects/{project_number}/settings/{setting_name} * folders/{folder_id}/settings/{setting_name} * organizations/{organization_id}/settings/{setting_name} For example, "/projects/123/settings/gcp-enableMyFeature" Value must have pattern ^projects/\[^/\]+/settings/\[^/\]+$.

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

Completes with a GoogleCloudResourcesettingsV1Setting.

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<GoogleCloudResourcesettingsV1Setting> patch(
  GoogleCloudResourcesettingsV1Setting request,
  core.String name, {
  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('$name');

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