Search in sources :

Example 1 with MetricsClient

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

the class SyncCreateSetEndpoint method syncCreateSetEndpoint.

public static void syncCreateSetEndpoint() throws Exception {
    // This snippet has been automatically generated for illustrative purposes only.
    // It may require modifications to work in your environment.
    MetricsSettings metricsSettings = MetricsSettings.newBuilder().setEndpoint(myEndpoint).build();
    MetricsClient metricsClient = MetricsClient.create(metricsSettings);
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) MetricsSettings(com.google.cloud.logging.v2.MetricsSettings)

Example 2 with MetricsClient

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

the class AsyncCreateLogMetric method asyncCreateLogMetric.

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

Example 3 with MetricsClient

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

the class SyncCreateLogMetricProjectnameLogmetric method syncCreateLogMetricProjectnameLogmetric.

public static void syncCreateLogMetricProjectnameLogmetric() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        ProjectName parent = ProjectName.of("[PROJECT]");
        LogMetric metric = LogMetric.newBuilder().build();
        LogMetric response = metricsClient.createLogMetric(parent, metric);
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) LogMetric(com.google.logging.v2.LogMetric) ProjectName(com.google.logging.v2.ProjectName)

Example 4 with MetricsClient

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

the class SyncCreateLogMetricStringLogmetric method syncCreateLogMetricStringLogmetric.

public static void syncCreateLogMetricStringLogmetric() throws Exception {
    // It may require modifications to work in your environment.
    try (MetricsClient metricsClient = MetricsClient.create()) {
        String parent = ProjectName.of("[PROJECT]").toString();
        LogMetric metric = LogMetric.newBuilder().build();
        LogMetric response = metricsClient.createLogMetric(parent, metric);
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) LogMetric(com.google.logging.v2.LogMetric)

Example 5 with MetricsClient

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

the class AsyncDeleteLogMetric method asyncDeleteLogMetric.

public static void asyncDeleteLogMetric() 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();
        ApiFuture<Empty> future = metricsClient.deleteLogMetricCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : MetricsClient(com.google.cloud.logging.v2.MetricsClient) Empty(com.google.protobuf.Empty) DeleteLogMetricRequest(com.google.logging.v2.DeleteLogMetricRequest)

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