escalationChain.new(name)
PARAMETERS:
- name (
string
)
new
creates an Escalation Chain. The name
is a display-friendly string.
escalationChain.withId(id)
PARAMETERS:
- id (
string
)
withId
sets the resource name for an Escalation Chain
escalationChain.withSteps(steps)
PARAMETERS:
- steps (
array
)
withSteps
configures one or more Escalation resources as steps within
the calling Escalation Chain.
escalationChain.withTeamId(teamId)
PARAMETERS:
- teamId (
string
)
withTeamId
configures the Team ID on the Escalation Chain. teamId
should be the ID of the team as a string.
escalationChain.step.notifyOnCallFromSchedule(schedule)
PARAMETERS:
- schedule (
string
)
notifyOnCallFromSchedule
configures an Escalation step to notify
on-call persons from the given Schedule. scheduleName
must be the
Schedule resource name.
escalationChain.step.notifyPersons(persons)
PARAMETERS:
- persons (
array
)
notifyPersons
configures an Escalation step to notify a list of
persons.
escalationChain.step.wait(seconds)
PARAMETERS:
- seconds (
number
)
wait
configures an Escalation step to wait for acknowledgement for
the given number of seconds before proceeding.
integration.new(name, type, defaultChainName)
PARAMETERS:
- name (
string
) - type (
string
) - defaultChainName (
string
)
new
creates an Integration. The name
is a display-friendly string.
type
is the type of Integration. defaultChainName
is the resource
name of the default Escalation Chain.
integration.withId(id)
PARAMETERS:
- id (
string
)
withId
sets the resource name for an Integration
integration.withRoutes(routes)
PARAMETERS:
- routes (
array
)
withRoute
configures Route resources connecting this Integration with
Escalation Chains. routes
is an array of Routes to be evaluated in
order. If they do not specify an Escalation Chain to route to, the
default chain for this Integration will be used.
integration.route.new(routingRegex)
PARAMETERS:
- routingRegex (
string
)
new
configures a Route with a given routingRegex
.
integration.route.withEscalationChain(escalationChainName)
PARAMETERS:
- escalationChainName (
string
)
withEscalationChain
configures a Route with a destination Escalation
Chain. escalationChainName
is the resource name of the chain.
schedule.calendar.new(name, shifts="{}")
PARAMETERS:
- name (
string
) - shifts (
object
)- default value:
"{}"
- default value:
new
creates a Schedule with type calendar
. It automatically
includes references to Shift objects which are members of its shifts
field. shifts
is an object representing zero or more shifts.
Shifts are unordered, and so are supplied as an object to allow for reuse. For example, a Primary/Secondary pair of Schedules could be declared like:
local calendar = grafanaplane.oncall.schedule.calendar,
local onCallUsers = [['bob@example.com'], ['alice@example.com']],
primary: calendar.new('Primary', [
// 24 hour daily shift
calendar.shift.new('Weekday', '2025-01-01T12:00:00', 24 * 60 * 60)
+ calendar.shift.withByDay(['MO', 'TU', 'WE', 'TH', 'FR'])
+ calendar.shift.withRollingUsers('daily', onCallUsers),
// 72 hour weekend shift
calendar.shift.new('Weekend', '2025-01-01T12:00:00', 72 * 60 * 60)
+ calendar.shift.withByDay(['FR', 'SA', 'SU', 'MO'])
+ calendar.shift.withRollingUsers('weekly', onCallUsers),
]),
// same as the primary shift, but shifted one person
secondary: calendar.new('Secondary', [
shift
// replace the resource ID
+ calendar.shift.withId('secondary-' + shift.metadata.name)
// start rotating from the second person
+ calendar.shift.withStartRotationFromUserIndex(1)
for shift in self.primary.shifts
]),
schedule.calendar.withId(id)
PARAMETERS:
- id (
string
)
withId
sets the resource name for a Schedule
schedule.calendar.withShifts(shifts)
PARAMETERS:
- shifts (
array
)
withShifts
sets an array of Shifts on a calendar-type Schedule.
schedule.calendar.shift.new(name, start, duration)
PARAMETERS:
- name (
string
) - start (
string
) - duration (
number
)
new
creates an OnCallShift, which can be used in Schedules of type
calendar
. name
is a display-friendly string. start
is a datetime as
yyyy-MM-dd'T'HH:mm:ss
, such as “2020-09-05T08:00:00”
. duration
is
the length of the shift in seconds.
schedule.calendar.shift.withByDay(value)
PARAMETERS:
- value (
array
)
(Set of String) This parameter takes a list of days in iCal format. Can be MO, TU, WE, TH, FR, SA, SU This parameter takes a list of days in iCal format. Can be MO, TU, WE, TH, FR, SA, SU
schedule.calendar.shift.withId(id)
PARAMETERS:
- id (
string
)
withId
sets the resource name for a Shift
schedule.calendar.shift.withRollingUsers(frequency, users)
PARAMETERS:
- frequency (
string
)- valid values:
"hourly"
,"daily"
,"weekly"
,"monthly"
- valid values:
- users (
array
)
withRollingUsers
sets an OnCallShift to type rolling_users
and
configures required fields. frequency
is required for this shift type.
users
are given as a list of lists of strings. The inner lists are
groups of users, represented by email address, who will be on a shift
together.
For example, if
frequency: 'daily',
users: [['alex@example.com', 'bob@example.com'], ['alice@example.com']]
then on the first day, Alex and Bob would both be notified. On the next day, only Alice would be. After that, Alex and Bob again, then Alice, and so on. Reproduced from the HTTP API docs.
A common pitfall is to inadvertently supply only a list of strings. This function will raise an error in that case.
schedule.calendar.shift.withStartRotationFromUserIndex(value)
PARAMETERS:
- value (
number
)
call rotation starts. The index of the list of users in rolling_users, from which on-call rotation starts.