Client for Stackdriver Incident Response & Management API

class google.cloud.irm_v1alpha2.IncidentServiceClient(transport=None, channel=None, credentials=None, client_config=None, client_info=None)[source]

The Incident API for Incident Response & Management.

Constructor.

Parameters
  • (Union[IncidentServiceGrpcTransport, (transport) – Callable[[~.Credentials, type], ~.IncidentServiceGrpcTransport]): A transport instance, responsible for actually making the API calls. The default transport uses the gRPC protocol. This argument may also be a callable which returns a transport instance. Callables will be sent the credentials as the first argument and the default transport class as the second argument.

  • channel (grpc.Channel) – DEPRECATED. A Channel instance through which to make calls. This argument is mutually exclusive with credentials; providing both will raise an exception.

  • credentials (google.auth.credentials.Credentials) – The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to transport; doing so will raise an exception.

  • client_config (dict) – DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used.

  • client_info (google.api_core.gapic_v1.client_info.ClientInfo) – The client info used to send a user-agent string along with API requests. If None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

classmethod annotation_path(project, incident, annotation)[source]

Return a fully-qualified annotation string.

classmethod artifact_path(project, incident, artifact)[source]

Return a fully-qualified artifact string.

cancel_incident_role_handover(name, new_assignee, retry=<object object>, timeout=<object object>, metadata=None)[source]

Cancels a role handover. This will fail if the ‘proposed_assignee’ field of the IncidentRoleAssignment is not equal to the ‘new_assignee’ field of the request.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.role_assignment_path('[PROJECT]', '[INCIDENT]', '[ROLE_ASSIGNMENT]')
>>>
>>> # TODO: Initialize `new_assignee`:
>>> new_assignee = {}
>>>
>>> response = client.cancel_incident_role_handover(name, new_assignee)
Parameters
  • name (str) – Resource name of the role assignment.

  • new_assignee (Union[dict, User]) –

    Person who was proposed as the next assignee (i.e. IncidentRoleAssignment.proposed_assignee) and whose proposal is being cancelled.

    If a dict is provided, it must be of the same form as the protobuf message User

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A IncidentRoleAssignment instance.

Raises
confirm_incident_role_handover(name, new_assignee, retry=<object object>, timeout=<object object>, metadata=None)[source]

Confirms a role handover. This will fail if the ‘proposed_assignee’ field of the IncidentRoleAssignment is not equal to the ‘new_assignee’ field of the request. If the caller is not the new_assignee, ForceIncidentRoleHandover should be used instead.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.role_assignment_path('[PROJECT]', '[INCIDENT]', '[ROLE_ASSIGNMENT]')
>>>
>>> # TODO: Initialize `new_assignee`:
>>> new_assignee = {}
>>>
>>> response = client.confirm_incident_role_handover(name, new_assignee)
Parameters
  • name (str) – Resource name of the role assignment.

  • new_assignee (Union[dict, User]) –

    The proposed assignee, who will now be the assignee. This should be the current user; otherwise ForceRoleHandover should be called.

    If a dict is provided, it must be of the same form as the protobuf message User

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A IncidentRoleAssignment instance.

Raises
create_annotation(parent, annotation, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates an annotation on an existing incident. Only ‘text/plain’ and ‘text/markdown’ annotations can be created via this method.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # TODO: Initialize `annotation`:
>>> annotation = {}
>>>
>>> response = client.create_annotation(parent, annotation)
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • annotation (Union[dict, Annotation]) –

    Only annotation.content is an input argument.

    If a dict is provided, it must be of the same form as the protobuf message Annotation

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Annotation instance.

Raises
create_artifact(parent, artifact, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a new artifact.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # TODO: Initialize `artifact`:
>>> artifact = {}
>>>
>>> response = client.create_artifact(parent, artifact)
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • artifact (Union[dict, Artifact]) –

    The artifact to create.

    If a dict is provided, it must be of the same form as the protobuf message Artifact

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Artifact instance.

Raises
create_incident(incident, parent, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a new incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `incident`:
>>> incident = {}
>>> parent = client.project_path('[PROJECT]')
>>>
>>> response = client.create_incident(incident, parent)
Parameters
  • incident (Union[dict, Incident]) –

    The incident to create.

    If a dict is provided, it must be of the same form as the protobuf message Incident

  • parent (str) – The resource name of the hosting Stackdriver project which the incident belongs to. The name is of the form projects/{project_id_or_number} .

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Incident instance.

Raises
create_incident_role_assignment(parent, incident_role_assignment, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a role assignment on an existing incident. Normally, the user field will be set when assigning a role to oneself, and the next field will be set when proposing another user as the assignee. Setting the next field directly to a user other than oneself is equivalent to proposing and force-assigning the role to the user.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # TODO: Initialize `incident_role_assignment`:
>>> incident_role_assignment = {}
>>>
>>> response = client.create_incident_role_assignment(parent, incident_role_assignment)
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • incident_role_assignment (Union[dict, IncidentRoleAssignment]) –

    Role assignment to create.

    If a dict is provided, it must be of the same form as the protobuf message IncidentRoleAssignment

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A IncidentRoleAssignment instance.

Raises
create_signal(parent, signal, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a new signal.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize `signal`:
>>> signal = {}
>>>
>>> response = client.create_signal(parent, signal)
Parameters
  • parent (str) – The resource name of the hosting Stackdriver project which requested signal belongs to.

  • signal (Union[dict, Signal]) –

    The signal to create.

    If a dict is provided, it must be of the same form as the protobuf message Signal

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Signal instance.

Raises
create_subscription(parent, subscription, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a new subscription. This will fail if: a. there are too many (50) subscriptions in the incident already b. a subscription using the given channel already exists

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # TODO: Initialize `subscription`:
>>> subscription = {}
>>>
>>> response = client.create_subscription(parent, subscription)
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • subscription (Union[dict, Subscription]) –

    The subscription to create.

    If a dict is provided, it must be of the same form as the protobuf message Subscription

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Subscription instance.

Raises
create_tag(parent, tag, retry=<object object>, timeout=<object object>, metadata=None)[source]

Creates a tag on an existing incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # TODO: Initialize `tag`:
>>> tag = {}
>>>
>>> response = client.create_tag(parent, tag)
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • tag (Union[dict, Tag]) –

    Tag to create. Only tag.display_name is an input argument.

    If a dict is provided, it must be of the same form as the protobuf message Tag

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Tag instance.

Raises
delete_artifact(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes an existing artifact.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.artifact_path('[PROJECT]', '[INCIDENT]', '[ARTIFACT]')
>>>
>>> client.delete_artifact(name)
Parameters
  • name (str) – Resource name of the artifact.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
delete_incident_role_assignment(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes an existing role assignment.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.role_assignment_path('[PROJECT]', '[INCIDENT]', '[ROLE_ASSIGNMENT]')
>>>
>>> client.delete_incident_role_assignment(name)
Parameters
  • name (str) – Resource name of the role assignment.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
delete_subscription(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes an existing subscription.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.subscription_path('[PROJECT]', '[INCIDENT]', '[SUBSCRIPTION]')
>>>
>>> client.delete_subscription(name)
Parameters
  • name (str) – Resource name of the subscription.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
delete_tag(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Deletes an existing tag.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.tag_path('[PROJECT]', '[INCIDENT]', '[TAG]')
>>>
>>> client.delete_tag(name)
Parameters
  • name (str) – Resource name of the tag.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Raises
enums = <module 'google.cloud.irm_v1alpha2.gapic.enums' from '/tmpfs/src/github/google-cloud-python/irm/google/cloud/irm_v1alpha2/gapic/enums.py'>
escalate_incident(incident, update_mask=None, subscriptions=None, tags=None, roles=None, artifacts=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Escalates an incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `incident`:
>>> incident = {}
>>>
>>> response = client.escalate_incident(incident)
Parameters
  • incident (Union[dict, Incident]) –

    The incident to escalate with the new values.

    If a dict is provided, it must be of the same form as the protobuf message Incident

  • update_mask (Union[dict, FieldMask]) –

    List of fields that should be updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • subscriptions (list[Union[dict, Subscription]]) –

    Subscriptions to add or update. Existing subscriptions with the same channel and address as a subscription in the list will be updated.

    If a dict is provided, it must be of the same form as the protobuf message Subscription

  • tags (list[Union[dict, Tag]]) –

    Tags to add. Tags identical to existing tags will be ignored.

    If a dict is provided, it must be of the same form as the protobuf message Tag

  • roles (list[Union[dict, IncidentRoleAssignment]]) –

    Roles to add or update. Existing roles with the same type (and title, for TYPE_OTHER roles) will be updated.

    If a dict is provided, it must be of the same form as the protobuf message IncidentRoleAssignment

  • artifacts (list[Union[dict, Artifact]]) –

    Artifacts to add. All artifacts are added without checking for duplicates.

    If a dict is provided, it must be of the same form as the protobuf message Artifact

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A EscalateIncidentResponse instance.

Raises
force_incident_role_handover(name, new_assignee, retry=<object object>, timeout=<object object>, metadata=None)[source]

Forces a role handover. This will fail if the ‘proposed_assignee’ field of the IncidentRoleAssignment is not equal to the ‘new_assignee’ field of the request. If the caller is the new_assignee, ConfirmIncidentRoleHandover should be used instead.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.role_assignment_path('[PROJECT]', '[INCIDENT]', '[ROLE_ASSIGNMENT]')
>>>
>>> # TODO: Initialize `new_assignee`:
>>> new_assignee = {}
>>>
>>> response = client.force_incident_role_handover(name, new_assignee)
Parameters
  • name (str) – Resource name of the role assignment.

  • new_assignee (Union[dict, User]) –

    The proposed assignee, who will now be the assignee. This should not be the current user; otherwise ConfirmRoleHandover should be called.

    If a dict is provided, it must be of the same form as the protobuf message User

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A IncidentRoleAssignment instance.

Raises
classmethod from_service_account_file(filename, *args, **kwargs)[source]

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

IncidentServiceClient

classmethod from_service_account_json(filename, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

IncidentServiceClient

get_incident(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns an incident by name.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> response = client.get_incident(name)
Parameters
  • name (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Incident instance.

Raises
get_signal(name, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns a signal by name.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.signal_path('[PROJECT]', '[SIGNAL]')
>>>
>>> response = client.get_signal(name)
Parameters
  • name (str) – Resource name of the Signal resource, for example, “projects/{project_id}/signals/{signal_id}”.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Signal instance.

Raises
classmethod incident_path(project, incident)[source]

Return a fully-qualified incident string.

list_annotations(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists annotations that are part of an incident. No assumptions should be made on the content-type of the annotation returned.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_annotations(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_annotations(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Annotation instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
list_artifacts(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns a list of artifacts for an incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_artifacts(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_artifacts(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Artifact instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
list_incident_role_assignments(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists role assignments that are part of an incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_incident_role_assignments(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_incident_role_assignments(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of IncidentRoleAssignment instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
list_subscriptions(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns a list of subscriptions for an incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_subscriptions(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_subscriptions(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Subscription instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
list_tags(parent, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists tags that are part of an incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_tags(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_tags(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – Resource name of the incident, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Tag instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
classmethod project_path(project)[source]

Return a fully-qualified project string.

request_incident_role_handover(name, new_assignee, retry=<object object>, timeout=<object object>, metadata=None)[source]

Starts a role handover. The proposed assignee will receive an email notifying them of the assignment. This will fail if a role handover is already pending.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.role_assignment_path('[PROJECT]', '[INCIDENT]', '[ROLE_ASSIGNMENT]')
>>>
>>> # TODO: Initialize `new_assignee`:
>>> new_assignee = {}
>>>
>>> response = client.request_incident_role_handover(name, new_assignee)
Parameters
  • name (str) – Resource name of the role assignment.

  • new_assignee (Union[dict, User]) –

    The proposed assignee.

    If a dict is provided, it must be of the same form as the protobuf message User

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A IncidentRoleAssignment instance.

Raises
classmethod role_assignment_path(project, incident, role_assignment)[source]

Return a fully-qualified role_assignment string.

search_incidents(parent, query=None, page_size=None, time_zone=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns a list of incidents. Incidents are ordered by start time, with the most recent incidents first.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.search_incidents(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.search_incidents(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – The resource name of the hosting Stackdriver project which requested incidents belong to.

  • query (str) –

    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,

    • 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,

    • 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”

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • time_zone (str) – 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.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Incident instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
search_signals(parent, query=None, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Lists signals that are part of an incident. Signals are returned in reverse chronological order.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.search_signals(parent):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.search_signals(parent).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • parent (str) – The resource name of the hosting Stackdriver project which requested incidents belong to.

  • query (str) – Query to specify which signals should be returned.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Signal instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
search_similar_incidents(name, page_size=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Returns a list of incidents that are “similar” to the specified incident or signal. This functionality is provided on a best-effort basis and the definition of “similar” is subject to change.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> name = client.incident_path('[PROJECT]', '[INCIDENT]')
>>>
>>> # Iterate over all results
>>> for element in client.search_similar_incidents(name):
...     # process element
...     pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.search_similar_incidents(name).pages:
...     for element in page:
...         # process element
...         pass
Parameters
  • name (str) – Resource name of the incident or signal, for example, “projects/{project_id}/incidents/{incident_id}”.

  • page_size (int) – The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A PageIterator instance. By default, this is an iterable of Result instances. This object can also be configured to iterate over the pages of the response through the options parameter.

Raises
send_shift_handoff(parent, recipients, subject, cc=None, notes_content_type=None, notes_content=None, incidents=None, preview_only=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Sends a summary of the shift for oncall handoff.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize `recipients`:
>>> recipients = []
>>>
>>> # TODO: Initialize `subject`:
>>> subject = ''
>>>
>>> response = client.send_shift_handoff(parent, recipients, subject)
Parameters
  • parent (str) – The resource name of the Stackdriver project that the handoff is being sent from. for example, projects/{project_id}

  • recipients (list[str]) – Email addresses of the recipients of the handoff, for example, “user@example.com”. Must contain at least one entry.

  • subject (str) – The subject of the email. Required.

  • cc (list[str]) – Email addresses that should be CC’d on the handoff. Optional.

  • notes_content_type (str) – Content type string, for example, ‘text/plain’ or ‘text/html’.

  • notes_content (str) – Additional notes to be included in the handoff. Optional.

  • incidents (list[Union[dict, Incident]]) –

    The set of incidents that should be included in the handoff. Optional.

    If a dict is provided, it must be of the same form as the protobuf message Incident

  • preview_only (bool) – If set to true a ShiftHandoffResponse will be returned but the handoff will not actually be sent.

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A SendShiftHandoffResponse instance.

Raises
classmethod signal_path(project, signal)[source]

Return a fully-qualified signal string.

classmethod subscription_path(project, incident, subscription)[source]

Return a fully-qualified subscription string.

classmethod tag_path(project, incident, tag)[source]

Return a fully-qualified tag string.

update_artifact(artifact, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates an existing artifact.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `artifact`:
>>> artifact = {}
>>>
>>> response = client.update_artifact(artifact)
Parameters
  • artifact (Union[dict, Artifact]) –

    The artifact to update with the new values.

    If a dict is provided, it must be of the same form as the protobuf message Artifact

  • update_mask (Union[dict, FieldMask]) –

    List of fields that should be updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Artifact instance.

Raises
update_incident(incident, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates an existing incident.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `incident`:
>>> incident = {}
>>>
>>> response = client.update_incident(incident)
Parameters
  • incident (Union[dict, Incident]) –

    The incident to update with the new values.

    If a dict is provided, it must be of the same form as the protobuf message Incident

  • update_mask (Union[dict, FieldMask]) –

    List of fields that should be updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Incident instance.

Raises
update_signal(signal, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates an existing signal (for example, to assign/unassign it to an incident).

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `signal`:
>>> signal = {}
>>>
>>> response = client.update_signal(signal)
Parameters
  • signal (Union[dict, Signal]) –

    The signal to update with the new values.

    If a dict is provided, it must be of the same form as the protobuf message Signal

  • update_mask (Union[dict, FieldMask]) –

    List of fields that should be updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Signal instance.

Raises
update_subscription(subscription, update_mask=None, retry=<object object>, timeout=<object object>, metadata=None)[source]

Updates a subscription.

Example

>>> from google.cloud import irm_v1alpha2
>>>
>>> client = irm_v1alpha2.IncidentServiceClient()
>>>
>>> # TODO: Initialize `subscription`:
>>> subscription = {}
>>>
>>> response = client.update_subscription(subscription)
Parameters
  • subscription (Union[dict, Subscription]) –

    The subscription to update, with new values.

    If a dict is provided, it must be of the same form as the protobuf message Subscription

  • update_mask (Union[dict, FieldMask]) –

    List of fields that should be updated.

    If a dict is provided, it must be of the same form as the protobuf message FieldMask

  • retry (Optional[google.api_core.retry.Retry]) – A retry object used to retry requests. If None is specified, requests will not be retried.

  • timeout (Optional[float]) – The amount of time, in seconds, to wait for the request to complete. Note that if retry is specified, the timeout applies to each individual attempt.

  • metadata (Optional[Sequence[Tuple[str, str]]]) – Additional metadata that is provided to the method.

Returns

A Subscription instance.

Raises