Search in sources :

Example 31 with ConfigClient

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

Example 32 with ConfigClient

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

Example 33 with ConfigClient

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

Example 34 with ConfigClient

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

Example 35 with ConfigClient

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

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