use of com.google.cloud.monitoring.v3.UptimeCheckServiceClient in project java-docs-samples by GoogleCloudPlatform.
the class UptimeSample method getUptimeCheckConfig.
// [END monitoring_uptime_check_list_ips]]
// [START monitoring_uptime_check_get]]
private static void getUptimeCheckConfig(String projectId, String checkName) throws IOException {
try (UptimeCheckServiceClient client = UptimeCheckServiceClient.create()) {
String fullCheckName = UptimeCheckConfigName.format(projectId, checkName);
UptimeCheckConfig config = client.getUptimeCheckConfig(fullCheckName);
if (config != null) {
System.out.println(config.toString());
} else {
System.out.println("No uptime check config found with name " + checkName + " in project " + projectId);
}
} catch (Exception e) {
usage("Exception getting uptime check: " + e.toString());
throw e;
}
}
Aggregations