Search in sources :

Example 6 with DeleteLogRequest

use of com.google.logging.v2.DeleteLogRequest in project google-cloud-java by GoogleCloudPlatform.

the class LoggingClient method deleteLog.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
   * Deletes all the log entries in a log. The log reappears if it receives new entries. Log entries
   * written shortly before the delete operation might not be deleted.
   *
   * <p>Sample code:
   *
   * <pre><code>
   * try (LoggingClient loggingClient = LoggingClient.create()) {
   *   LogNameOneof logName = LogNameOneof.from(LogName.create("[PROJECT]", "[LOG]"));
   *   loggingClient.deleteLog(logName);
   * }
   * </code></pre>
   *
   * @param logName Required. The resource name of the log to delete:
   *     <p>"projects/[PROJECT_ID]/logs/[LOG_ID]" "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
   *     "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" "folders/[FOLDER_ID]/logs/[LOG_ID]"
   *     <p>`[LOG_ID]` must be URL-encoded. For example, `"projects/my-project-id/logs/syslog"`,
   *     `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. For more
   *     information about log names, see [LogEntry][google.logging.v2.LogEntry].
   * @throws com.google.api.gax.grpc.ApiException if the remote call fails
   */
public final void deleteLog(LogNameOneof logName) {
    DeleteLogRequest request = DeleteLogRequest.newBuilder().setLogNameWithLogNameOneof(logName).build();
    deleteLog(request);
}
Also used : DeleteLogRequest(com.google.logging.v2.DeleteLogRequest)

Aggregations

DeleteLogRequest (com.google.logging.v2.DeleteLogRequest)6 Test (org.junit.Test)5 Empty (com.google.protobuf.Empty)3 LogNameOneof (com.google.logging.v2.LogNameOneof)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1