createSink method
Creates a sink that exports specified log entries to a destination. The
export of newly-ingested log entries begins immediately, unless the sink's
writer_identity is not permitted to write to the destination. A sink can
export log entries only from the resource owning the sink.
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> createSink(CreateSinkRequest request) async {
final url = Uri.https(_host, '/v2/${request.parent}/sinks', {
if (request.uniqueWriterIdentity case final $1 when $1.isNotDefault)
'uniqueWriterIdentity': '${$1}',
});
final response = await _client.post(url, body: request.sink);
return LogSink.fromJson(response);
}