patch method

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

Updates an existing audit schedule.

request - The metadata request object.

Request parameters:

name - Identifier. Unique identifier for the audit schedule. Format: projects/{project}/locations/{location}/auditSchedules/{audit_schedule} folders/{folder}/locations/{location}/auditSchedules/{audit_schedule} organizations/{organization}/locations/{location}/auditSchedules/{audit_schedule} Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/auditSchedules/\[^/\]+$.

updateMask - Optional. List of fields to update.

validateOnly - Optional. If true, only validates the request and does not update the audit schedule. This executes standard request validation (such as schema, framework existence, scope, and IAM checks) and skips the apply phase. Use this field for the following purposes: * Infrastructure as Code (IaC): Allow tools like Terraform to run dry-run mutations (e.g., terraform plan) without creating real resources or incurring costs. * User Interface Validation: Enable real-time form and permission validation in custom UIs before submitting requests. * CI/CD & Automation: Test your scripts, permissions, and parameters safely without consuming resource quotas.

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

Completes with a AuditSchedule.

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

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

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