Search in sources :

Example 6 with MetricsClient

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

the class SyncDeleteLogMetric method syncDeleteLogMetric.

public static void syncDeleteLogMetric() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        DeleteLogMetricRequest request = DeleteLogMetricRequest.newBuilder().setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()).build();
        metricsClient.deleteLogMetric(request);
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) DeleteLogMetricRequest(com.google.logging.v2.DeleteLogMetricRequest)

Example 7 with MetricsClient

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

the class SyncDeleteLogMetricLogmetricname method syncDeleteLogMetricLogmetricname.

public static void syncDeleteLogMetricLogmetricname() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        metricsClient.deleteLogMetric(metricName);
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) LogMetricName(com.google.logging.v2.LogMetricName)

Example 8 with MetricsClient

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

the class AsyncGetLogMetric method asyncGetLogMetric.

public static void asyncGetLogMetric() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        GetLogMetricRequest request = GetLogMetricRequest.newBuilder().setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()).build();
        ApiFuture<LogMetric> future = metricsClient.getLogMetricCallable().futureCall(request);
        // Do something.
        LogMetric response = future.get();
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) LogMetric(com.google.logging.v2.LogMetric) GetLogMetricRequest(com.google.logging.v2.GetLogMetricRequest)

Example 9 with MetricsClient

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

the class SyncGetLogMetricLogmetricname method syncGetLogMetricLogmetricname.

public static void syncGetLogMetricLogmetricname() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        LogMetricName metricName = LogMetricName.of("[PROJECT]", "[METRIC]");
        LogMetric response = metricsClient.getLogMetric(metricName);
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) LogMetric(com.google.logging.v2.LogMetric) LogMetricName(com.google.logging.v2.LogMetricName)

Example 10 with MetricsClient

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

the class AsyncUpdateLogMetric method asyncUpdateLogMetric.

public static void asyncUpdateLogMetric() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder().setMetricName(LogMetricName.of("[PROJECT]", "[METRIC]").toString()).setMetric(LogMetric.newBuilder().build()).build();
        ApiFuture<LogMetric> future = metricsClient.updateLogMetricCallable().futureCall(request);
        // Do something.
        LogMetric response = future.get();
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) UpdateLogMetricRequest(com.google.logging.v2.UpdateLogMetricRequest) LogMetric(com.google.logging.v2.LogMetric)

Aggregations

MetricsClient (com.google.cloud.logging.v2.MetricsClient)19 LogMetric (com.google.logging.v2.LogMetric)13 LogMetricName (com.google.logging.v2.LogMetricName)3 MetricsSettings (com.google.cloud.logging.v2.MetricsSettings)2 CreateLogMetricRequest (com.google.logging.v2.CreateLogMetricRequest)2 DeleteLogMetricRequest (com.google.logging.v2.DeleteLogMetricRequest)2 ListLogMetricsRequest (com.google.logging.v2.ListLogMetricsRequest)2 UpdateLogMetricRequest (com.google.logging.v2.UpdateLogMetricRequest)2 GetLogMetricRequest (com.google.logging.v2.GetLogMetricRequest)1 ListLogMetricsResponse (com.google.logging.v2.ListLogMetricsResponse)1 ProjectName (com.google.logging.v2.ProjectName)1 Empty (com.google.protobuf.Empty)1