Search in sources :

Example 61 with ConfigClient

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);
    }
}
Also used : LogSink(com.google.logging.v2.LogSink) ConfigClient(com.google.cloud.logging.v2.ConfigClient) UpdateSinkRequest(com.google.logging.v2.UpdateSinkRequest)

Example 62 with ConfigClient

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);
    }
}
Also used : LogSinkName(com.google.logging.v2.LogSinkName) LogSink(com.google.logging.v2.LogSink) ConfigClient(com.google.cloud.logging.v2.ConfigClient)

Example 63 with ConfigClient

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);
        }
    }
}
Also used : ListViewsRequest(com.google.logging.v2.ListViewsRequest) ConfigClient(com.google.cloud.logging.v2.ConfigClient) LogView(com.google.logging.v2.LogView)

Example 64 with ConfigClient

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;
            }
        }
    }
}
Also used : ListViewsRequest(com.google.logging.v2.ListViewsRequest) ListViewsResponse(com.google.logging.v2.ListViewsResponse) ConfigClient(com.google.cloud.logging.v2.ConfigClient) LogView(com.google.logging.v2.LogView)

Example 65 with ConfigClient

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);
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) UndeleteBucketRequest(com.google.logging.v2.UndeleteBucketRequest)

Aggregations

ConfigClient (com.google.cloud.logging.v2.ConfigClient)69 LogSink (com.google.logging.v2.LogSink)19 LogExclusion (com.google.logging.v2.LogExclusion)17 LogView (com.google.logging.v2.LogView)8 LogBucket (com.google.logging.v2.LogBucket)7 Empty (com.google.protobuf.Empty)5 CmekSettings (com.google.logging.v2.CmekSettings)4 LogSinkName (com.google.logging.v2.LogSinkName)4 FieldMask (com.google.protobuf.FieldMask)4 LogExclusionName (com.google.logging.v2.LogExclusionName)3 BillingAccountName (com.google.logging.v2.BillingAccountName)2 CreateBucketRequest (com.google.logging.v2.CreateBucketRequest)2 CreateExclusionRequest (com.google.logging.v2.CreateExclusionRequest)2 CreateSinkRequest (com.google.logging.v2.CreateSinkRequest)2 CreateViewRequest (com.google.logging.v2.CreateViewRequest)2 DeleteBucketRequest (com.google.logging.v2.DeleteBucketRequest)2 DeleteExclusionRequest (com.google.logging.v2.DeleteExclusionRequest)2 DeleteSinkRequest (com.google.logging.v2.DeleteSinkRequest)2 DeleteViewRequest (com.google.logging.v2.DeleteViewRequest)2 FolderName (com.google.logging.v2.FolderName)2