patch method

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

Updates a revision of an existing Posture.

If the posture revision that you update is currently deployed, then a new revision of the posture is created. To prevent concurrent updates from overwriting each other, always follow the read-modify-write pattern when you update a posture: 1. Call GetPosture to get the current version of the posture. 2. Update the fields in the posture as needed. 3. Call UpdatePosture to update the posture. Ensure that your request includes the etag value from the GetPosture response. Important: If you omit the etag when you call UpdatePosture, then the updated posture unconditionally overwrites the existing posture.

request - The metadata request object.

Request parameters:

name - Required. Identifier. The name of the posture, in the format organizations/{organization}/locations/global/postures/{posture_id}. Value must have pattern ^organizations/\[^/\]+/locations/\[^/\]+/postures/\[^/\]+$.

revisionId - Required. The revision ID of the posture to update. If the posture revision that you update is currently deployed, then a new revision of the posture is created.

updateMask - Required. The fields in the Posture to update. You can update only the following fields: * Posture.description * Posture.policy_sets * Posture.state

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

Completes with a Operation.

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

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

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