Skip to content

Commit

Permalink
fix(oncall): remove raw inheritance from Shift and Schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-bauer committed Jan 2, 2025
1 parent 8a4cc12 commit 2ead423
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
7 changes: 3 additions & 4 deletions grafanaplane/oncall/schedule.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ local raw = import '../zz/main.libsonnet';
local schedule = raw.oncall.v1alpha1.schedule;
local forProvider = schedule.spec.parameters.forProvider;

forProvider // raise forProvider functions to here
{
local base = self,

Expand Down Expand Up @@ -35,9 +34,9 @@ forProvider // raise forProvider functions to here
]
),
withShifts(shifts)::
super.withType('calendar')
+ super.withShiftsRef([
super.shiftsRef.withName(shift)
forProvider.withType('calendar')
+ forProvider.withShiftsRef([
forProvider.shiftsRef.withName(shift)
for shift in shifts
]),
}
19 changes: 13 additions & 6 deletions grafanaplane/oncall/shift.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet';

local raw = import '../zz/main.libsonnet';
local shift = raw.oncall.v1alpha1.onCallShift;
local forProvider = shift.spec.parameters.forProvider;

// Lift forProvider functions here for convenience.
shift.spec.parameters.forProvider
{
'#new':: d.func.new(
|||
Expand All @@ -19,7 +18,7 @@ shift.spec.parameters.forProvider
),
new(name, id=xtd.ascii.stringToRFC1123(name))::
shift.new(id)
+ super.withName(name),
+ forProvider.withName(name),

'#withRollingUsers':: d.func.new(
|||
Expand All @@ -34,7 +33,15 @@ shift.spec.parameters.forProvider
]
),
withRollingUsers(frequency, users)::
super.withType('rolling_users')
+ super.withRollingUsers(users)
+ super.withFrequency(frequency),
forProvider.withType('rolling_users')
+ forProvider.withRollingUsers(users)
+ forProvider.withFrequency(frequency),

// Expose some generated functions here.
'#withStart':: forProvider['#withStart'],
withStart:: forProvider.withStart,
'#withStartRotationFromUserIndex':: forProvider['#withStartRotationFromUserIndex'],
withStartRotationFromUserIndex:: forProvider.withStartRotationFromUserIndex,
'#withByDay':: forProvider['#withByDay'],
withByDay:: forProvider.withByDay,
}

0 comments on commit 2ead423

Please sign in to comment.