Google Cloud Servicehealth API client library for monitoring service health events and organization impacts
npx @tessl/cli install tessl/pypi-google-cloud-servicehealth@0.1.0Google Cloud Service Health API client library for monitoring service health events and organization impacts. This library enables developers to gain visibility into disruptive events impacting Google Cloud products through comprehensive service health monitoring capabilities.
pip install google-cloud-servicehealthfrom google.cloud import servicehealth_v1Common patterns for client usage:
from google.cloud.servicehealth import ServiceHealthClient, ServiceHealthAsyncClientImport specific types when needed:
from google.cloud.servicehealth import Event, OrganizationEvent, EventViewfrom google.cloud.servicehealth import ServiceHealthClient
# Initialize the client
client = ServiceHealthClient()
# List events for a project
project_id = "your-project-id"
location = "global" # or specific location like "us-central1"
parent = f"projects/{project_id}/locations/{location}"
events = client.list_events(parent=parent)
for event in events:
print(f"Event: {event.title}")
print(f"State: {event.state}")
print(f"Category: {event.category}")
print("---")
# Get a specific event
event_name = f"projects/{project_id}/locations/global/events/{event_id}"
event = client.get_event(name=event_name)
print(f"Event details: {event.description}")The Service Health API follows Google Cloud's standard client library architecture:
This design enables monitoring of Google Cloud service health at both project and organization levels, with comprehensive filtering and pagination support for handling large-scale service health data.
Monitor and retrieve service health events affecting your Google Cloud projects. Provides access to incidents, outages, and service disruptions with detailed impact information and real-time updates.
def list_events(
request: Union[ListEventsRequest, dict] = None,
*,
parent: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> ListEventsPager: ...
def get_event(
request: Union[GetEventRequest, dict] = None,
*,
name: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> Event: ...Access organization-level service health events that may affect multiple projects within your organization. Provides visibility into broader service health issues and their organizational impact.
def list_organization_events(
request: Union[ListOrganizationEventsRequest, dict] = None,
*,
parent: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> ListOrganizationEventsPager: ...
def get_organization_event(
request: Union[GetOrganizationEventRequest, dict] = None,
*,
name: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> OrganizationEvent: ...Track specific impacts of service health events on organization assets. Provides detailed information about which resources and projects are affected by service health incidents.
def list_organization_impacts(
request: Union[ListOrganizationImpactsRequest, dict] = None,
*,
parent: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> ListOrganizationImpactsPager: ...
def get_organization_impact(
request: Union[GetOrganizationImpactRequest, dict] = None,
*,
name: str = None,
retry: Retry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> OrganizationImpact: ...All client operations are available in asynchronous versions for non-blocking execution in async/await environments.
# Async client with same methods as sync client
class ServiceHealthAsyncClient:
async def list_events(...) -> ListEventsAsyncPager: ...
async def get_event(...) -> Event: ...
# ... all other methods as async versionsclass Event:
"""Service health event affecting Google Cloud products."""
name: str # Resource name
title: str # Human-readable title
description: str # Detailed description
category: Event.EventCategory # Event category
detailed_category: Event.DetailedCategory # Detailed category
state: Event.State # Current state
detailed_state: Event.DetailedState # Detailed state
event_impacts: List[EventImpact] # List of impacts
relevance: Event.Relevance # Relevance to project
updates: List[EventUpdate] # Event updates
parent_event: str # Parent event (for merged events)
update_time: datetime # Last update time
start_time: datetime # Event start time
end_time: datetime # Event end time (if resolved)
next_update_time: datetime # Next expected update time
class OrganizationEvent:
"""Organization-level service health event."""
name: str # Resource name
title: str # Human-readable title
description: str # Detailed description
category: OrganizationEvent.EventCategory # Event category
state: OrganizationEvent.State # Current state
event_impacts: List[EventImpact] # List of impacts
updates: List[EventUpdate] # Event updates
start_time: datetime # Event start time
end_time: datetime # Event end time (if resolved)
update_time: datetime # Last update time
class OrganizationImpact:
"""Impact of an event on organization assets."""
name: str # Resource name
events: List[str] # Associated event names
asset: Asset # Impacted asset
update_time: datetime # Last update time
class EventImpact:
"""Impact information for a service health event."""
product: Product # Affected Google Cloud product
location: Location # Affected location
class EventUpdate:
"""Update information for a service health event."""
update_time: datetime # Update timestamp
title: str # Update title
description: str # Update description
symptom: str # Symptom description
workaround: str # Workaround information
class Product:
"""Google Cloud product information."""
product_name: str # Product display name
id: str # Product identifier
class Location:
"""Geographic location information."""
location_name: str # Location identifier
class Asset:
"""Google Cloud asset information."""
asset_name: str # Full resource name
asset_type: str # Resource type
# Enumerations
class EventView(Enum):
EVENT_VIEW_UNSPECIFIED = 0 # Default to basic view
EVENT_VIEW_BASIC = 1 # Basic fields without updates
EVENT_VIEW_FULL = 2 # All fields including updates
class OrganizationEventView(Enum):
ORGANIZATION_EVENT_VIEW_UNSPECIFIED = 0 # Default to basic view
ORGANIZATION_EVENT_VIEW_BASIC = 1 # Basic fields without updates
ORGANIZATION_EVENT_VIEW_FULL = 2 # All fields including updates
# Event nested enumerations
class Event.EventCategory(Enum):
EVENT_CATEGORY_UNSPECIFIED = 0 # Unspecified category
INCIDENT = 2 # Service outage or degradation
class Event.DetailedCategory(Enum):
DETAILED_CATEGORY_UNSPECIFIED = 0 # Unspecified detailed category
CONFIRMED_INCIDENT = 1 # Confirmed impact to Google Cloud product
EMERGING_INCIDENT = 2 # Under investigation for impact
class Event.State(Enum):
STATE_UNSPECIFIED = 0 # Unspecified state
ACTIVE = 1 # Actively affecting Google Cloud product
CLOSED = 2 # No longer affecting or merged with another event
class Event.DetailedState(Enum):
DETAILED_STATE_UNSPECIFIED = 0 # Unspecified detail state
EMERGING = 1 # Under active investigation
CONFIRMED = 2 # Confirmed and impacting at least one product
RESOLVED = 3 # No longer affecting any product
MERGED = 4 # Merged into parent event (see parent_event field)
AUTO_CLOSED = 9 # Automatically closed (impact unconfirmed/intermittent)
FALSE_POSITIVE = 10 # Not affecting a Google Cloud product
class Event.Relevance(Enum):
RELEVANCE_UNSPECIFIED = 0 # Unspecified relevance
UNKNOWN = 2 # Relevance to project unknown
NOT_IMPACTED = 6 # Does not impact the project
PARTIALLY_RELATED = 7 # Associated with product you use, may not impact you
RELATED = 8 # Direct connection with your project
IMPACTED = 9 # Verified to be impacting your project
# Request/Response Message Types
class ListEventsRequest:
"""Request message for listing service health events."""
parent: str # Required. Format: projects/{project_id}/locations/{location}
page_size: int # Optional. Maximum number of events to return
page_token: str # Optional. Page token for pagination
filter: str # Optional. Filter expression
view: EventView # Optional. Level of detail to return
class ListEventsResponse:
"""Response message for listing service health events."""
events: List[Event] # List of events
next_page_token: str # Token for next page of results
unreachable: List[str] # Unreachable locations
class GetEventRequest:
"""Request message for getting a specific service health event."""
name: str # Required. Format: projects/{project_id}/locations/{location}/events/{event_id}
class ListOrganizationEventsRequest:
"""Request message for listing organization events."""
parent: str # Required. Format: organizations/{organization_id}/locations/{location}
page_size: int # Optional. Maximum number of events to return
page_token: str # Optional. Page token for pagination
filter: str # Optional. Filter expression
view: OrganizationEventView # Optional. Level of detail to return
class ListOrganizationEventsResponse:
"""Response message for listing organization events."""
organization_events: List[OrganizationEvent] # List of organization events
next_page_token: str # Token for next page of results
unreachable: List[str] # Unreachable locations
class GetOrganizationEventRequest:
"""Request message for getting a specific organization event."""
name: str # Required. Format: organizations/{organization_id}/locations/{location}/organizationEvents/{event_id}
class ListOrganizationImpactsRequest:
"""Request message for listing organization impacts."""
parent: str # Required. Format: organizations/{organization_id}/locations/{location}
page_size: int # Optional. Maximum number of impacts to return
page_token: str # Optional. Page token for pagination
filter: str # Optional. Filter expression
class ListOrganizationImpactsResponse:
"""Response message for listing organization impacts."""
organization_impacts: List[OrganizationImpact] # List of organization impacts
next_page_token: str # Token for next page of results
unreachable: List[str] # Unreachable locations
class GetOrganizationImpactRequest:
"""Request message for getting a specific organization impact."""
name: str # Required. Format: organizations/{organization_id}/locations/{location}/organizationImpacts/{organization_impact_id}
# Pager Classes
class ListEventsPager:
"""Synchronous iterator for paginating through Event objects."""
def __iter__(self) -> Iterator[Event]: ...
def __next__(self) -> Event: ...
class ListEventsAsyncPager:
"""Asynchronous iterator for paginating through Event objects."""
def __aiter__(self) -> AsyncIterator[Event]: ...
async def __anext__(self) -> Event: ...
class ListOrganizationEventsPager:
"""Synchronous iterator for paginating through OrganizationEvent objects."""
def __iter__(self) -> Iterator[OrganizationEvent]: ...
def __next__(self) -> OrganizationEvent: ...
class ListOrganizationEventsAsyncPager:
"""Asynchronous iterator for paginating through OrganizationEvent objects."""
def __aiter__(self) -> AsyncIterator[OrganizationEvent]: ...
async def __anext__(self) -> OrganizationEvent: ...
class ListOrganizationImpactsPager:
"""Synchronous iterator for paginating through OrganizationImpact objects."""
def __iter__(self) -> Iterator[OrganizationImpact]: ...
def __next__(self) -> OrganizationImpact: ...
class ListOrganizationImpactsAsyncPager:
"""Asynchronous iterator for paginating through OrganizationImpact objects."""
def __aiter__(self) -> AsyncIterator[OrganizationImpact]: ...
async def __anext__(self) -> OrganizationImpact: ...