From 382ca37dfde896b52a1cae6a2f964394a06ce239 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Fri, 27 Dec 2024 15:56:50 -0500 Subject: [PATCH] feat(oncall): add escalationChain constructor --- grafanaplane/main.libsonnet | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index c8c6c9c..b66ad6f 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -364,6 +364,31 @@ local raw = import './zz/main.libsonnet'; }, + oncall: { + '#': d.package.newSub('oncall', ''), + escalationChain: { + local escalationChain = raw.oncall.v1alpha1.escalationChain, + '#new': d.func.new( + ||| + `new` creates an Escalation Chain. The `name` is a display-friendly + string, and `resourceId` defaults to a slug-ified version of it. + `providerName` is the resource name (`myprovider.metadata.name`) of + the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, providerName, teamId=null, resourceId=null):: + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + escalationChain.new(id) + + escalationChain.spec.parameters.providerConfigRef.withName(providerName) + + escalationChain.spec.parameters.forProvider.withName(name), + }, + }, + sm: { '#': d.package.newSub('sm', ''),