use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class SyncUpdateSink method syncUpdateSink.
public static void syncUpdateSink() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
UpdateSinkRequest request = UpdateSinkRequest.newBuilder().setSinkName(LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString()).setSink(LogSink.newBuilder().build()).setUniqueWriterIdentity(true).setUpdateMask(FieldMask.newBuilder().build()).build();
LogSink response = configClient.updateSink(request);
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class SyncUpdateSinkLogsinknameLogsink method syncUpdateSinkLogsinknameLogsink.
public static void syncUpdateSinkLogsinknameLogsink() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.updateSink(sinkName, sink);
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class AsyncListViews method asyncListViews.
public static void asyncListViews() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
ListViewsRequest request = ListViewsRequest.newBuilder().setParent("parent-995424086").setPageToken("pageToken873572522").setPageSize(883849137).build();
ApiFuture<LogView> future = configClient.listViewsPagedCallable().futureCall(request);
// Do something.
for (LogView element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class AsyncListViewsPaged method asyncListViewsPaged.
public static void asyncListViewsPaged() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
ListViewsRequest request = ListViewsRequest.newBuilder().setParent("parent-995424086").setPageToken("pageToken873572522").setPageSize(883849137).build();
while (true) {
ListViewsResponse response = configClient.listViewsCallable().call(request);
for (LogView element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class SyncUndeleteBucket method syncUndeleteBucket.
public static void syncUndeleteBucket() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
UndeleteBucketRequest request = UndeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
configClient.undeleteBucket(request);
}
}
Aggregations