Search in sources :

Example 56 with ConfigClient

use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.

the class SyncGetSinkString method syncGetSinkString.

public static void syncGetSinkString() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        String sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]").toString();
        LogSink response = configClient.getSink(sinkName);
    }
}
Also used : LogSink(com.google.logging.v2.LogSink) ConfigClient(com.google.cloud.logging.v2.ConfigClient)

Example 57 with ConfigClient

use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.

the class AsyncListBucketsPaged method asyncListBucketsPaged.

public static void asyncListBucketsPaged() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        ListBucketsRequest request = ListBucketsRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setPageToken("pageToken873572522").setPageSize(883849137).build();
        while (true) {
            ListBucketsResponse response = configClient.listBucketsCallable().call(request);
            for (LogBucket element : response.getResponsesList()) {
            // doThingsWith(element);
            }
            String nextPageToken = response.getNextPageToken();
            if (!Strings.isNullOrEmpty(nextPageToken)) {
                request = request.toBuilder().setPageToken(nextPageToken).build();
            } else {
                break;
            }
        }
    }
}
Also used : ListBucketsResponse(com.google.logging.v2.ListBucketsResponse) ConfigClient(com.google.cloud.logging.v2.ConfigClient) ListBucketsRequest(com.google.logging.v2.ListBucketsRequest) LogBucket(com.google.logging.v2.LogBucket)

Example 58 with ConfigClient

use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.

the class AsyncUpdateExclusion method asyncUpdateExclusion.

public static void asyncUpdateExclusion() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setExclusion(LogExclusion.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
        ApiFuture<LogExclusion> future = configClient.updateExclusionCallable().futureCall(request);
        // Do something.
        LogExclusion response = future.get();
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) UpdateExclusionRequest(com.google.logging.v2.UpdateExclusionRequest) LogExclusion(com.google.logging.v2.LogExclusion)

Example 59 with ConfigClient

use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.

the class SyncUpdateExclusion method syncUpdateExclusion.

public static void syncUpdateExclusion() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        UpdateExclusionRequest request = UpdateExclusionRequest.newBuilder().setName(LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString()).setExclusion(LogExclusion.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
        LogExclusion response = configClient.updateExclusion(request);
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) UpdateExclusionRequest(com.google.logging.v2.UpdateExclusionRequest) LogExclusion(com.google.logging.v2.LogExclusion)

Example 60 with ConfigClient

use of com.google.cloud.logging.v2.ConfigClient in project gapic-generator-java by googleapis.

the class SyncUpdateExclusionStringLogexclusionFieldmask method syncUpdateExclusionStringLogexclusionFieldmask.

public static void syncUpdateExclusionStringLogexclusionFieldmask() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        String name = LogExclusionName.ofProjectExclusionName("[PROJECT]", "[EXCLUSION]").toString();
        LogExclusion exclusion = LogExclusion.newBuilder().build();
        FieldMask updateMask = FieldMask.newBuilder().build();
        LogExclusion response = configClient.updateExclusion(name, exclusion, updateMask);
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) LogExclusion(com.google.logging.v2.LogExclusion) FieldMask(com.google.protobuf.FieldMask)

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