sym.sdk.integrations.pagerduty

Helpers for interacting with the PagerDuty API.

Functions

get_incidents(*[, assignees, service_ids, ...])

Retrieve incidents from PagerDuty based on provided filter params.

has_incident(*[, assignees, service_ids, ...])

Return whether there exists an incident that matches the filters provided in the params.

is_on_call(user, *[, ...])

Checks if the provided user is currently on-call according to PagerDuty.

users_for_schedule(*[, schedule_name, ...])

Get all users for the specified schedule from PagerDuty.

users_on_call(*[, escalation_policy_name, ...])

Get all on-call users for the specified escalation policy or schedule from PagerDuty.

Classes

PagerDutyStatus

Represents possible incident statuses in PagerDuty.

PagerDutyUrgency

Represents possible incident urgencies in PagerDuty.

class sym.sdk.integrations.pagerduty.PagerDutyStatus(value)

Bases: str, enum.Enum

Represents possible incident statuses in PagerDuty.

class sym.sdk.integrations.pagerduty.PagerDutyUrgency(value)

Bases: str, enum.Enum

Represents possible incident urgencies in PagerDuty.

sym.sdk.integrations.pagerduty.get_incidents(*, assignees: Optional[List[sym.sdk.user.User]] = None, service_ids: Optional[List[str]] = None, statuses: Optional[List[sym.sdk.integrations.pagerduty.PagerDutyStatus]] = None, urgencies: Optional[List[sym.sdk.integrations.pagerduty.PagerDutyUrgency]] = None, since: Optional[str] = None, until: Optional[str] = None) List[Dict[str, Any]]

Retrieve incidents from PagerDuty based on provided filter params.

Parameters
  • assignees – When provided, only incidents assigned to one of these users will be returned.

  • service_ids – When provided, only incidents in one of these services will be returned.

  • statuses – When provided, only incidents with these statuses will be returned. Defaults to ["TRIGGERED", "ACKNOWLEDGED"]. Note: If assignees is provided, statuses cannot contain RESOLVED.

  • urgencies – When provided, only incidents with these urgencies will be returned. Defaults to ["HIGH"].

  • since – When provided, only incidents on or after since will be returned. Defaults to 24 hours ago if not provided. Must be an ISO-8601 datetime.

  • until – When provided, only incidents before until will be returned. Defaults to 1 month after since if not provided. Must be an ISO-8601 datetime.

Returns

A list of dictionaries, with each dictionary representing an incident in PagerDuty’s incident structure. See here for details.

sym.sdk.integrations.pagerduty.has_incident(*, assignees: Optional[List[sym.sdk.user.User]] = None, service_ids: Optional[List[str]] = None, statuses: Optional[List[sym.sdk.integrations.pagerduty.PagerDutyStatus]] = None, urgencies: Optional[List[sym.sdk.integrations.pagerduty.PagerDutyUrgency]] = None, since: Optional[str] = None, until: Optional[str] = None) bool

Return whether there exists an incident that matches the filters provided in the params.

Parameters
  • assignees – When provided, only incidents assigned to one of these users will be returned.

  • service_ids – When provided, only incidents in one of these services will be returned.

  • statuses – When provided, only incidents with these statuses will be returned. Defaults to ["TRIGGERED", "ACKNOWLEDGED"]. Note: If assignees is provided, statuses cannot contain RESOLVED.

  • urgencies – When provided, only incidents with these urgencies will be returned. Defaults to ["HIGH"].

  • since – When provided, only incidents on or after since will be returned. Defaults to 24 hours ago if not provided. Must be an ISO-8601 datetime.

  • until – When provided, only incidents before until will be returned. Defaults to 1 month after since if not provided. Must be an ISO-8601 datetime.

Returns

A boolean representing whether there is an incident matching the given filter parameters.

sym.sdk.integrations.pagerduty.is_on_call(user: sym.sdk.user.User, *, escalation_policy_name: Optional[str] = None, escalation_policy_id: Optional[str] = None, schedule_name: Optional[str] = None, schedule_id: Optional[str] = None) bool

Checks if the provided user is currently on-call according to PagerDuty.

If a name or ID is provided for either escalation policy or schedule, checks if the user is on-call for specified escalation policy or schedule.

If no name or ID is provided for either escalation policy or schedule, checks if the user is on-call for ANY escalation policy or schedule.

Parameters
  • escalation_policy_name – The name of a specific Escalation Policy to check.

  • escalation_policy_id – The ID of a specific Escalation Policy to check.

  • schedule_name – The name of a specific Schedule to check.

  • schedule_id – The ID of a specific Schedule to check.

sym.sdk.integrations.pagerduty.users_for_schedule(*, schedule_name: Optional[str] = None, schedule_id: Optional[str] = None) List[sym.sdk.user.User]

Get all users for the specified schedule from PagerDuty.

Schedule can be specified by name or ID.

Parameters
  • schedule_name – The name of a specific Schedule to check.

  • schedule_id – The ID of a specific Schedule to check.

sym.sdk.integrations.pagerduty.users_on_call(*, escalation_policy_name: Optional[str] = None, escalation_policy_id: Optional[str] = None, schedule_name: Optional[str] = None, schedule_id: Optional[str] = None) List[sym.sdk.user.User]

Get all on-call users for the specified escalation policy or schedule from PagerDuty.

Escalation policy or schedule can be specified by name or ID. If none are provided, returns on-call users for ALL escalation policies + schedules.

Parameters
  • escalation_policy_name – The name of a specific Escalation Policy to check.

  • escalation_policy_id – The ID of a specific Escalation Policy to check.

  • schedule_name – The name of a specific Schedule to check.

  • schedule_id – The ID of a specific Schedule to check.