@Generated(value="by gapic-generator") @BetaApi public class IncidentServiceClient extends Object implements 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:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ArtifactName name = ArtifactName.of("[PROJECT]", "[INCIDENT]", "[ARTIFACT]");
incidentServiceClient.deleteArtifact(name);
}
Note: close() needs to be called on the incidentServiceClient 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:
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 IncidentServiceSettings to create(). For example:
To customize credentials:
IncidentServiceSettings incidentServiceSettings =
IncidentServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
IncidentServiceClient incidentServiceClient =
IncidentServiceClient.create(incidentServiceSettings);
To customize the endpoint:
IncidentServiceSettings incidentServiceSettings =
IncidentServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
IncidentServiceClient incidentServiceClient =
IncidentServiceClient.create(incidentServiceSettings);
| Modifier | Constructor and Description |
|---|---|
protected |
IncidentServiceClient(IncidentServiceSettings settings)
Constructs an instance of IncidentServiceClient, using the given settings.
|
protected |
IncidentServiceClient(IncidentServiceStub stub) |
protected IncidentServiceClient(IncidentServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected IncidentServiceClient(IncidentServiceStub stub)
public static final IncidentServiceClient create() throws IOException
IOExceptionpublic static final IncidentServiceClient create(IncidentServiceSettings settings) throws IOException
IOException@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final IncidentServiceClient create(IncidentServiceStub stub)
public final IncidentServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public IncidentServiceStub getStub()
public final void deleteArtifact(ArtifactName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ArtifactName name = ArtifactName.of("[PROJECT]", "[INCIDENT]", "[ARTIFACT]");
incidentServiceClient.deleteArtifact(name);
}
name - Required. Resource name of the artifact.ApiException - if the remote call failspublic final void deleteArtifact(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ArtifactName name = ArtifactName.of("[PROJECT]", "[INCIDENT]", "[ARTIFACT]");
incidentServiceClient.deleteArtifact(name.toString());
}
name - Required. Resource name of the artifact.ApiException - if the remote call failspublic final void deleteArtifact(DeleteArtifactRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ArtifactName name = ArtifactName.of("[PROJECT]", "[INCIDENT]", "[ARTIFACT]");
DeleteArtifactRequest request = DeleteArtifactRequest.newBuilder()
.setName(name.toString())
.build();
incidentServiceClient.deleteArtifact(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<DeleteArtifactRequest,Empty> deleteArtifactCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ArtifactName name = ArtifactName.of("[PROJECT]", "[INCIDENT]", "[ARTIFACT]");
DeleteArtifactRequest request = DeleteArtifactRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = incidentServiceClient.deleteArtifactCallable().futureCall(request);
// Do something
future.get();
}
public final IncidentRoleAssignment requestIncidentRoleHandover(String name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
String name = "";
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.requestIncidentRoleHandover(name, newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. The proposed assignee.ApiException - if the remote call failspublic final IncidentRoleAssignment requestIncidentRoleHandover(RequestIncidentRoleHandoverRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
String name = "";
User newAssignee = User.newBuilder().build();
RequestIncidentRoleHandoverRequest request = RequestIncidentRoleHandoverRequest.newBuilder()
.setName(name)
.setNewAssignee(newAssignee)
.build();
IncidentRoleAssignment response = incidentServiceClient.requestIncidentRoleHandover(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<RequestIncidentRoleHandoverRequest,IncidentRoleAssignment> requestIncidentRoleHandoverCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
String name = "";
User newAssignee = User.newBuilder().build();
RequestIncidentRoleHandoverRequest request = RequestIncidentRoleHandoverRequest.newBuilder()
.setName(name)
.setNewAssignee(newAssignee)
.build();
ApiFuture<IncidentRoleAssignment> future = incidentServiceClient.requestIncidentRoleHandoverCallable().futureCall(request);
// Do something
IncidentRoleAssignment response = future.get();
}
public final IncidentRoleAssignment confirmIncidentRoleHandover(IncidentRoleAssignmentName name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.confirmIncidentRoleHandover(name, newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. The proposed assignee, who will now be the assignee. This should
be the current user; otherwise ForceRoleHandover should be called.ApiException - if the remote call failspublic final IncidentRoleAssignment confirmIncidentRoleHandover(String name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.confirmIncidentRoleHandover(name.toString(), newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. The proposed assignee, who will now be the assignee. This should
be the current user; otherwise ForceRoleHandover should be called.ApiException - if the remote call failspublic final IncidentRoleAssignment confirmIncidentRoleHandover(ConfirmIncidentRoleHandoverRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
ConfirmIncidentRoleHandoverRequest request = ConfirmIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
IncidentRoleAssignment response = incidentServiceClient.confirmIncidentRoleHandover(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ConfirmIncidentRoleHandoverRequest,IncidentRoleAssignment> confirmIncidentRoleHandoverCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
ConfirmIncidentRoleHandoverRequest request = ConfirmIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
ApiFuture<IncidentRoleAssignment> future = incidentServiceClient.confirmIncidentRoleHandoverCallable().futureCall(request);
// Do something
IncidentRoleAssignment response = future.get();
}
public final IncidentRoleAssignment forceIncidentRoleHandover(IncidentRoleAssignmentName name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.forceIncidentRoleHandover(name, newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. The proposed assignee, who will now be the assignee. This should
not be the current user; otherwise ConfirmRoleHandover should be called.ApiException - if the remote call failspublic final IncidentRoleAssignment forceIncidentRoleHandover(String name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.forceIncidentRoleHandover(name.toString(), newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. The proposed assignee, who will now be the assignee. This should
not be the current user; otherwise ConfirmRoleHandover should be called.ApiException - if the remote call failspublic final IncidentRoleAssignment forceIncidentRoleHandover(ForceIncidentRoleHandoverRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
ForceIncidentRoleHandoverRequest request = ForceIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
IncidentRoleAssignment response = incidentServiceClient.forceIncidentRoleHandover(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ForceIncidentRoleHandoverRequest,IncidentRoleAssignment> forceIncidentRoleHandoverCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
ForceIncidentRoleHandoverRequest request = ForceIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
ApiFuture<IncidentRoleAssignment> future = incidentServiceClient.forceIncidentRoleHandoverCallable().futureCall(request);
// Do something
IncidentRoleAssignment response = future.get();
}
public final Incident createIncident(Incident incident, ProjectName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
ProjectName parent = ProjectName.of("[PROJECT]");
Incident response = incidentServiceClient.createIncident(incident, parent);
}
incident - Required. The incident to create.parent - Required. The resource name of the hosting Stackdriver project which the incident
belongs to. The name is of the form `projects/{project_id_or_number}` .ApiException - if the remote call failspublic final Incident createIncident(Incident incident, String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
ProjectName parent = ProjectName.of("[PROJECT]");
Incident response = incidentServiceClient.createIncident(incident, parent.toString());
}
incident - Required. The incident to create.parent - Required. The resource name of the hosting Stackdriver project which the incident
belongs to. The name is of the form `projects/{project_id_or_number}` .ApiException - if the remote call failspublic final Incident createIncident(CreateIncidentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
ProjectName parent = ProjectName.of("[PROJECT]");
CreateIncidentRequest request = CreateIncidentRequest.newBuilder()
.setIncident(incident)
.setParent(parent.toString())
.build();
Incident response = incidentServiceClient.createIncident(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateIncidentRequest,Incident> createIncidentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
ProjectName parent = ProjectName.of("[PROJECT]");
CreateIncidentRequest request = CreateIncidentRequest.newBuilder()
.setIncident(incident)
.setParent(parent.toString())
.build();
ApiFuture<Incident> future = incidentServiceClient.createIncidentCallable().futureCall(request);
// Do something
Incident response = future.get();
}
public final Incident getIncident(IncidentName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
Incident response = incidentServiceClient.getIncident(name);
}
name - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final Incident getIncident(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
Incident response = incidentServiceClient.getIncident(name.toString());
}
name - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final Incident getIncident(GetIncidentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
GetIncidentRequest request = GetIncidentRequest.newBuilder()
.setName(name.toString())
.build();
Incident response = incidentServiceClient.getIncident(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<GetIncidentRequest,Incident> getIncidentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
GetIncidentRequest request = GetIncidentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Incident> future = incidentServiceClient.getIncidentCallable().futureCall(request);
// Do something
Incident response = future.get();
}
public final IncidentServiceClient.SearchIncidentsPagedResponse searchIncidents(ProjectName parent, String query, String timeZone)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String query = "";
String timeZone = "";
for (Incident element : incidentServiceClient.searchIncidents(parent, query, timeZone).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the hosting Stackdriver project which requested
incidents belong to.query - An expression that defines which incidents to return.
Search atoms can be used to match certain specific fields. Otherwise, plain text will match text fields in the incident.
Search atoms: * `start` - (timestamp) The time the incident started. * `stage` - The stage of the incident, one of detected, triaged, mitigated, resolved, documented, or duplicate (which correspond to values in the Incident.Stage enum). These are ordered, so `stage<resolved` is equivalent to `stage:detected OR stage:triaged OR stage:mitigated`. * `severity` - (Incident.Severity) The severity of the incident. + Supports matching on a specific severity (for example, `severity:major`) or on a range (for example, `severity>medium`, `severity<=minor`, etc.).
Timestamp formats: * yyyy-MM-dd - an absolute date, treated as a calendar-day-wide window. In other words, the "<" operator will match dates before that date, the ">" operator will match dates after that date, and the ":" or "=" operators will match the entire day. * Nd (for example, 7d) - a relative number of days ago, treated as a moment in time (as opposed to a day-wide span). A multiple of 24 hours ago (as opposed to calendar days). In the case of daylight savings time, it will apply the current timezone to both ends of the range. Note that exact matching (for example, `start:7d`) is unlikely to be useful because that would only match incidents created precisely at a particular instant in time.
Examples:
* `foo` - matches incidents containing the word "foo" * `"foo bar"` - matches incidents containing the phrase "foo bar" * `foo bar` or `foo AND bar` - matches incidents containing the words "foo" and "bar" * `foo -bar` or `foo AND NOT bar` - matches incidents containing the word "foo" but not the word "bar" * `foo OR bar` - matches incidents containing the word "foo" or the word "bar" * `start>2018-11-28` - matches incidents which started after November 11, 2018. * `start<=2018-11-28` - matches incidents which started on or before November 11, 2018. * `start:2018-11-28` - matches incidents which started on November 11, 2018. * `start>7d` - matches incidents which started after the point in time 7*24 hours ago * `start>180d` - similar to 7d, but likely to cross the daylight savings time boundary, so the end time will be 1 hour different from "now." * `foo AND start>90d AND stage<resolved` - unresolved incidents from the past 90 days containing the word "foo"
timeZone - The time zone name. It should be an IANA TZ name, such as
"America/Los_Angeles". For more information, see
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If no time zone is specified,
the default is UTC.ApiException - if the remote call failspublic final IncidentServiceClient.SearchIncidentsPagedResponse searchIncidents(String parent, String query, String timeZone)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String query = "";
String timeZone = "";
for (Incident element : incidentServiceClient.searchIncidents(parent.toString(), query, timeZone).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the hosting Stackdriver project which requested
incidents belong to.query - An expression that defines which incidents to return.
Search atoms can be used to match certain specific fields. Otherwise, plain text will match text fields in the incident.
Search atoms: * `start` - (timestamp) The time the incident started. * `stage` - The stage of the incident, one of detected, triaged, mitigated, resolved, documented, or duplicate (which correspond to values in the Incident.Stage enum). These are ordered, so `stage<resolved` is equivalent to `stage:detected OR stage:triaged OR stage:mitigated`. * `severity` - (Incident.Severity) The severity of the incident. + Supports matching on a specific severity (for example, `severity:major`) or on a range (for example, `severity>medium`, `severity<=minor`, etc.).
Timestamp formats: * yyyy-MM-dd - an absolute date, treated as a calendar-day-wide window. In other words, the "<" operator will match dates before that date, the ">" operator will match dates after that date, and the ":" or "=" operators will match the entire day. * Nd (for example, 7d) - a relative number of days ago, treated as a moment in time (as opposed to a day-wide span). A multiple of 24 hours ago (as opposed to calendar days). In the case of daylight savings time, it will apply the current timezone to both ends of the range. Note that exact matching (for example, `start:7d`) is unlikely to be useful because that would only match incidents created precisely at a particular instant in time.
Examples:
* `foo` - matches incidents containing the word "foo" * `"foo bar"` - matches incidents containing the phrase "foo bar" * `foo bar` or `foo AND bar` - matches incidents containing the words "foo" and "bar" * `foo -bar` or `foo AND NOT bar` - matches incidents containing the word "foo" but not the word "bar" * `foo OR bar` - matches incidents containing the word "foo" or the word "bar" * `start>2018-11-28` - matches incidents which started after November 11, 2018. * `start<=2018-11-28` - matches incidents which started on or before November 11, 2018. * `start:2018-11-28` - matches incidents which started on November 11, 2018. * `start>7d` - matches incidents which started after the point in time 7*24 hours ago * `start>180d` - similar to 7d, but likely to cross the daylight savings time boundary, so the end time will be 1 hour different from "now." * `foo AND start>90d AND stage<resolved` - unresolved incidents from the past 90 days containing the word "foo"
timeZone - The time zone name. It should be an IANA TZ name, such as
"America/Los_Angeles". For more information, see
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If no time zone is specified,
the default is UTC.ApiException - if the remote call failspublic final IncidentServiceClient.SearchIncidentsPagedResponse searchIncidents(SearchIncidentsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchIncidentsRequest request = SearchIncidentsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Incident element : incidentServiceClient.searchIncidents(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<SearchIncidentsRequest,IncidentServiceClient.SearchIncidentsPagedResponse> searchIncidentsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchIncidentsRequest request = SearchIncidentsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<SearchIncidentsPagedResponse> future = incidentServiceClient.searchIncidentsPagedCallable().futureCall(request);
// Do something
for (Incident element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<SearchIncidentsRequest,SearchIncidentsResponse> searchIncidentsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchIncidentsRequest request = SearchIncidentsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
SearchIncidentsResponse response = incidentServiceClient.searchIncidentsCallable().call(request);
for (Incident element : response.getIncidentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Incident updateIncident(Incident incident, FieldMask updateMask)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Incident response = incidentServiceClient.updateIncident(incident, updateMask);
}
incident - Required. The incident to update with the new values.updateMask - List of fields that should be updated.ApiException - if the remote call failspublic final Incident updateIncident(UpdateIncidentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
UpdateIncidentRequest request = UpdateIncidentRequest.newBuilder()
.setIncident(incident)
.build();
Incident response = incidentServiceClient.updateIncident(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<UpdateIncidentRequest,Incident> updateIncidentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
UpdateIncidentRequest request = UpdateIncidentRequest.newBuilder()
.setIncident(incident)
.build();
ApiFuture<Incident> future = incidentServiceClient.updateIncidentCallable().futureCall(request);
// Do something
Incident response = future.get();
}
public final IncidentServiceClient.SearchSimilarIncidentsPagedResponse searchSimilarIncidents(IncidentName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (SearchSimilarIncidentsResponse.Result element : incidentServiceClient.searchSimilarIncidents(name).iterateAll()) {
// doThingsWith(element);
}
}
name - Required. Resource name of the incident or signal, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.SearchSimilarIncidentsPagedResponse searchSimilarIncidents(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (SearchSimilarIncidentsResponse.Result element : incidentServiceClient.searchSimilarIncidents(name.toString()).iterateAll()) {
// doThingsWith(element);
}
}
name - Required. Resource name of the incident or signal, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.SearchSimilarIncidentsPagedResponse searchSimilarIncidents(SearchSimilarIncidentsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
SearchSimilarIncidentsRequest request = SearchSimilarIncidentsRequest.newBuilder()
.setName(name.toString())
.build();
for (SearchSimilarIncidentsResponse.Result element : incidentServiceClient.searchSimilarIncidents(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<SearchSimilarIncidentsRequest,IncidentServiceClient.SearchSimilarIncidentsPagedResponse> searchSimilarIncidentsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
SearchSimilarIncidentsRequest request = SearchSimilarIncidentsRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<SearchSimilarIncidentsPagedResponse> future = incidentServiceClient.searchSimilarIncidentsPagedCallable().futureCall(request);
// Do something
for (SearchSimilarIncidentsResponse.Result element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<SearchSimilarIncidentsRequest,SearchSimilarIncidentsResponse> searchSimilarIncidentsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
SearchSimilarIncidentsRequest request = SearchSimilarIncidentsRequest.newBuilder()
.setName(name.toString())
.build();
while (true) {
SearchSimilarIncidentsResponse response = incidentServiceClient.searchSimilarIncidentsCallable().call(request);
for (SearchSimilarIncidentsResponse.Result element : response.getResultsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Annotation createAnnotation(IncidentName parent, Annotation annotation)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Annotation annotation = Annotation.newBuilder().build();
Annotation response = incidentServiceClient.createAnnotation(parent, annotation);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".annotation - Required. Only annotation.content is an input argument.ApiException - if the remote call failspublic final Annotation createAnnotation(String parent, Annotation annotation)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Annotation annotation = Annotation.newBuilder().build();
Annotation response = incidentServiceClient.createAnnotation(parent.toString(), annotation);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".annotation - Required. Only annotation.content is an input argument.ApiException - if the remote call failspublic final Annotation createAnnotation(CreateAnnotationRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Annotation annotation = Annotation.newBuilder().build();
CreateAnnotationRequest request = CreateAnnotationRequest.newBuilder()
.setParent(parent.toString())
.setAnnotation(annotation)
.build();
Annotation response = incidentServiceClient.createAnnotation(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateAnnotationRequest,Annotation> createAnnotationCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Annotation annotation = Annotation.newBuilder().build();
CreateAnnotationRequest request = CreateAnnotationRequest.newBuilder()
.setParent(parent.toString())
.setAnnotation(annotation)
.build();
ApiFuture<Annotation> future = incidentServiceClient.createAnnotationCallable().futureCall(request);
// Do something
Annotation response = future.get();
}
public final IncidentServiceClient.ListAnnotationsPagedResponse listAnnotations(IncidentName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Annotation element : incidentServiceClient.listAnnotations(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListAnnotationsPagedResponse listAnnotations(String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Annotation element : incidentServiceClient.listAnnotations(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListAnnotationsPagedResponse listAnnotations(ListAnnotationsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListAnnotationsRequest request = ListAnnotationsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Annotation element : incidentServiceClient.listAnnotations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ListAnnotationsRequest,IncidentServiceClient.ListAnnotationsPagedResponse> listAnnotationsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListAnnotationsRequest request = ListAnnotationsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListAnnotationsPagedResponse> future = incidentServiceClient.listAnnotationsPagedCallable().futureCall(request);
// Do something
for (Annotation element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListAnnotationsRequest,ListAnnotationsResponse> listAnnotationsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListAnnotationsRequest request = ListAnnotationsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListAnnotationsResponse response = incidentServiceClient.listAnnotationsCallable().call(request);
for (Annotation element : response.getAnnotationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Tag createTag(IncidentName parent, Tag tag)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Tag tag = Tag.newBuilder().build();
Tag response = incidentServiceClient.createTag(parent, tag);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".tag - Required. Tag to create. Only tag.display_name is an input argument.ApiException - if the remote call failspublic final Tag createTag(String parent, Tag tag)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Tag tag = Tag.newBuilder().build();
Tag response = incidentServiceClient.createTag(parent.toString(), tag);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".tag - Required. Tag to create. Only tag.display_name is an input argument.ApiException - if the remote call failspublic final Tag createTag(CreateTagRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Tag tag = Tag.newBuilder().build();
CreateTagRequest request = CreateTagRequest.newBuilder()
.setParent(parent.toString())
.setTag(tag)
.build();
Tag response = incidentServiceClient.createTag(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateTagRequest,Tag> createTagCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Tag tag = Tag.newBuilder().build();
CreateTagRequest request = CreateTagRequest.newBuilder()
.setParent(parent.toString())
.setTag(tag)
.build();
ApiFuture<Tag> future = incidentServiceClient.createTagCallable().futureCall(request);
// Do something
Tag response = future.get();
}
public final void deleteTag(TagName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
TagName name = TagName.of("[PROJECT]", "[INCIDENT]", "[TAG]");
incidentServiceClient.deleteTag(name);
}
name - Required. Resource name of the tag.ApiException - if the remote call failspublic final void deleteTag(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
TagName name = TagName.of("[PROJECT]", "[INCIDENT]", "[TAG]");
incidentServiceClient.deleteTag(name.toString());
}
name - Required. Resource name of the tag.ApiException - if the remote call failspublic final void deleteTag(DeleteTagRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
TagName name = TagName.of("[PROJECT]", "[INCIDENT]", "[TAG]");
DeleteTagRequest request = DeleteTagRequest.newBuilder()
.setName(name.toString())
.build();
incidentServiceClient.deleteTag(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<DeleteTagRequest,Empty> deleteTagCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
TagName name = TagName.of("[PROJECT]", "[INCIDENT]", "[TAG]");
DeleteTagRequest request = DeleteTagRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = incidentServiceClient.deleteTagCallable().futureCall(request);
// Do something
future.get();
}
public final IncidentServiceClient.ListTagsPagedResponse listTags(IncidentName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Tag element : incidentServiceClient.listTags(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListTagsPagedResponse listTags(String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Tag element : incidentServiceClient.listTags(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListTagsPagedResponse listTags(ListTagsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListTagsRequest request = ListTagsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Tag element : incidentServiceClient.listTags(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ListTagsRequest,IncidentServiceClient.ListTagsPagedResponse> listTagsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListTagsRequest request = ListTagsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListTagsPagedResponse> future = incidentServiceClient.listTagsPagedCallable().futureCall(request);
// Do something
for (Tag element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListTagsRequest,ListTagsResponse> listTagsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListTagsRequest request = ListTagsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListTagsResponse response = incidentServiceClient.listTagsCallable().call(request);
for (Tag element : response.getTagsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Signal createSignal(ProjectName parent, Signal signal)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Signal signal = Signal.newBuilder().build();
Signal response = incidentServiceClient.createSignal(parent, signal);
}
parent - Required. The resource name of the hosting Stackdriver project which requested
signal belongs to.signal - Required. The signal to create.ApiException - if the remote call failspublic final Signal createSignal(String parent, Signal signal)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Signal signal = Signal.newBuilder().build();
Signal response = incidentServiceClient.createSignal(parent.toString(), signal);
}
parent - Required. The resource name of the hosting Stackdriver project which requested
signal belongs to.signal - Required. The signal to create.ApiException - if the remote call failspublic final Signal createSignal(CreateSignalRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Signal signal = Signal.newBuilder().build();
CreateSignalRequest request = CreateSignalRequest.newBuilder()
.setParent(parent.toString())
.setSignal(signal)
.build();
Signal response = incidentServiceClient.createSignal(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateSignalRequest,Signal> createSignalCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
Signal signal = Signal.newBuilder().build();
CreateSignalRequest request = CreateSignalRequest.newBuilder()
.setParent(parent.toString())
.setSignal(signal)
.build();
ApiFuture<Signal> future = incidentServiceClient.createSignalCallable().futureCall(request);
// Do something
Signal response = future.get();
}
public final IncidentServiceClient.SearchSignalsPagedResponse searchSignals(ProjectName parent, String query)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String query = "";
for (Signal element : incidentServiceClient.searchSignals(parent, query).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the hosting Stackdriver project which requested
incidents belong to.query - An expression that defines which signals to return.
Search atoms can be used to match certain specific fields. Otherwise, plain text will match text fields in the signal.
Search atoms:
* `start` - (timestamp) The time the signal was created. * `title` - The title of the signal. * `signal_state` - `open` or `closed`. State of the signal. (e.g., `signal_state:open`)
Timestamp formats:
* yyyy-MM-dd - an absolute date, treated as a calendar-day-wide window. In other words, the "<" operator will match dates before that date, the ">" operator will match dates after that date, and the ":" operator will match the entire day. * yyyy-MM-ddTHH:mm - Same as above, but with minute resolution. * yyyy-MM-ddTHH:mm:ss - Same as above, but with second resolution. * Nd (e.g. 7d) - a relative number of days ago, treated as a moment in time (as opposed to a day-wide span) a multiple of 24 hours ago (as opposed to calendar days). In the case of daylight savings time, it will apply the current timezone to both ends of the range. Note that exact matching (e.g. `start:7d`) is unlikely to be useful because that would only match signals created precisely at a particular instant in time.
The absolute timestamp formats (everything starting with a year) can optionally be followed with a UTC offset in +/-hh:mm format. Also, the 'T' separating dates and times can optionally be replaced with a space. Note that any timestamp containing a space or colon will need to be quoted.
Examples:
* `foo` - matches signals containing the word "foo" * `"foo bar"` - matches signals containing the phrase "foo bar" * `foo bar` or `foo AND bar` - matches signals containing the words "foo" and "bar" * `foo -bar` or `foo AND NOT bar` - matches signals containing the word "foo" but not the word "bar" * `foo OR bar` - matches signals containing the word "foo" or the word "bar" * `start>2018-11-28` - matches signals which started after November 11, 2018. * `start<=2018-11-28` - matches signals which started on or before November 11, 2018. * `start:2018-11-28` - matches signals which started on November 11, 2018. * `start>"2018-11-28 01:02:03+04:00"` - matches signals which started after November 11, 2018 at 1:02:03 AM according to the UTC+04 time zone. * `start>7d` - matches signals which started after the point in time 7*24 hours ago * `start>180d` - similar to 7d, but likely to cross the daylight savings time boundary, so the end time will be 1 hour different from "now." * `foo AND start>90d AND stage<resolved` - unresolved signals from the past 90 days containing the word "foo"
ApiException - if the remote call failspublic final IncidentServiceClient.SearchSignalsPagedResponse searchSignals(String parent, String query)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String query = "";
for (Signal element : incidentServiceClient.searchSignals(parent.toString(), query).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the hosting Stackdriver project which requested
incidents belong to.query - An expression that defines which signals to return.
Search atoms can be used to match certain specific fields. Otherwise, plain text will match text fields in the signal.
Search atoms:
* `start` - (timestamp) The time the signal was created. * `title` - The title of the signal. * `signal_state` - `open` or `closed`. State of the signal. (e.g., `signal_state:open`)
Timestamp formats:
* yyyy-MM-dd - an absolute date, treated as a calendar-day-wide window. In other words, the "<" operator will match dates before that date, the ">" operator will match dates after that date, and the ":" operator will match the entire day. * yyyy-MM-ddTHH:mm - Same as above, but with minute resolution. * yyyy-MM-ddTHH:mm:ss - Same as above, but with second resolution. * Nd (e.g. 7d) - a relative number of days ago, treated as a moment in time (as opposed to a day-wide span) a multiple of 24 hours ago (as opposed to calendar days). In the case of daylight savings time, it will apply the current timezone to both ends of the range. Note that exact matching (e.g. `start:7d`) is unlikely to be useful because that would only match signals created precisely at a particular instant in time.
The absolute timestamp formats (everything starting with a year) can optionally be followed with a UTC offset in +/-hh:mm format. Also, the 'T' separating dates and times can optionally be replaced with a space. Note that any timestamp containing a space or colon will need to be quoted.
Examples:
* `foo` - matches signals containing the word "foo" * `"foo bar"` - matches signals containing the phrase "foo bar" * `foo bar` or `foo AND bar` - matches signals containing the words "foo" and "bar" * `foo -bar` or `foo AND NOT bar` - matches signals containing the word "foo" but not the word "bar" * `foo OR bar` - matches signals containing the word "foo" or the word "bar" * `start>2018-11-28` - matches signals which started after November 11, 2018. * `start<=2018-11-28` - matches signals which started on or before November 11, 2018. * `start:2018-11-28` - matches signals which started on November 11, 2018. * `start>"2018-11-28 01:02:03+04:00"` - matches signals which started after November 11, 2018 at 1:02:03 AM according to the UTC+04 time zone. * `start>7d` - matches signals which started after the point in time 7*24 hours ago * `start>180d` - similar to 7d, but likely to cross the daylight savings time boundary, so the end time will be 1 hour different from "now." * `foo AND start>90d AND stage<resolved` - unresolved signals from the past 90 days containing the word "foo"
ApiException - if the remote call failspublic final IncidentServiceClient.SearchSignalsPagedResponse searchSignals(SearchSignalsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchSignalsRequest request = SearchSignalsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Signal element : incidentServiceClient.searchSignals(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<SearchSignalsRequest,IncidentServiceClient.SearchSignalsPagedResponse> searchSignalsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchSignalsRequest request = SearchSignalsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<SearchSignalsPagedResponse> future = incidentServiceClient.searchSignalsPagedCallable().futureCall(request);
// Do something
for (Signal element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<SearchSignalsRequest,SearchSignalsResponse> searchSignalsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
SearchSignalsRequest request = SearchSignalsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
SearchSignalsResponse response = incidentServiceClient.searchSignalsCallable().call(request);
for (Signal element : response.getSignalsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Signal lookupSignal(LookupSignalRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
LookupSignalRequest request = LookupSignalRequest.newBuilder().build();
Signal response = incidentServiceClient.lookupSignal(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<LookupSignalRequest,Signal> lookupSignalCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
LookupSignalRequest request = LookupSignalRequest.newBuilder().build();
ApiFuture<Signal> future = incidentServiceClient.lookupSignalCallable().futureCall(request);
// Do something
Signal response = future.get();
}
public final Signal getSignal(SignalName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SignalName name = SignalName.of("[PROJECT]", "[SIGNAL]");
Signal response = incidentServiceClient.getSignal(name);
}
name - Required. Resource name of the Signal resource, for example,
"projects/{project_id_or_number}/signals/{signal_id}".ApiException - if the remote call failspublic final Signal getSignal(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SignalName name = SignalName.of("[PROJECT]", "[SIGNAL]");
Signal response = incidentServiceClient.getSignal(name.toString());
}
name - Required. Resource name of the Signal resource, for example,
"projects/{project_id_or_number}/signals/{signal_id}".ApiException - if the remote call failspublic final Signal getSignal(GetSignalRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SignalName name = SignalName.of("[PROJECT]", "[SIGNAL]");
GetSignalRequest request = GetSignalRequest.newBuilder()
.setName(name.toString())
.build();
Signal response = incidentServiceClient.getSignal(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<GetSignalRequest,Signal> getSignalCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SignalName name = SignalName.of("[PROJECT]", "[SIGNAL]");
GetSignalRequest request = GetSignalRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Signal> future = incidentServiceClient.getSignalCallable().futureCall(request);
// Do something
Signal response = future.get();
}
public final Signal updateSignal(Signal signal, FieldMask updateMask)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Signal signal = Signal.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Signal response = incidentServiceClient.updateSignal(signal, updateMask);
}
signal - Required. The signal to update with the new values.updateMask - List of fields that should be updated.ApiException - if the remote call failspublic final Signal updateSignal(UpdateSignalRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Signal signal = Signal.newBuilder().build();
UpdateSignalRequest request = UpdateSignalRequest.newBuilder()
.setSignal(signal)
.build();
Signal response = incidentServiceClient.updateSignal(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<UpdateSignalRequest,Signal> updateSignalCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Signal signal = Signal.newBuilder().build();
UpdateSignalRequest request = UpdateSignalRequest.newBuilder()
.setSignal(signal)
.build();
ApiFuture<Signal> future = incidentServiceClient.updateSignalCallable().futureCall(request);
// Do something
Signal response = future.get();
}
public final EscalateIncidentResponse escalateIncident(EscalateIncidentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
EscalateIncidentRequest request = EscalateIncidentRequest.newBuilder()
.setIncident(incident)
.build();
EscalateIncidentResponse response = incidentServiceClient.escalateIncident(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<EscalateIncidentRequest,EscalateIncidentResponse> escalateIncidentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Incident incident = Incident.newBuilder().build();
EscalateIncidentRequest request = EscalateIncidentRequest.newBuilder()
.setIncident(incident)
.build();
ApiFuture<EscalateIncidentResponse> future = incidentServiceClient.escalateIncidentCallable().futureCall(request);
// Do something
EscalateIncidentResponse response = future.get();
}
public final Artifact createArtifact(IncidentName parent, Artifact artifact)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Artifact artifact = Artifact.newBuilder().build();
Artifact response = incidentServiceClient.createArtifact(parent, artifact);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".artifact - Required. The artifact to create.ApiException - if the remote call failspublic final Artifact createArtifact(String parent, Artifact artifact)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Artifact artifact = Artifact.newBuilder().build();
Artifact response = incidentServiceClient.createArtifact(parent.toString(), artifact);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".artifact - Required. The artifact to create.ApiException - if the remote call failspublic final Artifact createArtifact(CreateArtifactRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Artifact artifact = Artifact.newBuilder().build();
CreateArtifactRequest request = CreateArtifactRequest.newBuilder()
.setParent(parent.toString())
.setArtifact(artifact)
.build();
Artifact response = incidentServiceClient.createArtifact(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateArtifactRequest,Artifact> createArtifactCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Artifact artifact = Artifact.newBuilder().build();
CreateArtifactRequest request = CreateArtifactRequest.newBuilder()
.setParent(parent.toString())
.setArtifact(artifact)
.build();
ApiFuture<Artifact> future = incidentServiceClient.createArtifactCallable().futureCall(request);
// Do something
Artifact response = future.get();
}
public final IncidentServiceClient.ListArtifactsPagedResponse listArtifacts(IncidentName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Artifact element : incidentServiceClient.listArtifacts(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListArtifactsPagedResponse listArtifacts(String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Artifact element : incidentServiceClient.listArtifacts(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListArtifactsPagedResponse listArtifacts(ListArtifactsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListArtifactsRequest request = ListArtifactsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Artifact element : incidentServiceClient.listArtifacts(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ListArtifactsRequest,IncidentServiceClient.ListArtifactsPagedResponse> listArtifactsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListArtifactsRequest request = ListArtifactsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListArtifactsPagedResponse> future = incidentServiceClient.listArtifactsPagedCallable().futureCall(request);
// Do something
for (Artifact element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListArtifactsRequest,ListArtifactsResponse> listArtifactsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListArtifactsRequest request = ListArtifactsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListArtifactsResponse response = incidentServiceClient.listArtifactsCallable().call(request);
for (Artifact element : response.getArtifactsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Artifact updateArtifact(Artifact artifact, FieldMask updateMask)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Artifact artifact = Artifact.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Artifact response = incidentServiceClient.updateArtifact(artifact, updateMask);
}
artifact - Required. The artifact to update with the new values.updateMask - List of fields that should be updated.ApiException - if the remote call failspublic final Artifact updateArtifact(UpdateArtifactRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Artifact artifact = Artifact.newBuilder().build();
UpdateArtifactRequest request = UpdateArtifactRequest.newBuilder()
.setArtifact(artifact)
.build();
Artifact response = incidentServiceClient.updateArtifact(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<UpdateArtifactRequest,Artifact> updateArtifactCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Artifact artifact = Artifact.newBuilder().build();
UpdateArtifactRequest request = UpdateArtifactRequest.newBuilder()
.setArtifact(artifact)
.build();
ApiFuture<Artifact> future = incidentServiceClient.updateArtifactCallable().futureCall(request);
// Do something
Artifact response = future.get();
}
public final SendShiftHandoffResponse sendShiftHandoff(SendShiftHandoffRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
List<String> recipients = new ArrayList<>();
String subject = "";
SendShiftHandoffRequest request = SendShiftHandoffRequest.newBuilder()
.setParent(parent.toString())
.addAllRecipients(recipients)
.setSubject(subject)
.build();
SendShiftHandoffResponse response = incidentServiceClient.sendShiftHandoff(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<SendShiftHandoffRequest,SendShiftHandoffResponse> sendShiftHandoffCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
List<String> recipients = new ArrayList<>();
String subject = "";
SendShiftHandoffRequest request = SendShiftHandoffRequest.newBuilder()
.setParent(parent.toString())
.addAllRecipients(recipients)
.setSubject(subject)
.build();
ApiFuture<SendShiftHandoffResponse> future = incidentServiceClient.sendShiftHandoffCallable().futureCall(request);
// Do something
SendShiftHandoffResponse response = future.get();
}
public final Subscription createSubscription(IncidentName parent, Subscription subscription)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Subscription subscription = Subscription.newBuilder().build();
Subscription response = incidentServiceClient.createSubscription(parent, subscription);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".subscription - Required. The subscription to create.ApiException - if the remote call failspublic final Subscription createSubscription(String parent, Subscription subscription)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Subscription subscription = Subscription.newBuilder().build();
Subscription response = incidentServiceClient.createSubscription(parent.toString(), subscription);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".subscription - Required. The subscription to create.ApiException - if the remote call failspublic final Subscription createSubscription(CreateSubscriptionRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Subscription subscription = Subscription.newBuilder().build();
CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder()
.setParent(parent.toString())
.setSubscription(subscription)
.build();
Subscription response = incidentServiceClient.createSubscription(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateSubscriptionRequest,Subscription> createSubscriptionCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
Subscription subscription = Subscription.newBuilder().build();
CreateSubscriptionRequest request = CreateSubscriptionRequest.newBuilder()
.setParent(parent.toString())
.setSubscription(subscription)
.build();
ApiFuture<Subscription> future = incidentServiceClient.createSubscriptionCallable().futureCall(request);
// Do something
Subscription response = future.get();
}
public final Subscription updateSubscription(Subscription subscription, FieldMask updateMask)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Subscription subscription = Subscription.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Subscription response = incidentServiceClient.updateSubscription(subscription, updateMask);
}
subscription - Required. The subscription to update, with new values.updateMask - List of fields that should be updated.ApiException - if the remote call failspublic final Subscription updateSubscription(UpdateSubscriptionRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Subscription subscription = Subscription.newBuilder().build();
UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder()
.setSubscription(subscription)
.build();
Subscription response = incidentServiceClient.updateSubscription(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<UpdateSubscriptionRequest,Subscription> updateSubscriptionCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
Subscription subscription = Subscription.newBuilder().build();
UpdateSubscriptionRequest request = UpdateSubscriptionRequest.newBuilder()
.setSubscription(subscription)
.build();
ApiFuture<Subscription> future = incidentServiceClient.updateSubscriptionCallable().futureCall(request);
// Do something
Subscription response = future.get();
}
public final IncidentServiceClient.ListSubscriptionsPagedResponse listSubscriptions(IncidentName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Subscription element : incidentServiceClient.listSubscriptions(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListSubscriptionsPagedResponse listSubscriptions(String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (Subscription element : incidentServiceClient.listSubscriptions(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (Subscription element : incidentServiceClient.listSubscriptions(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ListSubscriptionsRequest,IncidentServiceClient.ListSubscriptionsPagedResponse> listSubscriptionsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListSubscriptionsPagedResponse> future = incidentServiceClient.listSubscriptionsPagedCallable().futureCall(request);
// Do something
for (Subscription element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListSubscriptionsRequest,ListSubscriptionsResponse> listSubscriptionsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListSubscriptionsRequest request = ListSubscriptionsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListSubscriptionsResponse response = incidentServiceClient.listSubscriptionsCallable().call(request);
for (Subscription element : response.getSubscriptionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void deleteSubscription(SubscriptionName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[PROJECT]", "[INCIDENT]", "[SUBSCRIPTION]");
incidentServiceClient.deleteSubscription(name);
}
name - Required. Resource name of the subscription.ApiException - if the remote call failspublic final void deleteSubscription(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[PROJECT]", "[INCIDENT]", "[SUBSCRIPTION]");
incidentServiceClient.deleteSubscription(name.toString());
}
name - Required. Resource name of the subscription.ApiException - if the remote call failspublic final void deleteSubscription(DeleteSubscriptionRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[PROJECT]", "[INCIDENT]", "[SUBSCRIPTION]");
DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
.setName(name.toString())
.build();
incidentServiceClient.deleteSubscription(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<DeleteSubscriptionRequest,Empty> deleteSubscriptionCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
SubscriptionName name = SubscriptionName.of("[PROJECT]", "[INCIDENT]", "[SUBSCRIPTION]");
DeleteSubscriptionRequest request = DeleteSubscriptionRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = incidentServiceClient.deleteSubscriptionCallable().futureCall(request);
// Do something
future.get();
}
public final IncidentRoleAssignment createIncidentRoleAssignment(IncidentName parent, IncidentRoleAssignment incidentRoleAssignment)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
IncidentRoleAssignment incidentRoleAssignment = IncidentRoleAssignment.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.createIncidentRoleAssignment(parent, incidentRoleAssignment);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".incidentRoleAssignment - Required. Role assignment to create.ApiException - if the remote call failspublic final IncidentRoleAssignment createIncidentRoleAssignment(String parent, IncidentRoleAssignment incidentRoleAssignment)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
IncidentRoleAssignment incidentRoleAssignment = IncidentRoleAssignment.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.createIncidentRoleAssignment(parent.toString(), incidentRoleAssignment);
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".incidentRoleAssignment - Required. Role assignment to create.ApiException - if the remote call failspublic final IncidentRoleAssignment createIncidentRoleAssignment(CreateIncidentRoleAssignmentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
IncidentRoleAssignment incidentRoleAssignment = IncidentRoleAssignment.newBuilder().build();
CreateIncidentRoleAssignmentRequest request = CreateIncidentRoleAssignmentRequest.newBuilder()
.setParent(parent.toString())
.setIncidentRoleAssignment(incidentRoleAssignment)
.build();
IncidentRoleAssignment response = incidentServiceClient.createIncidentRoleAssignment(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CreateIncidentRoleAssignmentRequest,IncidentRoleAssignment> createIncidentRoleAssignmentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
IncidentRoleAssignment incidentRoleAssignment = IncidentRoleAssignment.newBuilder().build();
CreateIncidentRoleAssignmentRequest request = CreateIncidentRoleAssignmentRequest.newBuilder()
.setParent(parent.toString())
.setIncidentRoleAssignment(incidentRoleAssignment)
.build();
ApiFuture<IncidentRoleAssignment> future = incidentServiceClient.createIncidentRoleAssignmentCallable().futureCall(request);
// Do something
IncidentRoleAssignment response = future.get();
}
public final void deleteIncidentRoleAssignment(IncidentName name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
incidentServiceClient.deleteIncidentRoleAssignment(name);
}
name - Required. Resource name of the role assignment.ApiException - if the remote call failspublic final void deleteIncidentRoleAssignment(String name)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
incidentServiceClient.deleteIncidentRoleAssignment(name.toString());
}
name - Required. Resource name of the role assignment.ApiException - if the remote call failspublic final void deleteIncidentRoleAssignment(DeleteIncidentRoleAssignmentRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
DeleteIncidentRoleAssignmentRequest request = DeleteIncidentRoleAssignmentRequest.newBuilder()
.setName(name.toString())
.build();
incidentServiceClient.deleteIncidentRoleAssignment(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<DeleteIncidentRoleAssignmentRequest,Empty> deleteIncidentRoleAssignmentCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName name = IncidentName.of("[PROJECT]", "[INCIDENT]");
DeleteIncidentRoleAssignmentRequest request = DeleteIncidentRoleAssignmentRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = incidentServiceClient.deleteIncidentRoleAssignmentCallable().futureCall(request);
// Do something
future.get();
}
public final IncidentServiceClient.ListIncidentRoleAssignmentsPagedResponse listIncidentRoleAssignments(IncidentName parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (IncidentRoleAssignment element : incidentServiceClient.listIncidentRoleAssignments(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListIncidentRoleAssignmentsPagedResponse listIncidentRoleAssignments(String parent)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
for (IncidentRoleAssignment element : incidentServiceClient.listIncidentRoleAssignments(parent.toString()).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. Resource name of the incident, for example,
"projects/{project_id_or_number}/incidents/{incident_id}".ApiException - if the remote call failspublic final IncidentServiceClient.ListIncidentRoleAssignmentsPagedResponse listIncidentRoleAssignments(ListIncidentRoleAssignmentsRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListIncidentRoleAssignmentsRequest request = ListIncidentRoleAssignmentsRequest.newBuilder()
.setParent(parent.toString())
.build();
for (IncidentRoleAssignment element : incidentServiceClient.listIncidentRoleAssignments(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<ListIncidentRoleAssignmentsRequest,IncidentServiceClient.ListIncidentRoleAssignmentsPagedResponse> listIncidentRoleAssignmentsPagedCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListIncidentRoleAssignmentsRequest request = ListIncidentRoleAssignmentsRequest.newBuilder()
.setParent(parent.toString())
.build();
ApiFuture<ListIncidentRoleAssignmentsPagedResponse> future = incidentServiceClient.listIncidentRoleAssignmentsPagedCallable().futureCall(request);
// Do something
for (IncidentRoleAssignment element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final UnaryCallable<ListIncidentRoleAssignmentsRequest,ListIncidentRoleAssignmentsResponse> listIncidentRoleAssignmentsCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentName parent = IncidentName.of("[PROJECT]", "[INCIDENT]");
ListIncidentRoleAssignmentsRequest request = ListIncidentRoleAssignmentsRequest.newBuilder()
.setParent(parent.toString())
.build();
while (true) {
ListIncidentRoleAssignmentsResponse response = incidentServiceClient.listIncidentRoleAssignmentsCallable().call(request);
for (IncidentRoleAssignment element : response.getIncidentRoleAssignmentsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final IncidentRoleAssignment cancelIncidentRoleHandover(IncidentRoleAssignmentName name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.cancelIncidentRoleHandover(name, newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. Person who was proposed as the next assignee (i.e.
IncidentRoleAssignment.proposed_assignee) and whose proposal is being cancelled.ApiException - if the remote call failspublic final IncidentRoleAssignment cancelIncidentRoleHandover(String name, User newAssignee)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
IncidentRoleAssignment response = incidentServiceClient.cancelIncidentRoleHandover(name.toString(), newAssignee);
}
name - Required. Resource name of the role assignment.newAssignee - Required. Person who was proposed as the next assignee (i.e.
IncidentRoleAssignment.proposed_assignee) and whose proposal is being cancelled.ApiException - if the remote call failspublic final IncidentRoleAssignment cancelIncidentRoleHandover(CancelIncidentRoleHandoverRequest request)
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
CancelIncidentRoleHandoverRequest request = CancelIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
IncidentRoleAssignment response = incidentServiceClient.cancelIncidentRoleHandover(request);
}
request - The request object containing all of the parameters for the API call.ApiException - if the remote call failspublic final UnaryCallable<CancelIncidentRoleHandoverRequest,IncidentRoleAssignment> cancelIncidentRoleHandoverCallable()
Sample code:
try (IncidentServiceClient incidentServiceClient = IncidentServiceClient.create()) {
IncidentRoleAssignmentName name = IncidentRoleAssignmentName.of("[PROJECT_ID_OR_NUMBER]", "[INCIDENT_ID]", "[ROLE_ID]");
User newAssignee = User.newBuilder().build();
CancelIncidentRoleHandoverRequest request = CancelIncidentRoleHandoverRequest.newBuilder()
.setName(name.toString())
.setNewAssignee(newAssignee)
.build();
ApiFuture<IncidentRoleAssignment> future = incidentServiceClient.cancelIncidentRoleHandoverCallable().futureCall(request);
// Do something
IncidentRoleAssignment response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface BackgroundResourcepublic boolean isShutdown()
isShutdown in interface BackgroundResourcepublic boolean isTerminated()
isTerminated in interface BackgroundResourcepublic void shutdownNow()
shutdownNow in interface BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface BackgroundResourceInterruptedExceptionCopyright © 2020 Google LLC. All rights reserved.