Class ServiceMonitoringServiceClient (3.3.0)

public class ServiceMonitoringServiceClient implements BackgroundResource

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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:

  1. 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.
  2. 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.
  3. 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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 ServiceMonitoringServiceSettings serviceMonitoringServiceSettings =
     ServiceMonitoringServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create(serviceMonitoringServiceSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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.

Inheritance

java.lang.Object > ServiceMonitoringServiceClient

Implements

BackgroundResource

Static Methods

create()

public static final ServiceMonitoringServiceClient create()

Constructs an instance of ServiceMonitoringServiceClient with default settings.

Returns
TypeDescription
ServiceMonitoringServiceClient
Exceptions
TypeDescription
IOException

create(ServiceMonitoringServiceSettings settings)

public static final ServiceMonitoringServiceClient create(ServiceMonitoringServiceSettings settings)

Constructs an instance of ServiceMonitoringServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsServiceMonitoringServiceSettings
Returns
TypeDescription
ServiceMonitoringServiceClient
Exceptions
TypeDescription
IOException

create(ServiceMonitoringServiceStub stub)

public static final ServiceMonitoringServiceClient create(ServiceMonitoringServiceStub stub)

Constructs an instance of ServiceMonitoringServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ServiceMonitoringServiceSettings).

Parameter
NameDescription
stubServiceMonitoringServiceStub
Returns
TypeDescription
ServiceMonitoringServiceClient

Constructors

ServiceMonitoringServiceClient(ServiceMonitoringServiceSettings settings)

protected ServiceMonitoringServiceClient(ServiceMonitoringServiceSettings settings)

Constructs an instance of ServiceMonitoringServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsServiceMonitoringServiceSettings

ServiceMonitoringServiceClient(ServiceMonitoringServiceStub stub)

protected ServiceMonitoringServiceClient(ServiceMonitoringServiceStub stub)
Parameter
NameDescription
stubServiceMonitoringServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createService(ResourceName parent, Service service)

public final Service createService(ResourceName parent, Service service)

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ResourceName parent = ResourceName.of("[FOLDER]");
   Service service = Service.newBuilder().build();
   Service response = serviceMonitoringServiceClient.createService(parent, service);
 }
 
Parameters
NameDescription
parentcom.google.api.resourcenames.ResourceName

Required. Resource name of the parent workspace. The format is:

projects/[PROJECT_ID_OR_NUMBER]

serviceService

Required. The Service to create.

Returns
TypeDescription
Service

createService(CreateServiceRequest request)

public final Service createService(CreateServiceRequest request)

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   CreateServiceRequest request =
       CreateServiceRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setServiceId("serviceId-194185552")
           .setService(Service.newBuilder().build())
           .build();
   Service response = serviceMonitoringServiceClient.createService(request);
 }
 
Parameter
NameDescription
requestCreateServiceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Service

createService(OrganizationName parent, Service service)

public final Service createService(OrganizationName parent, Service service)

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   Service service = Service.newBuilder().build();
   Service response = serviceMonitoringServiceClient.createService(parent, service);
 }
 
Parameters
NameDescription
parentOrganizationName

Required. Resource name of the parent workspace. The format is:

projects/[PROJECT_ID_OR_NUMBER]

serviceService

Required. The Service to create.

Returns
TypeDescription
Service

createService(ProjectName parent, Service service)

public final Service createService(ProjectName parent, Service service)

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   Service service = Service.newBuilder().build();
   Service response = serviceMonitoringServiceClient.createService(parent, service);
 }
 
Parameters
NameDescription
parentProjectName

Required. Resource name of the parent workspace. The format is:

projects/[PROJECT_ID_OR_NUMBER]

serviceService

Required. The Service to create.

Returns
TypeDescription
Service

createService(String parent, Service service)

public final Service createService(String parent, Service service)

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   Service service = Service.newBuilder().build();
   Service response = serviceMonitoringServiceClient.createService(parent, service);
 }
 
Parameters
NameDescription
parentString

Required. Resource name of the parent workspace. The format is:

projects/[PROJECT_ID_OR_NUMBER]

serviceService

Required. The Service to create.

Returns
TypeDescription
Service

createServiceCallable()

public final UnaryCallable<CreateServiceRequest,Service> createServiceCallable()

Create a Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   CreateServiceRequest request =
       CreateServiceRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setServiceId("serviceId-194185552")
           .setService(Service.newBuilder().build())
           .build();
   ApiFuture<Service> future =
       serviceMonitoringServiceClient.createServiceCallable().futureCall(request);
   // Do something.
   Service response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateServiceRequest,Service>

createServiceLevelObjective(CreateServiceLevelObjectiveRequest request)

public final ServiceLevelObjective createServiceLevelObjective(CreateServiceLevelObjectiveRequest request)

Create a ServiceLevelObjective for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   CreateServiceLevelObjectiveRequest request =
       CreateServiceLevelObjectiveRequest.newBuilder()
           .setParent(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .setServiceLevelObjectiveId("serviceLevelObjectiveId-240792859")
           .setServiceLevelObjective(ServiceLevelObjective.newBuilder().build())
           .build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.createServiceLevelObjective(request);
 }
 
Parameter
NameDescription
requestCreateServiceLevelObjectiveRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ServiceLevelObjective

createServiceLevelObjective(ServiceName parent, ServiceLevelObjective serviceLevelObjective)

public final ServiceLevelObjective createServiceLevelObjective(ServiceName parent, ServiceLevelObjective serviceLevelObjective)

Create a ServiceLevelObjective for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceName parent = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
   ServiceLevelObjective serviceLevelObjective = ServiceLevelObjective.newBuilder().build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.createServiceLevelObjective(parent, serviceLevelObjective);
 }
 
Parameters
NameDescription
parentServiceName

Required. Resource name of the parent Service. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

serviceLevelObjectiveServiceLevelObjective

Required. The ServiceLevelObjective to create. The provided name will be respected if no ServiceLevelObjective exists with this name.

Returns
TypeDescription
ServiceLevelObjective

createServiceLevelObjective(String parent, ServiceLevelObjective serviceLevelObjective)

public final ServiceLevelObjective createServiceLevelObjective(String parent, ServiceLevelObjective serviceLevelObjective)

Create a ServiceLevelObjective for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String parent = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString();
   ServiceLevelObjective serviceLevelObjective = ServiceLevelObjective.newBuilder().build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.createServiceLevelObjective(parent, serviceLevelObjective);
 }
 
Parameters
NameDescription
parentString

Required. Resource name of the parent Service. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

serviceLevelObjectiveServiceLevelObjective

Required. The ServiceLevelObjective to create. The provided name will be respected if no ServiceLevelObjective exists with this name.

Returns
TypeDescription
ServiceLevelObjective

createServiceLevelObjectiveCallable()

public final UnaryCallable<CreateServiceLevelObjectiveRequest,ServiceLevelObjective> createServiceLevelObjectiveCallable()

Create a ServiceLevelObjective for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   CreateServiceLevelObjectiveRequest request =
       CreateServiceLevelObjectiveRequest.newBuilder()
           .setParent(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .setServiceLevelObjectiveId("serviceLevelObjectiveId-240792859")
           .setServiceLevelObjective(ServiceLevelObjective.newBuilder().build())
           .build();
   ApiFuture<ServiceLevelObjective> future =
       serviceMonitoringServiceClient.createServiceLevelObjectiveCallable().futureCall(request);
   // Do something.
   ServiceLevelObjective response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateServiceLevelObjectiveRequest,ServiceLevelObjective>

deleteService(DeleteServiceRequest request)

public final void deleteService(DeleteServiceRequest request)

Soft delete this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   DeleteServiceRequest request =
       DeleteServiceRequest.newBuilder()
           .setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .build();
   serviceMonitoringServiceClient.deleteService(request);
 }
 
Parameter
NameDescription
requestDeleteServiceRequest

The request object containing all of the parameters for the API call.

deleteService(ServiceName name)

public final void deleteService(ServiceName name)

Soft delete this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceName name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
   serviceMonitoringServiceClient.deleteService(name);
 }
 
Parameter
NameDescription
nameServiceName

Required. Resource name of the Service to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

deleteService(String name)

public final void deleteService(String name)

Soft delete this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString();
   serviceMonitoringServiceClient.deleteService(name);
 }
 
Parameter
NameDescription
nameString

Required. Resource name of the Service to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

deleteServiceCallable()

public final UnaryCallable<DeleteServiceRequest,Empty> deleteServiceCallable()

Soft delete this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   DeleteServiceRequest request =
       DeleteServiceRequest.newBuilder()
           .setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .build();
   ApiFuture<Empty> future =
       serviceMonitoringServiceClient.deleteServiceCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteServiceRequest,Empty>

deleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest request)

public final void deleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest request)

Delete the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   DeleteServiceLevelObjectiveRequest request =
       DeleteServiceLevelObjectiveRequest.newBuilder()
           .setName(
               ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
                       "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
                   .toString())
           .build();
   serviceMonitoringServiceClient.deleteServiceLevelObjective(request);
 }
 
Parameter
NameDescription
requestDeleteServiceLevelObjectiveRequest

The request object containing all of the parameters for the API call.

deleteServiceLevelObjective(ServiceLevelObjectiveName name)

public final void deleteServiceLevelObjective(ServiceLevelObjectiveName name)

Delete the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceLevelObjectiveName name =
       ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
           "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
   serviceMonitoringServiceClient.deleteServiceLevelObjective(name);
 }
 
Parameter
NameDescription
nameServiceLevelObjectiveName

Required. Resource name of the ServiceLevelObjective to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]

deleteServiceLevelObjective(String name)

public final void deleteServiceLevelObjective(String name)

Delete the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String name =
       ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
               "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
           .toString();
   serviceMonitoringServiceClient.deleteServiceLevelObjective(name);
 }
 
Parameter
NameDescription
nameString

Required. Resource name of the ServiceLevelObjective to delete. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]

deleteServiceLevelObjectiveCallable()

public final UnaryCallable<DeleteServiceLevelObjectiveRequest,Empty> deleteServiceLevelObjectiveCallable()

Delete the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   DeleteServiceLevelObjectiveRequest request =
       DeleteServiceLevelObjectiveRequest.newBuilder()
           .setName(
               ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
                       "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       serviceMonitoringServiceClient.deleteServiceLevelObjectiveCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteServiceLevelObjectiveRequest,Empty>

getService(GetServiceRequest request)

public final Service getService(GetServiceRequest request)

Get the named Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   GetServiceRequest request =
       GetServiceRequest.newBuilder()
           .setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .build();
   Service response = serviceMonitoringServiceClient.getService(request);
 }
 
Parameter
NameDescription
requestGetServiceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Service

getService(ServiceName name)

public final Service getService(ServiceName name)

Get the named Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceName name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
   Service response = serviceMonitoringServiceClient.getService(name);
 }
 
Parameter
NameDescription
nameServiceName

Required. Resource name of the Service. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

Returns
TypeDescription
Service

getService(String name)

public final Service getService(String name)

Get the named Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String name = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString();
   Service response = serviceMonitoringServiceClient.getService(name);
 }
 
Parameter
NameDescription
nameString

Required. Resource name of the Service. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]

Returns
TypeDescription
Service

getServiceCallable()

public final UnaryCallable<GetServiceRequest,Service> getServiceCallable()

Get the named Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   GetServiceRequest request =
       GetServiceRequest.newBuilder()
           .setName(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .build();
   ApiFuture<Service> future =
       serviceMonitoringServiceClient.getServiceCallable().futureCall(request);
   // Do something.
   Service response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetServiceRequest,Service>

getServiceLevelObjective(GetServiceLevelObjectiveRequest request)

public final ServiceLevelObjective getServiceLevelObjective(GetServiceLevelObjectiveRequest request)

Get a ServiceLevelObjective by name.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   GetServiceLevelObjectiveRequest request =
       GetServiceLevelObjectiveRequest.newBuilder()
           .setName(
               ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
                       "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
                   .toString())
           .build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.getServiceLevelObjective(request);
 }
 
Parameter
NameDescription
requestGetServiceLevelObjectiveRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ServiceLevelObjective

getServiceLevelObjective(ServiceLevelObjectiveName name)

public final ServiceLevelObjective getServiceLevelObjective(ServiceLevelObjectiveName name)

Get a ServiceLevelObjective by name.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceLevelObjectiveName name =
       ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
           "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.getServiceLevelObjective(name);
 }
 
Parameter
NameDescription
nameServiceLevelObjectiveName

Required. Resource name of the ServiceLevelObjective to get. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]

Returns
TypeDescription
ServiceLevelObjective

getServiceLevelObjective(String name)

public final ServiceLevelObjective getServiceLevelObjective(String name)

Get a ServiceLevelObjective by name.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String name =
       ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
               "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
           .toString();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.getServiceLevelObjective(name);
 }
 
Parameter
NameDescription
nameString

Required. Resource name of the ServiceLevelObjective to get. The format is:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID]/serviceLevelObjectives/[SLO_NAME]

Returns
TypeDescription
ServiceLevelObjective

getServiceLevelObjectiveCallable()

public final UnaryCallable<GetServiceLevelObjectiveRequest,ServiceLevelObjective> getServiceLevelObjectiveCallable()

Get a ServiceLevelObjective by name.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   GetServiceLevelObjectiveRequest request =
       GetServiceLevelObjectiveRequest.newBuilder()
           .setName(
               ServiceLevelObjectiveName.ofProjectServiceServiceLevelObjectiveName(
                       "[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]")
                   .toString())
           .build();
   ApiFuture<ServiceLevelObjective> future =
       serviceMonitoringServiceClient.getServiceLevelObjectiveCallable().futureCall(request);
   // Do something.
   ServiceLevelObjective response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetServiceLevelObjectiveRequest,ServiceLevelObjective>

getSettings()

public final ServiceMonitoringServiceSettings getSettings()
Returns
TypeDescription
ServiceMonitoringServiceSettings

getStub()

public ServiceMonitoringServiceStub getStub()
Returns
TypeDescription
ServiceMonitoringServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listServiceLevelObjectives(ListServiceLevelObjectivesRequest request)

public final ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse listServiceLevelObjectives(ListServiceLevelObjectivesRequest request)

List the ServiceLevelObjectives for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServiceLevelObjectivesRequest request =
       ListServiceLevelObjectivesRequest.newBuilder()
           .setParent(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (ServiceLevelObjective element :
       serviceMonitoringServiceClient.listServiceLevelObjectives(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListServiceLevelObjectivesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse

listServiceLevelObjectives(ServiceName parent)

public final ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse listServiceLevelObjectives(ServiceName parent)

List the ServiceLevelObjectives for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceName parent = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]");
   for (ServiceLevelObjective element :
       serviceMonitoringServiceClient.listServiceLevelObjectives(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentServiceName

Required. Resource name of the parent containing the listed SLOs, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse

listServiceLevelObjectives(String parent)

public final ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse listServiceLevelObjectives(String parent)

List the ServiceLevelObjectives for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String parent = ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString();
   for (ServiceLevelObjective element :
       serviceMonitoringServiceClient.listServiceLevelObjectives(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. Resource name of the parent containing the listed SLOs, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER]/services/[SERVICE_ID] workspaces/[HOST_PROJECT_ID_OR_NUMBER]/services/-

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse

listServiceLevelObjectivesCallable()

public final UnaryCallable<ListServiceLevelObjectivesRequest,ListServiceLevelObjectivesResponse> listServiceLevelObjectivesCallable()

List the ServiceLevelObjectives for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServiceLevelObjectivesRequest request =
       ListServiceLevelObjectivesRequest.newBuilder()
           .setParent(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListServiceLevelObjectivesResponse response =
         serviceMonitoringServiceClient.listServiceLevelObjectivesCallable().call(request);
     for (ServiceLevelObjective element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListServiceLevelObjectivesRequest,ListServiceLevelObjectivesResponse>

listServiceLevelObjectivesPagedCallable()

public final UnaryCallable<ListServiceLevelObjectivesRequest,ServiceMonitoringServiceClient.ListServiceLevelObjectivesPagedResponse> listServiceLevelObjectivesPagedCallable()

List the ServiceLevelObjectives for the given Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServiceLevelObjectivesRequest request =
       ListServiceLevelObjectivesRequest.newBuilder()
           .setParent(ServiceName.ofProjectServiceName("[PROJECT]", "[SERVICE]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<ServiceLevelObjective> future =
       serviceMonitoringServiceClient
           .listServiceLevelObjectivesPagedCallable()
           .futureCall(request);
   // Do something.
   for (ServiceLevelObjective element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListServiceLevelObjectivesRequest,ListServiceLevelObjectivesPagedResponse>

listServices(ResourceName parent)

public final ServiceMonitoringServiceClient.ListServicesPagedResponse listServices(ResourceName parent)

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ResourceName parent = ResourceName.of("[FOLDER]");
   for (Service element : serviceMonitoringServiceClient.listServices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentcom.google.api.resourcenames.ResourceName

Required. Resource name of the parent containing the listed services, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER] workspaces/[HOST_PROJECT_ID_OR_NUMBER]

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServicesPagedResponse

listServices(ListServicesRequest request)

public final ServiceMonitoringServiceClient.ListServicesPagedResponse listServices(ListServicesRequest request)

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServicesRequest request =
       ListServicesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Service element : serviceMonitoringServiceClient.listServices(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListServicesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServicesPagedResponse

listServices(OrganizationName parent)

public final ServiceMonitoringServiceClient.ListServicesPagedResponse listServices(OrganizationName parent)

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
   for (Service element : serviceMonitoringServiceClient.listServices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentOrganizationName

Required. Resource name of the parent containing the listed services, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER] workspaces/[HOST_PROJECT_ID_OR_NUMBER]

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServicesPagedResponse

listServices(ProjectName parent)

public final ServiceMonitoringServiceClient.ListServicesPagedResponse listServices(ProjectName parent)

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ProjectName parent = ProjectName.of("[PROJECT]");
   for (Service element : serviceMonitoringServiceClient.listServices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentProjectName

Required. Resource name of the parent containing the listed services, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER] workspaces/[HOST_PROJECT_ID_OR_NUMBER]

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServicesPagedResponse

listServices(String parent)

public final ServiceMonitoringServiceClient.ListServicesPagedResponse listServices(String parent)

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   String parent = ProjectName.of("[PROJECT]").toString();
   for (Service element : serviceMonitoringServiceClient.listServices(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. Resource name of the parent containing the listed services, either a project or a Monitoring Workspace. The formats are:

projects/[PROJECT_ID_OR_NUMBER] workspaces/[HOST_PROJECT_ID_OR_NUMBER]

Returns
TypeDescription
ServiceMonitoringServiceClient.ListServicesPagedResponse

listServicesCallable()

public final UnaryCallable<ListServicesRequest,ListServicesResponse> listServicesCallable()

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServicesRequest request =
       ListServicesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListServicesResponse response =
         serviceMonitoringServiceClient.listServicesCallable().call(request);
     for (Service element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListServicesRequest,ListServicesResponse>

listServicesPagedCallable()

public final UnaryCallable<ListServicesRequest,ServiceMonitoringServiceClient.ListServicesPagedResponse> listServicesPagedCallable()

List Services for this workspace.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ListServicesRequest request =
       ListServicesRequest.newBuilder()
           .setParent(ProjectName.of("[PROJECT]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Service> future =
       serviceMonitoringServiceClient.listServicesPagedCallable().futureCall(request);
   // Do something.
   for (Service element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListServicesRequest,ListServicesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateService(Service service)

public final Service updateService(Service service)

Update this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   Service service = Service.newBuilder().build();
   Service response = serviceMonitoringServiceClient.updateService(service);
 }
 
Parameter
NameDescription
serviceService

Required. The Service to draw updates from. The given name specifies the resource to update.

Returns
TypeDescription
Service

updateService(UpdateServiceRequest request)

public final Service updateService(UpdateServiceRequest request)

Update this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   UpdateServiceRequest request =
       UpdateServiceRequest.newBuilder()
           .setService(Service.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Service response = serviceMonitoringServiceClient.updateService(request);
 }
 
Parameter
NameDescription
requestUpdateServiceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Service

updateServiceCallable()

public final UnaryCallable<UpdateServiceRequest,Service> updateServiceCallable()

Update this Service.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   UpdateServiceRequest request =
       UpdateServiceRequest.newBuilder()
           .setService(Service.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Service> future =
       serviceMonitoringServiceClient.updateServiceCallable().futureCall(request);
   // Do something.
   Service response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateServiceRequest,Service>

updateServiceLevelObjective(ServiceLevelObjective serviceLevelObjective)

public final ServiceLevelObjective updateServiceLevelObjective(ServiceLevelObjective serviceLevelObjective)

Update the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   ServiceLevelObjective serviceLevelObjective = ServiceLevelObjective.newBuilder().build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.updateServiceLevelObjective(serviceLevelObjective);
 }
 
Parameter
NameDescription
serviceLevelObjectiveServiceLevelObjective

Required. The ServiceLevelObjective to draw updates from. The given name specifies the resource to update.

Returns
TypeDescription
ServiceLevelObjective

updateServiceLevelObjective(UpdateServiceLevelObjectiveRequest request)

public final ServiceLevelObjective updateServiceLevelObjective(UpdateServiceLevelObjectiveRequest request)

Update the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   UpdateServiceLevelObjectiveRequest request =
       UpdateServiceLevelObjectiveRequest.newBuilder()
           .setServiceLevelObjective(ServiceLevelObjective.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ServiceLevelObjective response =
       serviceMonitoringServiceClient.updateServiceLevelObjective(request);
 }
 
Parameter
NameDescription
requestUpdateServiceLevelObjectiveRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ServiceLevelObjective

updateServiceLevelObjectiveCallable()

public final UnaryCallable<UpdateServiceLevelObjectiveRequest,ServiceLevelObjective> updateServiceLevelObjectiveCallable()

Update the given ServiceLevelObjective.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (ServiceMonitoringServiceClient serviceMonitoringServiceClient =
     ServiceMonitoringServiceClient.create()) {
   UpdateServiceLevelObjectiveRequest request =
       UpdateServiceLevelObjectiveRequest.newBuilder()
           .setServiceLevelObjective(ServiceLevelObjective.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<ServiceLevelObjective> future =
       serviceMonitoringServiceClient.updateServiceLevelObjectiveCallable().futureCall(request);
   // Do something.
   ServiceLevelObjective response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateServiceLevelObjectiveRequest,ServiceLevelObjective>