@Generated(value="by gapic-generator-java") public class ServiceHealthClient extends Object implements com.google.api.gax.core.BackgroundResource
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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
EventName name = EventName.of("[PROJECT]", "[LOCATION]", "[EVENT]");
Event response = serviceHealthClient.getEvent(name);
}
Note: close() needs to be called on the ServiceHealthClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListEvents |
Lists events under a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetEvent |
Retrieves a resource containing information about an event. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListOrganizationEvents |
Lists organization events under a given organization and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetOrganizationEvent |
Retrieves a resource containing information about an event affecting an organization . |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListOrganizationImpacts |
Lists assets impacted by organization events under a given organization and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetOrganizationImpact |
Retrieves a resource containing information about impact to an asset under an organization affected by a service health event. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return 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 ServiceHealthSettings 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
ServiceHealthSettings serviceHealthSettings =
ServiceHealthSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ServiceHealthClient serviceHealthClient = ServiceHealthClient.create(serviceHealthSettings);
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
ServiceHealthSettings serviceHealthSettings =
ServiceHealthSettings.newBuilder().setEndpoint(myEndpoint).build();
ServiceHealthClient serviceHealthClient = ServiceHealthClient.create(serviceHealthSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
ServiceHealthSettings serviceHealthSettings =
ServiceHealthSettings.newHttpJsonBuilder().build();
ServiceHealthClient serviceHealthClient = ServiceHealthClient.create(serviceHealthSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ServiceHealthClient.ListEventsFixedSizeCollection |
static class |
ServiceHealthClient.ListEventsPage |
static class |
ServiceHealthClient.ListEventsPagedResponse |
static class |
ServiceHealthClient.ListLocationsFixedSizeCollection |
static class |
ServiceHealthClient.ListLocationsPage |
static class |
ServiceHealthClient.ListLocationsPagedResponse |
static class |
ServiceHealthClient.ListOrganizationEventsFixedSizeCollection |
static class |
ServiceHealthClient.ListOrganizationEventsPage |
static class |
ServiceHealthClient.ListOrganizationEventsPagedResponse |
static class |
ServiceHealthClient.ListOrganizationImpactsFixedSizeCollection |
static class |
ServiceHealthClient.ListOrganizationImpactsPage |
static class |
ServiceHealthClient.ListOrganizationImpactsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ServiceHealthClient(ServiceHealthSettings settings)
Constructs an instance of ServiceHealthClient, using the given settings.
|
protected |
ServiceHealthClient(ServiceHealthStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ServiceHealthClient |
create()
Constructs an instance of ServiceHealthClient with default settings.
|
static ServiceHealthClient |
create(ServiceHealthSettings settings)
Constructs an instance of ServiceHealthClient, using the given settings.
|
static ServiceHealthClient |
create(ServiceHealthStub stub)
Constructs an instance of ServiceHealthClient, using the given stub for making calls.
|
Event |
getEvent(EventName name)
Retrieves a resource containing information about an event.
|
Event |
getEvent(GetEventRequest request)
Retrieves a resource containing information about an event.
|
Event |
getEvent(String name)
Retrieves a resource containing information about an event.
|
com.google.api.gax.rpc.UnaryCallable<GetEventRequest,Event> |
getEventCallable()
Retrieves a resource containing information about an event.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
OrganizationEvent |
getOrganizationEvent(GetOrganizationEventRequest request)
Retrieves a resource containing information about an event affecting an organization .
|
OrganizationEvent |
getOrganizationEvent(OrganizationEventName name)
Retrieves a resource containing information about an event affecting an organization .
|
OrganizationEvent |
getOrganizationEvent(String name)
Retrieves a resource containing information about an event affecting an organization .
|
com.google.api.gax.rpc.UnaryCallable<GetOrganizationEventRequest,OrganizationEvent> |
getOrganizationEventCallable()
Retrieves a resource containing information about an event affecting an organization .
|
OrganizationImpact |
getOrganizationImpact(GetOrganizationImpactRequest request)
Retrieves a resource containing information about impact to an asset under an organization
affected by a service health event.
|
OrganizationImpact |
getOrganizationImpact(OrganizationImpactName name)
Retrieves a resource containing information about impact to an asset under an organization
affected by a service health event.
|
OrganizationImpact |
getOrganizationImpact(String name)
Retrieves a resource containing information about impact to an asset under an organization
affected by a service health event.
|
com.google.api.gax.rpc.UnaryCallable<GetOrganizationImpactRequest,OrganizationImpact> |
getOrganizationImpactCallable()
Retrieves a resource containing information about impact to an asset under an organization
affected by a service health event.
|
ServiceHealthSettings |
getSettings() |
ServiceHealthStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ServiceHealthClient.ListEventsPagedResponse |
listEvents(ListEventsRequest request)
Lists events under a given project and location.
|
ServiceHealthClient.ListEventsPagedResponse |
listEvents(LocationName parent)
Lists events under a given project and location.
|
ServiceHealthClient.ListEventsPagedResponse |
listEvents(String parent)
Lists events under a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListEventsRequest,ListEventsResponse> |
listEventsCallable()
Lists events under a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<ListEventsRequest,ServiceHealthClient.ListEventsPagedResponse> |
listEventsPagedCallable()
Lists events under a given project and location.
|
ServiceHealthClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ServiceHealthClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
ServiceHealthClient.ListOrganizationEventsPagedResponse |
listOrganizationEvents(ListOrganizationEventsRequest request)
Lists organization events under a given organization and location.
|
ServiceHealthClient.ListOrganizationEventsPagedResponse |
listOrganizationEvents(OrganizationLocationName parent)
Lists organization events under a given organization and location.
|
ServiceHealthClient.ListOrganizationEventsPagedResponse |
listOrganizationEvents(String parent)
Lists organization events under a given organization and location.
|
com.google.api.gax.rpc.UnaryCallable<ListOrganizationEventsRequest,ListOrganizationEventsResponse> |
listOrganizationEventsCallable()
Lists organization events under a given organization and location.
|
com.google.api.gax.rpc.UnaryCallable<ListOrganizationEventsRequest,ServiceHealthClient.ListOrganizationEventsPagedResponse> |
listOrganizationEventsPagedCallable()
Lists organization events under a given organization and location.
|
ServiceHealthClient.ListOrganizationImpactsPagedResponse |
listOrganizationImpacts(ListOrganizationImpactsRequest request)
Lists assets impacted by organization events under a given organization and location.
|
ServiceHealthClient.ListOrganizationImpactsPagedResponse |
listOrganizationImpacts(OrganizationLocationName parent)
Lists assets impacted by organization events under a given organization and location.
|
ServiceHealthClient.ListOrganizationImpactsPagedResponse |
listOrganizationImpacts(String parent)
Lists assets impacted by organization events under a given organization and location.
|
com.google.api.gax.rpc.UnaryCallable<ListOrganizationImpactsRequest,ListOrganizationImpactsResponse> |
listOrganizationImpactsCallable()
Lists assets impacted by organization events under a given organization and location.
|
com.google.api.gax.rpc.UnaryCallable<ListOrganizationImpactsRequest,ServiceHealthClient.ListOrganizationImpactsPagedResponse> |
listOrganizationImpactsPagedCallable()
Lists assets impacted by organization events under a given organization and location.
|
void |
shutdown() |
void |
shutdownNow() |
protected ServiceHealthClient(ServiceHealthSettings settings) throws IOException
IOExceptionprotected ServiceHealthClient(ServiceHealthStub stub)
public static final ServiceHealthClient create() throws IOException
IOExceptionpublic static final ServiceHealthClient create(ServiceHealthSettings settings) throws IOException
IOExceptionpublic static final ServiceHealthClient create(ServiceHealthStub stub)
public final ServiceHealthSettings getSettings()
public ServiceHealthStub getStub()
public final ServiceHealthClient.ListEventsPagedResponse listEvents(LocationName parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Event element : serviceHealthClient.listEvents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`projects/{project_id}/locations/{location}/events`.
`project_id` - ID of the project for which to list service health events. `location` - The location to get the service health events from. To retrieve service health events of category = INCIDENT, use `location` = `global`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListEventsPagedResponse listEvents(String parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Event element : serviceHealthClient.listEvents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`projects/{project_id}/locations/{location}/events`.
`project_id` - ID of the project for which to list service health events. `location` - The location to get the service health events from. To retrieve service health events of category = INCIDENT, use `location` = `global`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListEventsPagedResponse listEvents(ListEventsRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListEventsRequest request =
ListEventsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(EventView.forNumber(0))
.build();
for (Event element : serviceHealthClient.listEvents(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListEventsRequest,ServiceHealthClient.ListEventsPagedResponse> listEventsPagedCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListEventsRequest request =
ListEventsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(EventView.forNumber(0))
.build();
ApiFuture<Event> future = serviceHealthClient.listEventsPagedCallable().futureCall(request);
// Do something.
for (Event element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListEventsRequest,ListEventsResponse> listEventsCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListEventsRequest request =
ListEventsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(EventView.forNumber(0))
.build();
while (true) {
ListEventsResponse response = serviceHealthClient.listEventsCallable().call(request);
for (Event element : response.getEventsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Event getEvent(EventName name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
EventName name = EventName.of("[PROJECT]", "[LOCATION]", "[EVENT]");
Event response = serviceHealthClient.getEvent(name);
}
name - Required. Unique name of the event in this scope including project and location
using the form `projects/{project_id}/locations/{location}/events/{event_id}`.
`project_id` - Project ID of the project that contains the event. <br> `location` - The location to get the service health events from. <br> `event_id` - Event ID to retrieve.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Event getEvent(String name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String name = EventName.of("[PROJECT]", "[LOCATION]", "[EVENT]").toString();
Event response = serviceHealthClient.getEvent(name);
}
name - Required. Unique name of the event in this scope including project and location
using the form `projects/{project_id}/locations/{location}/events/{event_id}`.
`project_id` - Project ID of the project that contains the event. <br> `location` - The location to get the service health events from. <br> `event_id` - Event ID to retrieve.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Event getEvent(GetEventRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetEventRequest request =
GetEventRequest.newBuilder()
.setName(EventName.of("[PROJECT]", "[LOCATION]", "[EVENT]").toString())
.build();
Event response = serviceHealthClient.getEvent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetEventRequest,Event> getEventCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetEventRequest request =
GetEventRequest.newBuilder()
.setName(EventName.of("[PROJECT]", "[LOCATION]", "[EVENT]").toString())
.build();
ApiFuture<Event> future = serviceHealthClient.getEventCallable().futureCall(request);
// Do something.
Event response = future.get();
}
public final ServiceHealthClient.ListOrganizationEventsPagedResponse listOrganizationEvents(OrganizationLocationName parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
for (OrganizationEvent element :
serviceHealthClient.listOrganizationEvents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`organizations/{organization_id}/locations/{location}/organizationEvents`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `location` - The location to get the service health events from. To retrieve service health events of category = INCIDENT, use `location` = `global`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListOrganizationEventsPagedResponse listOrganizationEvents(String parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
for (OrganizationEvent element :
serviceHealthClient.listOrganizationEvents(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`organizations/{organization_id}/locations/{location}/organizationEvents`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `location` - The location to get the service health events from. To retrieve service health events of category = INCIDENT, use `location` = `global`.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListOrganizationEventsPagedResponse listOrganizationEvents(ListOrganizationEventsRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationEventsRequest request =
ListOrganizationEventsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(OrganizationEventView.forNumber(0))
.build();
for (OrganizationEvent element :
serviceHealthClient.listOrganizationEvents(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListOrganizationEventsRequest,ServiceHealthClient.ListOrganizationEventsPagedResponse> listOrganizationEventsPagedCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationEventsRequest request =
ListOrganizationEventsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(OrganizationEventView.forNumber(0))
.build();
ApiFuture<OrganizationEvent> future =
serviceHealthClient.listOrganizationEventsPagedCallable().futureCall(request);
// Do something.
for (OrganizationEvent element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListOrganizationEventsRequest,ListOrganizationEventsResponse> listOrganizationEventsCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationEventsRequest request =
ListOrganizationEventsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.setView(OrganizationEventView.forNumber(0))
.build();
while (true) {
ListOrganizationEventsResponse response =
serviceHealthClient.listOrganizationEventsCallable().call(request);
for (OrganizationEvent element : response.getOrganizationEventsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final OrganizationEvent getOrganizationEvent(OrganizationEventName name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
OrganizationEventName name =
OrganizationEventName.of("[ORGANIZATION]", "[LOCATION]", "[EVENT]");
OrganizationEvent response = serviceHealthClient.getOrganizationEvent(name);
}
name - Required. Unique name of the event in this scope including organization and event
ID using the form
`organizations/{organization_id}/locations/locations/global/organizationEvents/{event_id}`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `event_id` - Organization event ID to retrieve.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final OrganizationEvent getOrganizationEvent(String name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String name = OrganizationEventName.of("[ORGANIZATION]", "[LOCATION]", "[EVENT]").toString();
OrganizationEvent response = serviceHealthClient.getOrganizationEvent(name);
}
name - Required. Unique name of the event in this scope including organization and event
ID using the form
`organizations/{organization_id}/locations/locations/global/organizationEvents/{event_id}`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `event_id` - Organization event ID to retrieve.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final OrganizationEvent getOrganizationEvent(GetOrganizationEventRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetOrganizationEventRequest request =
GetOrganizationEventRequest.newBuilder()
.setName(
OrganizationEventName.of("[ORGANIZATION]", "[LOCATION]", "[EVENT]").toString())
.build();
OrganizationEvent response = serviceHealthClient.getOrganizationEvent(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetOrganizationEventRequest,OrganizationEvent> getOrganizationEventCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetOrganizationEventRequest request =
GetOrganizationEventRequest.newBuilder()
.setName(
OrganizationEventName.of("[ORGANIZATION]", "[LOCATION]", "[EVENT]").toString())
.build();
ApiFuture<OrganizationEvent> future =
serviceHealthClient.getOrganizationEventCallable().futureCall(request);
// Do something.
OrganizationEvent response = future.get();
}
public final ServiceHealthClient.ListOrganizationImpactsPagedResponse listOrganizationImpacts(OrganizationLocationName parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
for (OrganizationImpact element :
serviceHealthClient.listOrganizationImpacts(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`organizations/{organization_id}/locations/{location}/organizationImpacts`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListOrganizationImpactsPagedResponse listOrganizationImpacts(String parent)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString();
for (OrganizationImpact element :
serviceHealthClient.listOrganizationImpacts(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Parent value using the form
`organizations/{organization_id}/locations/{location}/organizationImpacts`.
`organization_id` - ID (number) of the project that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).
com.google.api.gax.rpc.ApiException - if the remote call failspublic final ServiceHealthClient.ListOrganizationImpactsPagedResponse listOrganizationImpacts(ListOrganizationImpactsRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationImpactsRequest request =
ListOrganizationImpactsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (OrganizationImpact element :
serviceHealthClient.listOrganizationImpacts(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListOrganizationImpactsRequest,ServiceHealthClient.ListOrganizationImpactsPagedResponse> listOrganizationImpactsPagedCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationImpactsRequest request =
ListOrganizationImpactsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<OrganizationImpact> future =
serviceHealthClient.listOrganizationImpactsPagedCallable().futureCall(request);
// Do something.
for (OrganizationImpact element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListOrganizationImpactsRequest,ListOrganizationImpactsResponse> listOrganizationImpactsCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListOrganizationImpactsRequest request =
ListOrganizationImpactsRequest.newBuilder()
.setParent(OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListOrganizationImpactsResponse response =
serviceHealthClient.listOrganizationImpactsCallable().call(request);
for (OrganizationImpact element : response.getOrganizationImpactsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final OrganizationImpact getOrganizationImpact(OrganizationImpactName name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
OrganizationImpactName name =
OrganizationImpactName.of("[ORGANIZATION]", "[LOCATION]", "[ORGANIZATION_IMPACT]");
OrganizationImpact response = serviceHealthClient.getOrganizationImpact(name);
}
name - Required. Name of the resource using the form
`organizations/{organization_id}/locations/global/organizationImpacts/{organization_impact_id}`.
`organization_id` - ID (number) of the organization that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `organization_impact_id` - ID of the [OrganizationImpact resource](/service-health/docs/reference/rest/v1beta/organizations.locations.organizationImpacts#OrganizationImpact).
com.google.api.gax.rpc.ApiException - if the remote call failspublic final OrganizationImpact getOrganizationImpact(String name)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
String name =
OrganizationImpactName.of("[ORGANIZATION]", "[LOCATION]", "[ORGANIZATION_IMPACT]")
.toString();
OrganizationImpact response = serviceHealthClient.getOrganizationImpact(name);
}
name - Required. Name of the resource using the form
`organizations/{organization_id}/locations/global/organizationImpacts/{organization_impact_id}`.
`organization_id` - ID (number) of the organization that contains the event. To get your `organization_id`, see [Getting your organization resource ID](https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id).<br> `organization_impact_id` - ID of the [OrganizationImpact resource](/service-health/docs/reference/rest/v1beta/organizations.locations.organizationImpacts#OrganizationImpact).
com.google.api.gax.rpc.ApiException - if the remote call failspublic final OrganizationImpact getOrganizationImpact(GetOrganizationImpactRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetOrganizationImpactRequest request =
GetOrganizationImpactRequest.newBuilder()
.setName(
OrganizationImpactName.of("[ORGANIZATION]", "[LOCATION]", "[ORGANIZATION_IMPACT]")
.toString())
.build();
OrganizationImpact response = serviceHealthClient.getOrganizationImpact(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetOrganizationImpactRequest,OrganizationImpact> getOrganizationImpactCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetOrganizationImpactRequest request =
GetOrganizationImpactRequest.newBuilder()
.setName(
OrganizationImpactName.of("[ORGANIZATION]", "[LOCATION]", "[ORGANIZATION_IMPACT]")
.toString())
.build();
ApiFuture<OrganizationImpact> future =
serviceHealthClient.getOrganizationImpactCallable().futureCall(request);
// Do something.
OrganizationImpact response = future.get();
}
public final ServiceHealthClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : serviceHealthClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,ServiceHealthClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
serviceHealthClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = serviceHealthClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = serviceHealthClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample code:
// 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 (ServiceHealthClient serviceHealthClient = ServiceHealthClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = serviceHealthClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.