use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class AsyncListExclusions method asyncListExclusions.
public static void asyncListExclusions() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
ListExclusionsRequest request = ListExclusionsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageToken("pageToken873572522").setPageSize(883849137).build();
ApiFuture<LogExclusion> future = configClient.listExclusionsPagedCallable().futureCall(request);
// Do something.
for (LogExclusion element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class AsyncListExclusionsPaged method asyncListExclusionsPaged.
public static void asyncListExclusionsPaged() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
ListExclusionsRequest request = ListExclusionsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageToken("pageToken873572522").setPageSize(883849137).build();
while (true) {
ListExclusionsResponse response = configClient.listExclusionsCallable().call(request);
for (LogExclusion 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 AsyncCreateSink method asyncCreateSink.
public static void asyncCreateSink() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
CreateSinkRequest request = CreateSinkRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setSink(LogSink.newBuilder().build()).setUniqueWriterIdentity(true).build();
ApiFuture<LogSink> future = configClient.createSinkCallable().futureCall(request);
// Do something.
LogSink response = future.get();
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class SyncCreateSinkProjectnameLogsink method syncCreateSinkProjectnameLogsink.
public static void syncCreateSinkProjectnameLogsink() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
LogSink sink = LogSink.newBuilder().build();
LogSink response = configClient.createSink(parent, sink);
}
}
use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.
the class SyncCreateExclusionOrganizationnameLogexclusion method syncCreateExclusionOrganizationnameLogexclusion.
public static void syncCreateExclusionOrganizationnameLogexclusion() throws Exception {
// It may require modifications to work in your environment.
try (ConfigClient configClient = ConfigClient.create()) {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
LogExclusion exclusion = LogExclusion.newBuilder().build();
LogExclusion response = configClient.createExclusion(parent, exclusion);
}
}
Aggregations