updateSink method

Future<LogSink> updateSink(
  1. UpdateSinkRequest request
)

Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: destination, and filter.

The updated sink might also have a new writer_identity; see the unique_writer_identity field.

Throws a http.ClientException if there were problems communicating with the API service. Throws a StatusException if the API failed with a Status message. Throws a ServiceException for any other failure.

Implementation

Future<LogSink> updateSink(UpdateSinkRequest request) async {
  final url = Uri.https(_host, '/v2/${request.sinkName}', {
    if (request.uniqueWriterIdentity case final $1 when $1.isNotDefault)
      'uniqueWriterIdentity': '${$1}',
    if (request.updateMask case final $1?) 'updateMask': $1.toJson(),
  });
  final response = await _client.put(url, body: request.sink);
  return LogSink.fromJson(response);
}