- 3.56.0 (latest)
- 3.55.0
- 3.54.0
- 3.53.0
- 3.52.0
- 3.50.0
- 3.49.0
- 3.48.0
- 3.47.0
- 3.46.0
- 3.45.0
- 3.44.0
- 3.43.0
- 3.42.0
- 3.41.0
- 3.40.0
- 3.38.0
- 3.37.0
- 3.36.0
- 3.35.0
- 3.34.0
- 3.33.0
- 3.32.0
- 3.31.0
- 3.30.0
- 3.29.0
- 3.28.0
- 3.25.0
- 3.24.0
- 3.23.0
- 3.22.0
- 3.21.0
- 3.20.0
- 3.19.0
- 3.18.0
- 3.17.0
- 3.16.0
- 3.15.0
- 3.14.0
- 3.13.0
- 3.12.0
- 3.10.0
- 3.9.0
- 3.8.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.6
- 3.3.6
- 3.2.10
A client to Cloud Monitoring API
The interfaces provided are listed below, along with usage samples.
AlertPolicyServiceClient
Service Description: The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Cloud Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. In addition to using this API, alert policies can also be managed through Cloud Monitoring, which can be reached by clicking the "Monitoring" tab in Cloud console.
Sample for AlertPolicyServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
AlertPolicyName name =
AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
}
GroupServiceClient
Service Description: The Group API lets you inspect and manage your groups.
A group is a named filter that is used to identify a collection of monitored resources. Groups are typically used to mirror the physical and/or logical topology of the environment. Because group membership is computed dynamically, monitored resources that are started in the future are automatically placed in matching groups. By using a group to name monitored resources in, for example, an alert policy, the target of that alert policy is updated automatically as monitored resources are added and removed from the infrastructure.
Sample for GroupServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
GroupName name = GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]");
Group response = groupServiceClient.getGroup(name);
}
MetricServiceClient
Service Description: Manages metric descriptors, monitored resource descriptors, and time series data.
Sample for MetricServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
MonitoredResourceDescriptorName name =
MonitoredResourceDescriptorName.ofProjectMonitoredResourceDescriptorName(
"[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
MonitoredResourceDescriptor response =
metricServiceClient.getMonitoredResourceDescriptor(name);
}
NotificationChannelServiceClient
Service Description: The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.
Sample for NotificationChannelServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name =
NotificationChannelDescriptorName.ofProjectChannelDescriptorName(
"[PROJECT]", "[CHANNEL_DESCRIPTOR]");
NotificationChannelDescriptor response =
notificationChannelServiceClient.getNotificationChannelDescriptor(name);
}
QueryServiceClient
Service Description: The QueryService API is used to manage time series data in Stackdriver Monitoring. Time series data is a collection of data points that describes the time-varying values of a metric.
Sample for QueryServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (QueryServiceClient queryServiceClient = QueryServiceClient.create()) {
QueryTimeSeriesRequest request =
QueryTimeSeriesRequest.newBuilder()
.setName("name3373707")
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (TimeSeriesData element : queryServiceClient.queryTimeSeries(request).iterateAll()) {
// doThingsWith(element);
}
}
ServiceMonitoringServiceClient
Service Description: The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
managing and querying aspects of a workspace's services. These include the Service
's monitored
resources, its Service-Level Objectives, and a taxonomy of categorized Health Metrics.
Sample for ServiceMonitoringServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
ServiceMonitoringServiceClient.create()) {
FolderName parent = FolderName.of("[FOLDER]");
Service service = Service.newBuilder().build();
Service response = serviceMonitoringServiceClient.createService(parent, service);
}
SnoozeServiceClient
Service Description: The SnoozeService API is used to temporarily prevent an alert policy from generating alerts. A Snooze is a description of the criteria under which one or more alert policies should not fire alerts for the specified duration.
Sample for SnoozeServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Snooze snooze = Snooze.newBuilder().build();
Snooze response = snoozeServiceClient.createSnooze(parent, snooze);
}
UptimeCheckServiceClient
Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit) Uptime check configurations in the Cloud Monitoring product. An Uptime check is a piece of configuration that determines which resources and services to monitor for availability. These configurations can also be configured interactively by navigating to the Cloud console, selecting the appropriate project, clicking on "Monitoring" on the left-hand side to navigate to Cloud Monitoring, and then clicking on "Uptime".
Sample for UptimeCheckServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name =
UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
"[PROJECT]", "[UPTIME_CHECK_CONFIG]");
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
}
Classes
AlertPolicyServiceClient
Service Description: The AlertPolicyService API is used to manage (list, create, delete, edit) alert policies in Cloud Monitoring. An alerting policy is a description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. In addition to using this API, alert policies can also be managed through Cloud Monitoring, which can be reached by clicking the "Monitoring" tab in Cloud console.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
AlertPolicyName name =
AlertPolicyName.ofProjectAlertPolicyName("[PROJECT]", "[ALERT_POLICY]");
AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
}
Note: close() needs to be called on the AlertPolicyServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of AlertPolicyServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AlertPolicyServiceSettings alertPolicyServiceSettings =
AlertPolicyServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AlertPolicyServiceClient alertPolicyServiceClient =
AlertPolicyServiceClient.create(alertPolicyServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AlertPolicyServiceSettings alertPolicyServiceSettings =
AlertPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AlertPolicyServiceClient alertPolicyServiceClient =
AlertPolicyServiceClient.create(alertPolicyServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
AlertPolicyServiceClient.ListAlertPoliciesFixedSizeCollection
AlertPolicyServiceClient.ListAlertPoliciesPage
AlertPolicyServiceClient.ListAlertPoliciesPagedResponse
AlertPolicyServiceSettings
Settings class to configure an instance of AlertPolicyServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of getAlertPolicy to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
AlertPolicyServiceSettings.Builder alertPolicyServiceSettingsBuilder =
AlertPolicyServiceSettings.newBuilder();
alertPolicyServiceSettingsBuilder
.getAlertPolicySettings()
.setRetrySettings(
alertPolicyServiceSettingsBuilder
.getAlertPolicySettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
AlertPolicyServiceSettings alertPolicyServiceSettings =
alertPolicyServiceSettingsBuilder.build();
AlertPolicyServiceSettings.Builder
Builder for AlertPolicyServiceSettings.
GroupServiceClient
Service Description: The Group API lets you inspect and manage your groups.
A group is a named filter that is used to identify a collection of monitored resources. Groups are typically used to mirror the physical and/or logical topology of the environment. Because group membership is computed dynamically, monitored resources that are started in the future are automatically placed in matching groups. By using a group to name monitored resources in, for example, an alert policy, the target of that alert policy is updated automatically as monitored resources are added and removed from the infrastructure.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
GroupName name = GroupName.ofProjectGroupName("[PROJECT]", "[GROUP]");
Group response = groupServiceClient.getGroup(name);
}
Note: close() needs to be called on the GroupServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of GroupServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
GroupServiceSettings groupServiceSettings =
GroupServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
GroupServiceClient groupServiceClient = GroupServiceClient.create(groupServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
GroupServiceSettings groupServiceSettings =
GroupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
GroupServiceClient groupServiceClient = GroupServiceClient.create(groupServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
GroupServiceClient.ListGroupMembersFixedSizeCollection
GroupServiceClient.ListGroupMembersPage
GroupServiceClient.ListGroupMembersPagedResponse
GroupServiceClient.ListGroupsFixedSizeCollection
GroupServiceClient.ListGroupsPage
GroupServiceClient.ListGroupsPagedResponse
GroupServiceSettings
Settings class to configure an instance of GroupServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of getGroup to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
GroupServiceSettings.Builder groupServiceSettingsBuilder = GroupServiceSettings.newBuilder();
groupServiceSettingsBuilder
.getGroupSettings()
.setRetrySettings(
groupServiceSettingsBuilder
.getGroupSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
GroupServiceSettings groupServiceSettings = groupServiceSettingsBuilder.build();
GroupServiceSettings.Builder
Builder for GroupServiceSettings.
MetricServiceClient
Service Description: Manages metric descriptors, monitored resource descriptors, and time series data.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
MonitoredResourceDescriptorName name =
MonitoredResourceDescriptorName.ofProjectMonitoredResourceDescriptorName(
"[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
MonitoredResourceDescriptor response =
metricServiceClient.getMonitoredResourceDescriptor(name);
}
Note: close() needs to be called on the MetricServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of MetricServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MetricServiceSettings metricServiceSettings =
MetricServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
MetricServiceClient metricServiceClient = MetricServiceClient.create(metricServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MetricServiceSettings metricServiceSettings =
MetricServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
MetricServiceClient metricServiceClient = MetricServiceClient.create(metricServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
MetricServiceClient.ListMetricDescriptorsFixedSizeCollection
MetricServiceClient.ListMetricDescriptorsPage
MetricServiceClient.ListMetricDescriptorsPagedResponse
MetricServiceClient.ListMonitoredResourceDescriptorsFixedSizeCollection
MetricServiceClient.ListMonitoredResourceDescriptorsPage
MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse
MetricServiceClient.ListTimeSeriesFixedSizeCollection
MetricServiceClient.ListTimeSeriesPage
MetricServiceClient.ListTimeSeriesPagedResponse
MetricServiceSettings
Settings class to configure an instance of MetricServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of getMonitoredResourceDescriptor to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
MetricServiceSettings.Builder metricServiceSettingsBuilder = MetricServiceSettings.newBuilder();
metricServiceSettingsBuilder
.getMonitoredResourceDescriptorSettings()
.setRetrySettings(
metricServiceSettingsBuilder
.getMonitoredResourceDescriptorSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
MetricServiceSettings metricServiceSettings = metricServiceSettingsBuilder.build();
MetricServiceSettings.Builder
Builder for MetricServiceSettings.
NotificationChannelServiceClient
Service Description: The Notification Channel API provides access to configuration that controls how messages related to incidents are sent.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create()) {
NotificationChannelDescriptorName name =
NotificationChannelDescriptorName.ofProjectChannelDescriptorName(
"[PROJECT]", "[CHANNEL_DESCRIPTOR]");
NotificationChannelDescriptor response =
notificationChannelServiceClient.getNotificationChannelDescriptor(name);
}
Note: close() needs to be called on the NotificationChannelServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of NotificationChannelServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NotificationChannelServiceSettings notificationChannelServiceSettings =
NotificationChannelServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create(notificationChannelServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NotificationChannelServiceSettings notificationChannelServiceSettings =
NotificationChannelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
NotificationChannelServiceClient notificationChannelServiceClient =
NotificationChannelServiceClient.create(notificationChannelServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
NotificationChannelServiceClient.ListNotificationChannelDescriptorsFixedSizeCollection
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPage
NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse
NotificationChannelServiceClient.ListNotificationChannelsFixedSizeCollection
NotificationChannelServiceClient.ListNotificationChannelsPage
NotificationChannelServiceClient.ListNotificationChannelsPagedResponse
NotificationChannelServiceSettings
Settings class to configure an instance of NotificationChannelServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of getNotificationChannelDescriptor to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
NotificationChannelServiceSettings.Builder notificationChannelServiceSettingsBuilder =
NotificationChannelServiceSettings.newBuilder();
notificationChannelServiceSettingsBuilder
.getNotificationChannelDescriptorSettings()
.setRetrySettings(
notificationChannelServiceSettingsBuilder
.getNotificationChannelDescriptorSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
NotificationChannelServiceSettings notificationChannelServiceSettings =
notificationChannelServiceSettingsBuilder.build();
NotificationChannelServiceSettings.Builder
Builder for NotificationChannelServiceSettings.
QueryServiceClient
Service Description: The QueryService API is used to manage time series data in Stackdriver Monitoring. Time series data is a collection of data points that describes the time-varying values of a metric.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (QueryServiceClient queryServiceClient = QueryServiceClient.create()) {
QueryTimeSeriesRequest request =
QueryTimeSeriesRequest.newBuilder()
.setName("name3373707")
.setQuery("query107944136")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (TimeSeriesData element : queryServiceClient.queryTimeSeries(request).iterateAll()) {
// doThingsWith(element);
}
}
Note: close() needs to be called on the QueryServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of QueryServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
QueryServiceSettings queryServiceSettings =
QueryServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
QueryServiceClient queryServiceClient = QueryServiceClient.create(queryServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
QueryServiceSettings queryServiceSettings =
QueryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
QueryServiceClient queryServiceClient = QueryServiceClient.create(queryServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
QueryServiceClient.QueryTimeSeriesFixedSizeCollection
QueryServiceClient.QueryTimeSeriesPage
QueryServiceClient.QueryTimeSeriesPagedResponse
QueryServiceSettings
Settings class to configure an instance of QueryServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of queryTimeSeries to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
QueryServiceSettings.Builder queryServiceSettingsBuilder = QueryServiceSettings.newBuilder();
queryServiceSettingsBuilder
.queryTimeSeriesSettings()
.setRetrySettings(
queryServiceSettingsBuilder
.queryTimeSeriesSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
QueryServiceSettings queryServiceSettings = queryServiceSettingsBuilder.build();
QueryServiceSettings.Builder
Builder for QueryServiceSettings.
ServiceMonitoringServiceClient
Service Description: The Cloud Monitoring Service-Oriented Monitoring API has endpoints for
managing and querying aspects of a workspace's services. These include the Service
's monitored
resources, its Service-Level Objectives, and a taxonomy of categorized Health Metrics.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
ServiceMonitoringServiceClient.create()) {
ResourceName parent = ResourceName.of("[FOLDER]");
Service service = Service.newBuilder().build();
Service response = serviceMonitoringServiceClient.createService(parent, service);
}
Note: close() needs to be called on the ServiceMonitoringServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ServiceMonitoringServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ServiceMonitoringServiceSettings serviceMonitoringServiceSettings =
ServiceMonitoringServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ServiceMonitoringServiceClient serviceMonitoringServiceClient =
ServiceMonitoringServiceClient.create(serviceMonitoringServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ServiceMonitoringServiceSettings serviceMonitoringServiceSettings =
ServiceMonitoringServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ServiceMonitoringServiceClient serviceMonitoringServiceClient =
ServiceMonitoringServiceClient.create(serviceMonitoringServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
ServiceMonitoringServiceClient.ListServiceLevelObjectivesFixedSizeCollection
ServiceMonitoringServiceClient.ListServiceLevelObjectivesPage
ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse
ServiceMonitoringServiceClient.ListServicesFixedSizeCollection
ServiceMonitoringServiceClient.ListServicesPage
ServiceMonitoringServiceClient.ListServicesPagedResponse
ServiceMonitoringServiceSettings
Settings class to configure an instance of ServiceMonitoringServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of createService to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
ServiceMonitoringServiceSettings.Builder serviceMonitoringServiceSettingsBuilder =
ServiceMonitoringServiceSettings.newBuilder();
serviceMonitoringServiceSettingsBuilder
.createServiceSettings()
.setRetrySettings(
serviceMonitoringServiceSettingsBuilder
.createServiceSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
ServiceMonitoringServiceSettings serviceMonitoringServiceSettings =
serviceMonitoringServiceSettingsBuilder.build();
ServiceMonitoringServiceSettings.Builder
Builder for ServiceMonitoringServiceSettings.
SnoozeServiceClient
Service Description: The SnoozeService API is used to temporarily prevent an alert policy from generating alerts. A Snooze is a description of the criteria under which one or more alert policies should not fire alerts for the specified duration.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Snooze snooze = Snooze.newBuilder().build();
Snooze response = snoozeServiceClient.createSnooze(parent, snooze);
}
Note: close() needs to be called on the SnoozeServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SnoozeServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SnoozeServiceSettings snoozeServiceSettings =
SnoozeServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.create(snoozeServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SnoozeServiceSettings snoozeServiceSettings =
SnoozeServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
SnoozeServiceClient snoozeServiceClient = SnoozeServiceClient.create(snoozeServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
SnoozeServiceClient.ListSnoozesFixedSizeCollection
SnoozeServiceClient.ListSnoozesPage
SnoozeServiceClient.ListSnoozesPagedResponse
SnoozeServiceSettings
Settings class to configure an instance of SnoozeServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of createSnooze to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
SnoozeServiceSettings.Builder snoozeServiceSettingsBuilder = SnoozeServiceSettings.newBuilder();
snoozeServiceSettingsBuilder
.createSnoozeSettings()
.setRetrySettings(
snoozeServiceSettingsBuilder
.createSnoozeSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
SnoozeServiceSettings snoozeServiceSettings = snoozeServiceSettingsBuilder.build();
SnoozeServiceSettings.Builder
Builder for SnoozeServiceSettings.
UptimeCheckServiceClient
Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit) Uptime check configurations in the Cloud Monitoring product. An Uptime check is a piece of configuration that determines which resources and services to monitor for availability. These configurations can also be configured interactively by navigating to the Cloud console, selecting the appropriate project, clicking on "Monitoring" on the left-hand side to navigate to Cloud Monitoring, and then clicking on "Uptime".
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
UptimeCheckConfigName name =
UptimeCheckConfigName.ofProjectUptimeCheckConfigName(
"[PROJECT]", "[UPTIME_CHECK_CONFIG]");
UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
}
Note: close() needs to be called on the UptimeCheckServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of UptimeCheckServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
UptimeCheckServiceSettings uptimeCheckServiceSettings =
UptimeCheckServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
UptimeCheckServiceClient uptimeCheckServiceClient =
UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
UptimeCheckServiceSettings uptimeCheckServiceSettings =
UptimeCheckServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
UptimeCheckServiceClient uptimeCheckServiceClient =
UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
UptimeCheckServiceClient.ListUptimeCheckConfigsFixedSizeCollection
UptimeCheckServiceClient.ListUptimeCheckConfigsPage
UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse
UptimeCheckServiceClient.ListUptimeCheckIpsFixedSizeCollection
UptimeCheckServiceClient.ListUptimeCheckIpsPage
UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse
UptimeCheckServiceSettings
Settings class to configure an instance of UptimeCheckServiceClient.
The default instance has everything set to sensible defaults:
- The default service address (monitoring.googleapis.com) and default port (443) are used.
- Credentials are acquired automatically through Application Default Credentials.
- Retries are configured for idempotent methods but not for non-idempotent methods.
The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.
For example, to set the total timeout of getUptimeCheckConfig to 30 seconds:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
UptimeCheckServiceSettings.Builder uptimeCheckServiceSettingsBuilder =
UptimeCheckServiceSettings.newBuilder();
uptimeCheckServiceSettingsBuilder
.getUptimeCheckConfigSettings()
.setRetrySettings(
uptimeCheckServiceSettingsBuilder
.getUptimeCheckConfigSettings()
.getRetrySettings()
.toBuilder()
.setTotalTimeout(Duration.ofSeconds(30))
.build());
UptimeCheckServiceSettings uptimeCheckServiceSettings =
uptimeCheckServiceSettingsBuilder.build();
UptimeCheckServiceSettings.Builder
Builder for UptimeCheckServiceSettings.