Skip to content

Commit

Permalink
fix(oncall): require names, rather than names or manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-bauer committed Jan 2, 2025
1 parent f7fc2a2 commit 104017c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 34 deletions.
11 changes: 5 additions & 6 deletions grafanaplane/oncall/escalationchain.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';

local util = import '../util.libsonnet';
local raw = import '../zz/main.libsonnet';
local escalationChain = raw.oncall.v1alpha1.escalationChain;
local escalation = raw.oncall.v1alpha1.escalation;
Expand Down Expand Up @@ -66,15 +65,15 @@ local escalation = raw.oncall.v1alpha1.escalation;
'#notifyOnCallFromSchedule':: d.func.new(
|||
`notifyOnCallFromSchedule` configures an Escalation step to notify
on-call persons from the given Schedule. `schedule` may be either a
Schedule resource name or a manifest.
on-call persons from the given Schedule. `scheduleName` must be the
Schedule resource name.
|||,
[d.argument.new('schedule', 'string|object')]
[d.argument.new('schedule', 'string')]
),
notifyOnCallFromSchedule(schedule)::
notifyOnCallFromSchedule(scheduleName)::
forProvider.withType('notify_on_call_from_schedule')
+ forProvider.withNotifyOnCallFromScheduleRef(
forProvider.notifyOnCallFromScheduleRef.withName(util.getName(schedule))
forProvider.notifyOnCallFromScheduleRef.withName(scheduleName)
),

'#notifyPersons':: d.func.new(
Expand Down
11 changes: 5 additions & 6 deletions grafanaplane/oncall/integration.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';

local util = import '../util.libsonnet';
local raw = import '../zz/main.libsonnet';
local integration = raw.oncall.v1alpha1.integration;
local route = raw.oncall.v1alpha1.route;
Expand Down Expand Up @@ -32,17 +31,17 @@ forProvider
'#withDefaultChain':: d.func.new(
|||
`withDefaulChain` configures the default route of an Integration to use
an Escalation Chain. `escalationChain` is the resource name or manifest
of the desired Escalation Chain.
an Escalation Chain. `escalationChain` is the resource name of the
desired Escalation Chain.
|||,
[
d.argument.new('escalationChain', d.T.string),
d.argument.new('escalationChainName', d.T.string),
]
),
withDefaultChain(escalationChain):: {
withDefaultChain(escalationChainName):: {
integration+:
forProvider.withDefaultRoute(
forProvider.defaultRoute.escalationChainRef.withName(util.getName(escalationChain))
forProvider.defaultRoute.escalationChainRef.withName(escalationChainName)
),
},

Expand Down
9 changes: 4 additions & 5 deletions grafanaplane/oncall/schedule.libsonnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet';
local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';

local util = import '../util.libsonnet';
local raw = import '../zz/main.libsonnet';
local schedule = raw.oncall.v1alpha1.schedule;
local forProvider = schedule.spec.parameters.forProvider;
Expand Down Expand Up @@ -29,16 +28,16 @@ forProvider // raise forProvider functions to here
|||
`withShifts` sets a Schedule to type `calendar` and configures shifts.
Shifts are only applicable to `calendar` type Schedules. `shifts` is an
array of Shift resource names or entire Shift manifests.
array of Shift resource names.
|||,
[
d.argument.new('shifts', d.T.array, default='null'),
d.argument.new('shifts', d.T.array),
]
),
withShifts(shifts=null)::
withShifts(shifts)::
super.withType('calendar')
+ super.withShiftsRef([
super.shiftsRef.withName(util.getName(shift))
super.shiftsRef.withName(shift)
for shift in shifts
]),
}
17 changes: 0 additions & 17 deletions grafanaplane/util.libsonnet

This file was deleted.

0 comments on commit 104017c

Please sign in to comment.