From 382ca37dfde896b52a1cae6a2f964394a06ce239 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Fri, 27 Dec 2024 15:56:50 -0500 Subject: [PATCH 01/37] 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', ''), From 8040b0eb5467d0b5b3a06f8ed200c7cc5f575b4f Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Fri, 27 Dec 2024 16:21:02 -0500 Subject: [PATCH 02/37] fix(oncall): remove unused parameter --- grafanaplane/main.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index b66ad6f..cd6e3b0 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -381,7 +381,7 @@ local raw = import './zz/main.libsonnet'; d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), ] ), - new(name, providerName, teamId=null, resourceId=null):: + new(name, providerName, resourceId=null):: local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); escalationChain.new(id) + escalationChain.spec.parameters.providerConfigRef.withName(providerName) From bce4d1404d671f05c0645ed351608a8e64d470b7 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Fri, 27 Dec 2024 16:21:31 -0500 Subject: [PATCH 03/37] feat(oncall): add Integration constructor --- grafanaplane/main.libsonnet | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index cd6e3b0..9ccb942 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -387,6 +387,43 @@ local raw = import './zz/main.libsonnet'; + escalationChain.spec.parameters.providerConfigRef.withName(providerName) + escalationChain.spec.parameters.forProvider.withName(name), }, + integration: { + local integration = raw.oncall.v1alpha1.integration, + '#new': d.func.new( + ||| + `new` creates an Integration. The `name` is a display-friendly + string, and `resourceId` defaults to a slug-ified version of it. + `type` is the type of Integration. `providerName` is the resource + name (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('type', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, type, providerName, resourceId=null):: + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + integration.new(id) + + integration.spec.parameters.providerConfigRef.withName(providerName) + + integration.spec.parameters.forProvider.withName(name) + + integration.spec.parameters.forProvider.withType(type), + + '#withDefaultRoute': d.func.new( + ||| + `withDefaultRoute` configures the default route using an Escalation + Chain object's name. + ||| + [ + d.argument.new('name', d.T.string) + ] + ), + withDefaultRoute(name):: + integration.spec.parameters.forProvider.withDefaultRoute( + integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) + ), + }, }, sm: { From cec47088ac728252ab0b076f67d3619b2d2f13fb Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Fri, 27 Dec 2024 17:50:22 -0500 Subject: [PATCH 04/37] feat(oncall): add Route constructor --- grafanaplane/main.libsonnet | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index 9ccb942..c4ee7ca 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -424,6 +424,32 @@ local raw = import './zz/main.libsonnet'; integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) ), }, + route: { + local route = raw.oncall.v1alpha1.route, + '#new': d.func.new( + ||| + `new` creates a Route. `id` is the resource name. `integrationName` + is the resource name of the Integration to reference. + `escalationChainName` is the resource name of the Escalation Chain to + reference. `routingRegex` is configured as a routing regex, if + supplied. `providerName` is the resource name + (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('id', d.T.string), + d.argument.new('integrationName', d.T.string), + d.argument.new('escalationChainName', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('routingRegex', d.T.string, default='null'), + ] + ), + new(id, integrationName, escalationChainName, providerName, routingRegex=null):: + route.new(id) + + route.spec.parameters.providerConfigRef.withName(providerName) + + route.spec.parameters.forProvider.integrationRef.withName(integrationName) + + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) + + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, + }, }, sm: { From f5ab8464f2448671fbc9287ad588a6097d2cd72c Mon Sep 17 00:00:00 2001 From: Alexander Bauer Date: Fri, 27 Dec 2024 18:14:27 -0500 Subject: [PATCH 05/37] fix(oncall): fix missing comma Co-authored-by: Jeroen Op 't Eynde --- grafanaplane/main.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index c4ee7ca..0e12020 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -414,7 +414,7 @@ local raw = import './zz/main.libsonnet'; ||| `withDefaultRoute` configures the default route using an Escalation Chain object's name. - ||| + |||, [ d.argument.new('name', d.T.string) ] From e214e73b08708880a5a8c0eb659a24de3f95e4db Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:21:06 -0500 Subject: [PATCH 06/37] refactor(oncall): move to separate file --- grafanaplane/main.libsonnet | 88 +-------------------------------- grafanaplane/oncall.libsonnet | 92 +++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 87 deletions(-) create mode 100644 grafanaplane/oncall.libsonnet diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index 0e12020..fb36679 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -364,93 +364,7 @@ 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, 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), - }, - integration: { - local integration = raw.oncall.v1alpha1.integration, - '#new': d.func.new( - ||| - `new` creates an Integration. The `name` is a display-friendly - string, and `resourceId` defaults to a slug-ified version of it. - `type` is the type of Integration. `providerName` is the resource - name (`myprovider.metadata.name`) of the Provider. - |||, - [ - d.argument.new('name', d.T.string), - d.argument.new('type', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), - ] - ), - new(name, type, providerName, resourceId=null):: - local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); - integration.new(id) - + integration.spec.parameters.providerConfigRef.withName(providerName) - + integration.spec.parameters.forProvider.withName(name) - + integration.spec.parameters.forProvider.withType(type), - - '#withDefaultRoute': d.func.new( - ||| - `withDefaultRoute` configures the default route using an Escalation - Chain object's name. - |||, - [ - d.argument.new('name', d.T.string) - ] - ), - withDefaultRoute(name):: - integration.spec.parameters.forProvider.withDefaultRoute( - integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) - ), - }, - route: { - local route = raw.oncall.v1alpha1.route, - '#new': d.func.new( - ||| - `new` creates a Route. `id` is the resource name. `integrationName` - is the resource name of the Integration to reference. - `escalationChainName` is the resource name of the Escalation Chain to - reference. `routingRegex` is configured as a routing regex, if - supplied. `providerName` is the resource name - (`myprovider.metadata.name`) of the Provider. - |||, - [ - d.argument.new('id', d.T.string), - d.argument.new('integrationName', d.T.string), - d.argument.new('escalationChainName', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('routingRegex', d.T.string, default='null'), - ] - ), - new(id, integrationName, escalationChainName, providerName, routingRegex=null):: - route.new(id) - + route.spec.parameters.providerConfigRef.withName(providerName) - + route.spec.parameters.forProvider.integrationRef.withName(integrationName) - + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) - + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, - }, - }, + oncall: import './oncall.libsonnet', sm: { '#': d.package.newSub('sm', ''), diff --git a/grafanaplane/oncall.libsonnet b/grafanaplane/oncall.libsonnet new file mode 100644 index 0000000..fe7c22a --- /dev/null +++ b/grafanaplane/oncall.libsonnet @@ -0,0 +1,92 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import './zz/main.libsonnet'; + +{ + '#': 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, 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), + }, + integration: { + local integration = raw.oncall.v1alpha1.integration, + '#new': d.func.new( + ||| + `new` creates an Integration. The `name` is a display-friendly + string, and `resourceId` defaults to a slug-ified version of it. + `type` is the type of Integration. `providerName` is the resource + name (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('type', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, type, providerName, resourceId=null):: + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + integration.new(id) + + integration.spec.parameters.providerConfigRef.withName(providerName) + + integration.spec.parameters.forProvider.withName(name) + + integration.spec.parameters.forProvider.withType(type), + + '#withDefaultRoute': d.func.new( + ||| + `withDefaultRoute` configures the default route using an Escalation + Chain object's name. + |||, + [ + d.argument.new('name', d.T.string), + ] + ), + withDefaultRoute(name):: + integration.spec.parameters.forProvider.withDefaultRoute( + integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) + ), + }, + route: { + local route = raw.oncall.v1alpha1.route, + '#new': d.func.new( + ||| + `new` creates a Route. `id` is the resource name. `integrationName` + is the resource name of the Integration to reference. + `escalationChainName` is the resource name of the Escalation Chain to + reference. `routingRegex` is configured as a routing regex, if + supplied. `providerName` is the resource name + (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('id', d.T.string), + d.argument.new('integrationName', d.T.string), + d.argument.new('escalationChainName', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('routingRegex', d.T.string, default='null'), + ] + ), + new(id, integrationName, escalationChainName, providerName, routingRegex=null):: + route.new(id) + + route.spec.parameters.providerConfigRef.withName(providerName) + + route.spec.parameters.forProvider.integrationRef.withName(integrationName) + + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) + + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, + }, +} From ca257f2c84af3d998a26ade3ee5271b430fdacb7 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:24:41 -0500 Subject: [PATCH 07/37] refactor(oncall): split escalationChain API to separate file --- grafanaplane/main.libsonnet | 2 +- grafanaplane/oncall/escalationchain.libsonnet | 26 +++++++++++++++++++ .../main.libsonnet} | 24 ++--------------- 3 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 grafanaplane/oncall/escalationchain.libsonnet rename grafanaplane/{oncall.libsonnet => oncall/main.libsonnet} (75%) diff --git a/grafanaplane/main.libsonnet b/grafanaplane/main.libsonnet index fb36679..c266f81 100644 --- a/grafanaplane/main.libsonnet +++ b/grafanaplane/main.libsonnet @@ -364,7 +364,7 @@ local raw = import './zz/main.libsonnet'; }, - oncall: import './oncall.libsonnet', + oncall: import './oncall/main.libsonnet', sm: { '#': d.package.newSub('sm', ''), diff --git a/grafanaplane/oncall/escalationchain.libsonnet b/grafanaplane/oncall/escalationchain.libsonnet new file mode 100644 index 0000000..84a389d --- /dev/null +++ b/grafanaplane/oncall/escalationchain.libsonnet @@ -0,0 +1,26 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; + +{ + 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, 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), +} diff --git a/grafanaplane/oncall.libsonnet b/grafanaplane/oncall/main.libsonnet similarity index 75% rename from grafanaplane/oncall.libsonnet rename to grafanaplane/oncall/main.libsonnet index fe7c22a..5906f0d 100644 --- a/grafanaplane/oncall.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -1,31 +1,11 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; -local raw = import './zz/main.libsonnet'; +local raw = import '../zz/main.libsonnet'; { '#': 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, 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), - }, + escalationChain: import './escalationchain.libsonnet', integration: { local integration = raw.oncall.v1alpha1.integration, '#new': d.func.new( From f4eb3c763f23a2698aeea017756cc9d08c6912db Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:24:41 -0500 Subject: [PATCH 08/37] refactor(oncall): split integration API to separate file --- grafanaplane/oncall/integration.libsonnet | 42 +++++++++++++++++++++++ grafanaplane/oncall/main.libsonnet | 38 +------------------- 2 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 grafanaplane/oncall/integration.libsonnet diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet new file mode 100644 index 0000000..30f088a --- /dev/null +++ b/grafanaplane/oncall/integration.libsonnet @@ -0,0 +1,42 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; + +{ + local integration = raw.oncall.v1alpha1.integration, + '#new': d.func.new( + ||| + `new` creates an Integration. The `name` is a display-friendly + string, and `resourceId` defaults to a slug-ified version of it. + `type` is the type of Integration. `providerName` is the resource + name (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('type', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, type, providerName, resourceId=null):: + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + integration.new(id) + + integration.spec.parameters.providerConfigRef.withName(providerName) + + integration.spec.parameters.forProvider.withName(name) + + integration.spec.parameters.forProvider.withType(type), + + '#withDefaultRoute': d.func.new( + ||| + `withDefaultRoute` configures the default route using an Escalation + Chain object's name. + |||, + [ + d.argument.new('name', d.T.string), + ] + ), + withDefaultRoute(name):: + integration.spec.parameters.forProvider.withDefaultRoute( + integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) + ), +} diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index 5906f0d..e55e99b 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -6,43 +6,7 @@ local raw = import '../zz/main.libsonnet'; { '#': d.package.newSub('oncall', ''), escalationChain: import './escalationchain.libsonnet', - integration: { - local integration = raw.oncall.v1alpha1.integration, - '#new': d.func.new( - ||| - `new` creates an Integration. The `name` is a display-friendly - string, and `resourceId` defaults to a slug-ified version of it. - `type` is the type of Integration. `providerName` is the resource - name (`myprovider.metadata.name`) of the Provider. - |||, - [ - d.argument.new('name', d.T.string), - d.argument.new('type', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), - ] - ), - new(name, type, providerName, resourceId=null):: - local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); - integration.new(id) - + integration.spec.parameters.providerConfigRef.withName(providerName) - + integration.spec.parameters.forProvider.withName(name) - + integration.spec.parameters.forProvider.withType(type), - - '#withDefaultRoute': d.func.new( - ||| - `withDefaultRoute` configures the default route using an Escalation - Chain object's name. - |||, - [ - d.argument.new('name', d.T.string), - ] - ), - withDefaultRoute(name):: - integration.spec.parameters.forProvider.withDefaultRoute( - integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) - ), - }, + integration: import './integration.libsonnet', route: { local route = raw.oncall.v1alpha1.route, '#new': d.func.new( From fc396ff6c7be689fbf35703291005e082061c207 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:24:41 -0500 Subject: [PATCH 09/37] refactor(oncall): split route API to separate file --- grafanaplane/oncall/main.libsonnet | 27 +------------------------- grafanaplane/oncall/route.libsonnet | 30 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 26 deletions(-) create mode 100644 grafanaplane/oncall/route.libsonnet diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index e55e99b..b0d729d 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -7,30 +7,5 @@ local raw = import '../zz/main.libsonnet'; '#': d.package.newSub('oncall', ''), escalationChain: import './escalationchain.libsonnet', integration: import './integration.libsonnet', - route: { - local route = raw.oncall.v1alpha1.route, - '#new': d.func.new( - ||| - `new` creates a Route. `id` is the resource name. `integrationName` - is the resource name of the Integration to reference. - `escalationChainName` is the resource name of the Escalation Chain to - reference. `routingRegex` is configured as a routing regex, if - supplied. `providerName` is the resource name - (`myprovider.metadata.name`) of the Provider. - |||, - [ - d.argument.new('id', d.T.string), - d.argument.new('integrationName', d.T.string), - d.argument.new('escalationChainName', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('routingRegex', d.T.string, default='null'), - ] - ), - new(id, integrationName, escalationChainName, providerName, routingRegex=null):: - route.new(id) - + route.spec.parameters.providerConfigRef.withName(providerName) - + route.spec.parameters.forProvider.integrationRef.withName(integrationName) - + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) - + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, - }, + route: import './route.libsonnet', } diff --git a/grafanaplane/oncall/route.libsonnet b/grafanaplane/oncall/route.libsonnet new file mode 100644 index 0000000..273c7c8 --- /dev/null +++ b/grafanaplane/oncall/route.libsonnet @@ -0,0 +1,30 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; + +{ + local route = raw.oncall.v1alpha1.route, + '#new': d.func.new( + ||| + `new` creates a Route. `id` is the resource name. `integrationName` + is the resource name of the Integration to reference. + `escalationChainName` is the resource name of the Escalation Chain to + reference. `routingRegex` is configured as a routing regex, if + supplied. `providerName` is the resource name + (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('id', d.T.string), + d.argument.new('integrationName', d.T.string), + d.argument.new('escalationChainName', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('routingRegex', d.T.string, default='null'), + ] + ), + new(id, integrationName, escalationChainName, providerName, routingRegex=null):: + route.new(id) + + route.spec.parameters.providerConfigRef.withName(providerName) + + route.spec.parameters.forProvider.integrationRef.withName(integrationName) + + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) + + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, +} From 956c26fa22e3669b203acd896d96a10fbb462298 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:24:41 -0500 Subject: [PATCH 10/37] feat(oncall): add Schedule API --- grafanaplane/oncall/main.libsonnet | 1 + grafanaplane/oncall/schedule.libsonnet | 27 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 grafanaplane/oncall/schedule.libsonnet diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index b0d729d..122a039 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -8,4 +8,5 @@ local raw = import '../zz/main.libsonnet'; escalationChain: import './escalationchain.libsonnet', integration: import './integration.libsonnet', route: import './route.libsonnet', + schedule: import './schedule.libsonnet', } diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet new file mode 100644 index 0000000..8c3b234 --- /dev/null +++ b/grafanaplane/oncall/schedule.libsonnet @@ -0,0 +1,27 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; + +{ + local schedule = raw.oncall.v1alpha1.schedule, + '#new': d.func.new( + ||| + `new` creates a Schedule. The `name` is a display-friendly + string, and `resourceId` defaults to a slug-ified version of it. + `type` is the type of Schedule. `providerName` is the resource + name (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('type', d.T.string, enums=['ical', 'calendar']), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, type, providerName, resourceId=null):: + schedule.new(resourceId) + + schedule.spec.parameters.providerConfigRef.withName(providerName) + + schedule.spec.parameters.forProvider.withName(name) + + schedule.spec.parameters.forProvider.withType(type), +} From ebb427b71e6c5c3208d1d34a4d7ba59a88a56e56 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 12:24:41 -0500 Subject: [PATCH 11/37] feat(oncall): add Shift API --- grafanaplane/oncall/main.libsonnet | 1 + grafanaplane/oncall/shift.libsonnet | 95 +++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 grafanaplane/oncall/shift.libsonnet diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index 122a039..4e1bd08 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -9,4 +9,5 @@ local raw = import '../zz/main.libsonnet'; integration: import './integration.libsonnet', route: import './route.libsonnet', schedule: import './schedule.libsonnet', + shift: import './shift.libsonnet', } diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet new file mode 100644 index 0000000..0602ee2 --- /dev/null +++ b/grafanaplane/oncall/shift.libsonnet @@ -0,0 +1,95 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; +local shift = raw.oncall.v1alpha1.onCallShift; + +{ + local base = self, + + '#new': d.func.new( + ||| + `new` creates an OnCallShift. The `name` is a display-friendly string, + and `resourceId` defaults to a slug-ified version of it. `type` is the + type of Shift. `start` is the start time of the shift in + `yyyy-MM-dd'T'HH:mm:ss` format. `providerName` is the resource name + (`myprovider.metadata.name`) of the Provider. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('type', d.T.string), + d.argument.new('start', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + new(name, type, start, providerName, resourceId=null):: + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + shift.new(id) + + shift.spec.parameters.providerConfigRef.withName(providerName) + + shift.spec.parameters.forProvider.withName(name) + + shift.spec.parameters.forProvider.withType(type) + + shift.spec.parameters.forProvider.withStart(start), + + '#newRollingUsers': d.func.new( + ||| + `newRollingUsers` creates an OnCallShift of `rolling_users` type. The + `name` is a display-friendly string, and `resourceId` defaults to a + slug-ified version of it. `rollingUsers` is the list of users as an array + of strings. `start` is the start time of the shift in + `yyyy-MM-dd'T'HH:mm:ss` format. `duration` is the length of each shift in + seconds. `interval` is the interval at which the recurrence rule repeats. + `providerName` is the resource name (`myprovider.metadata.name`) of the + Provider. `byDay` is a list of days in iCal format on which the shift + takes place. `byMonth` is a list of months in which the shift takes + place. `byMonthDay` is a list of month days on which the shift takes + place. If any of `byDay`, `byMonth`, or `byMonthDay` is `null` (default), + it is omitted. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('rollingUsers', d.T.array), + d.argument.new('start', d.T.string), + d.argument.new('duration', d.T.number), + d.argument.new('interval', d.T.number), + d.argument.new('providerName', d.T.string), + d.argument.new('byDay', d.T.array, default='null'), + d.argument.new('byMonth', d.T.array, default='null'), + d.argument.new('byMonthDay', d.T.array, default='null'), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + newRollingUsers( + name, + start, + duration, + interval, + rollingUsers, + providerName, + byDay=null, + byMonth=null, + byMonthDay=null, + resourceId=null, + ):: + base.new(name, 'rolling_users', start, providerName, resourceId) + + shift.spec.parameters.forProvider.withRollingUsers(rollingUsers) + + shift.spec.parameters.forProvider.withDuration(duration) + + shift.spec.parameters.forProvider.withInterval(interval) + + ( + if byDay != null + then shift.spec.parameters.forProvider.withByDay(byDay) + else {} + ) + + ( + if byMonth != null + then shift.spec.parameters.forProvider.withByMonth(byMonth) + else {} + ) + + ( + if byMonthDay != null + then shift.spec.parameters.forProvider.withByMonthDay(byMonthDay) + else {} + ), +} +// Add the forProvider functions here for convenience. ++ shift.spec.parameters.forProvider From 02b30a790210c9fafad785efc7c755aab7fc6487 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 15:29:46 -0500 Subject: [PATCH 12/37] fix(oncall): use name as fallback for Schedule resourceId --- grafanaplane/oncall/schedule.libsonnet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 8c3b234..a7bdeaf 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -20,7 +20,8 @@ local raw = import '../zz/main.libsonnet'; ] ), new(name, type, providerName, resourceId=null):: - schedule.new(resourceId) + local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + schedule.new(id) + schedule.spec.parameters.providerConfigRef.withName(providerName) + schedule.spec.parameters.forProvider.withName(name) + schedule.spec.parameters.forProvider.withType(type), From 55a3b12cf1a66264e0c3c249869a9b62f52b85dd Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 15:30:48 -0500 Subject: [PATCH 13/37] feat(oncall): add newCalendar constructor for Schedules --- grafanaplane/oncall/schedule.libsonnet | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index a7bdeaf..e3963da 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -4,6 +4,7 @@ local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; local raw = import '../zz/main.libsonnet'; { + local this = self, local schedule = raw.oncall.v1alpha1.schedule, '#new': d.func.new( ||| @@ -25,4 +26,34 @@ local raw = import '../zz/main.libsonnet'; + schedule.spec.parameters.providerConfigRef.withName(providerName) + schedule.spec.parameters.forProvider.withName(name) + schedule.spec.parameters.forProvider.withType(type), + + '#newCalendar': d.func.new( + ||| + `newCalendar` creates a Schedule with type `calendar`. 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. If supplied, `shiftNames` + are supplied to `withShiftsRef` to associate an array of shifts by + resource name. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new('shiftNames', d.T.array, default='[]'), + d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + ] + ), + newCalendar(name, providerName, shiftNames=[], resourceId=null):: + this.new(name, 'calendar', providerName, resourceId) + + this.withShiftsRef(shiftNames), + + '#withShifts': d.func.new(||| + `withShifts` sets an array of `shiftsRef` objects on a Schedule. `names` is + an array of OnCallShift resource names. + |||), + withShiftsRef(names):: + schedule.spec.parameters.forProvider.withShiftsRef([ + schedule.spec.parameters.forProvider.shiftsRef.withName(name) + for name in names + ]), } From 78836248738a6dd493cee87e31d3bdcaff78465f Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 16:04:45 -0500 Subject: [PATCH 14/37] feat(oncall): add initial Escalations API --- grafanaplane/oncall/escalation.libsonnet | 140 +++++++++++++++++++++++ grafanaplane/oncall/main.libsonnet | 1 + 2 files changed, 141 insertions(+) create mode 100644 grafanaplane/oncall/escalation.libsonnet diff --git a/grafanaplane/oncall/escalation.libsonnet b/grafanaplane/oncall/escalation.libsonnet new file mode 100644 index 0000000..b0d4ad5 --- /dev/null +++ b/grafanaplane/oncall/escalation.libsonnet @@ -0,0 +1,140 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; +local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; + +local raw = import '../zz/main.libsonnet'; + +{ + local this = self, + local escalation = raw.oncall.v1alpha1.escalation, + + '#new': d.func.new( + ||| + `new` creates an Escalation. `escalationChainName` is the resource name + (`myescalationchain.metadata.name`) of the parent Escalation Chain. + `position` is the position of the Escalation in the chain. `type` is the + Escalation type. `providerName` is the resource name + (`myprovider.metadata.name`) of the Provider. `resourceId` defaults to + `-`. + |||, + [ + d.argument.new('escalationChainName', d.T.string), + d.argument.new('position', d.T.number), + d.argument.new('type', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new( + 'resourceId', + d.T.string, + default='-' + ), + ] + ), + new( + escalationChainName, + position, + type, + providerName, + resourceId='%s-%d' % [escalationChainName, position] + ):: + escalation.new(resourceId) + + escalation.spec.parameters.providerConfigRef.withName(providerName) + + escalation.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) + + escalation.spec.parameters.forProvider.withPosition(position) + + escalation.spec.parameters.forProvider.withType(type), + + '#newNotifyOnCallFromSchedule': d.func.new( + ||| + `newNotifyOnCallFromSchedule` creates an Escalation of type + `noitfy_on_call_from_schedule`. `escalationChainName` is the resource + name (`myescalationchain.metadata.name`) of the parent Escalation Chain. + `position` is the position of the Escalation in the chain. `scheduleName` + is the resource name of the Schedule to reference. `providerName` is the + resource name (`myprovider.metadata.name`) of the Provider. `resourceId` + defaults to `-`. + |||, + [ + d.argument.new('escalationChainName', d.T.string), + d.argument.new('position', d.T.number), + d.argument.new('scheduleName', d.T.string), + d.argument.new('providerName', d.T.string), + d.argument.new( + 'resourceId', + d.T.string, + default='-' + ), + ] + ), + newNotifyOnCallFromSchedule( + escalationChainName, + position, + scheduleName, + providerName, + resourceId='%s-%d' % [escalationChainName, position] + ):: + this.new(escalationChainName, position, 'notify_on_call_from_schedule', providerName, resourceId) + + escalation.spec.parameters.forProvider.withNotifyOnCallFromScheduleRef( + escalation.spec.parameters.forProvider.notifyOnCallFromScheduleRef.withName(scheduleName) + ), + + '#newNotifyPersons': d.func.new( + ||| + `newNotifyPersons` creates an Escalation of type `noitfy_persons`. + `escalationChainName` is the resource name + (`myescalationchain.metadata.name`) of the parent Escalation Chain. + `position` is the position of the Escalation in the chain. `persons` is + the array of persons (by email address) to notify. `providerName` is the + resource name (`myprovider.metadata.name`) of the Provider. `resourceId` + defaults to `-`. + |||, + [ + d.argument.new('escalationChainName', d.T.string), + d.argument.new('position', d.T.number), + d.argument.new('persons', d.T.array), + d.argument.new('providerName', d.T.string), + d.argument.new( + 'resourceId', + d.T.string, + default='-' + ), + ] + ), + newNotifyPersons( + escalationChainName, + position, + persons, + providerName, + resourceId='%s-%d' % [escalationChainName, position] + ):: + this.new(escalationChainName, position, 'notify_persons', providerName, resourceId) + + escalation.spec.parameters.forProvider.withPersonsToNotify(persons), + + '#newWait': d.func.new( + ||| + `newWait` creates an Escalation of type `wait`. `escalationChainName` is + the resource name (`myescalationchain.metadata.name`) of the parent + Escalation Chain. `position` is the position of the Escalation in the + chain. `duration` is the duration in seconds to wait. `providerName` is + the resource name (`myprovider.metadata.name`) of the Provider. + `resourceId` defaults to `-`. + |||, + [ + d.argument.new('escalationChainName', d.T.string), + d.argument.new('position', d.T.number), + d.argument.new('duration', d.T.number), + d.argument.new('providerName', d.T.string), + d.argument.new( + 'resourceId', + d.T.string, + default='-' + ), + ] + ), + newWait( + escalationChainName, + position, + duration, + providerName, + resourceId='%s-%d' % [escalationChainName, position] + ):: + this.new(escalationChainName, position, 'wait', providerName, resourceId) + + escalation.spec.parameters.forProvider.withDuration(duration), +} diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index 4e1bd08..128c5f2 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -6,6 +6,7 @@ local raw = import '../zz/main.libsonnet'; { '#': d.package.newSub('oncall', ''), escalationChain: import './escalationchain.libsonnet', + escalation: import './escalation.libsonnet', integration: import './integration.libsonnet', route: import './route.libsonnet', schedule: import './schedule.libsonnet', From 3621a00955b049dfa0095d292f8369b6bbe5f23e Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 30 Dec 2024 16:05:00 -0500 Subject: [PATCH 15/37] docs(oncall): generate docs --- docs/README.md | 1 + docs/oncall.md | 592 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 593 insertions(+) create mode 100644 docs/oncall.md diff --git a/docs/README.md b/docs/README.md index 8dd00db..4018c35 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,6 +24,7 @@ local grafanaplane = import 'github.com/grafana/grafana-crossplane-libsonnet/gra ## Subpackages * [configurations](configurations.md) +* [oncall](oncall.md) * [oss](oss/index.md) * [raw](raw/index.md) * [sm](sm/index.md) diff --git a/docs/oncall.md b/docs/oncall.md new file mode 100644 index 0000000..0c70c85 --- /dev/null +++ b/docs/oncall.md @@ -0,0 +1,592 @@ +# oncall + + + +## Index + +* [`obj escalation`](#obj-escalation) + * [`fn new(escalationChainName, position, type, providerName, resourceId="-")`](#fn-escalationnew) + * [`fn newNotifyOnCallFromSchedule(escalationChainName, position, scheduleName, providerName, resourceId="-")`](#fn-escalationnewnotifyoncallfromschedule) + * [`fn newNotifyPersons(escalationChainName, position, persons, providerName, resourceId="-")`](#fn-escalationnewnotifypersons) + * [`fn newWait(escalationChainName, position, duration, providerName, resourceId="-")`](#fn-escalationnewwait) +* [`obj escalationChain`](#obj-escalationchain) + * [`fn new(name, providerName, resourceId="rfc1123(name)")`](#fn-escalationchainnew) +* [`obj integration`](#obj-integration) + * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-integrationnew) + * [`fn withDefaultRoute(name)`](#fn-integrationwithdefaultroute) +* [`obj route`](#obj-route) + * [`fn new(id, integrationName, escalationChainName, providerName, routingRegex="null")`](#fn-routenew) +* [`obj schedule`](#obj-schedule) + * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-schedulenew) + * [`fn newCalendar(name, providerName, shiftNames="[]", resourceId="rfc1123(name)")`](#fn-schedulenewcalendar) +* [`obj shift`](#obj-shift) + * [`fn new(name, type, start, providerName, resourceId="rfc1123(name)")`](#fn-shiftnew) + * [`fn newRollingUsers(name, rollingUsers, start, duration, interval, providerName, byDay="null", byMonth="null", byMonthDay="null", resourceId="rfc1123(name)")`](#fn-shiftnewrollingusers) + * [`fn withByDay(value)`](#fn-shiftwithbyday) + * [`fn withByDayMixin(value)`](#fn-shiftwithbydaymixin) + * [`fn withByMonth(value)`](#fn-shiftwithbymonth) + * [`fn withByMonthMixin(value)`](#fn-shiftwithbymonthmixin) + * [`fn withByMonthday(value)`](#fn-shiftwithbymonthday) + * [`fn withByMonthdayMixin(value)`](#fn-shiftwithbymonthdaymixin) + * [`fn withDuration(value)`](#fn-shiftwithduration) + * [`fn withFrequency(value)`](#fn-shiftwithfrequency) + * [`fn withInterval(value)`](#fn-shiftwithinterval) + * [`fn withLevel(value)`](#fn-shiftwithlevel) + * [`fn withName(value)`](#fn-shiftwithname) + * [`fn withRollingUsers(value)`](#fn-shiftwithrollingusers) + * [`fn withRollingUsersMixin(value)`](#fn-shiftwithrollingusersmixin) + * [`fn withStart(value)`](#fn-shiftwithstart) + * [`fn withStartRotationFromUserIndex(value)`](#fn-shiftwithstartrotationfromuserindex) + * [`fn withTeamId(value)`](#fn-shiftwithteamid) + * [`fn withTimeZone(value)`](#fn-shiftwithtimezone) + * [`fn withType(value)`](#fn-shiftwithtype) + * [`fn withUntil(value)`](#fn-shiftwithuntil) + * [`fn withUsers(value)`](#fn-shiftwithusers) + * [`fn withUsersMixin(value)`](#fn-shiftwithusersmixin) + * [`fn withWeekStart(value)`](#fn-shiftwithweekstart) + +## Fields + +### obj escalation + + +#### fn escalation.new + +```jsonnet +escalation.new(escalationChainName, position, type, providerName, resourceId="-") +``` + +PARAMETERS: + +* **escalationChainName** (`string`) +* **position** (`number`) +* **type** (`string`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"-"` + +`new` creates an Escalation. `escalationChainName` is the resource name +(`myescalationchain.metadata.name`) of the parent Escalation Chain. +`position` is the position of the Escalation in the chain. `type` is the +Escalation type. `providerName` is the resource name +(`myprovider.metadata.name`) of the Provider. `resourceId` defaults to +`-`. + +#### fn escalation.newNotifyOnCallFromSchedule + +```jsonnet +escalation.newNotifyOnCallFromSchedule(escalationChainName, position, scheduleName, providerName, resourceId="-") +``` + +PARAMETERS: + +* **escalationChainName** (`string`) +* **position** (`number`) +* **scheduleName** (`string`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"-"` + +`newNotifyOnCallFromSchedule` creates an Escalation of type +`noitfy_on_call_from_schedule`. `escalationChainName` is the resource +name (`myescalationchain.metadata.name`) of the parent Escalation Chain. +`position` is the position of the Escalation in the chain. `scheduleName` +is the resource name of the Schedule to reference. `providerName` is the +resource name (`myprovider.metadata.name`) of the Provider. `resourceId` +defaults to `-`. + +#### fn escalation.newNotifyPersons + +```jsonnet +escalation.newNotifyPersons(escalationChainName, position, persons, providerName, resourceId="-") +``` + +PARAMETERS: + +* **escalationChainName** (`string`) +* **position** (`number`) +* **persons** (`array`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"-"` + +`newNotifyPersons` creates an Escalation of type `noitfy_persons`. +`escalationChainName` is the resource name +(`myescalationchain.metadata.name`) of the parent Escalation Chain. +`position` is the position of the Escalation in the chain. `persons` is +the array of persons (by email address) to notify. `providerName` is the +resource name (`myprovider.metadata.name`) of the Provider. `resourceId` +defaults to `-`. + +#### fn escalation.newWait + +```jsonnet +escalation.newWait(escalationChainName, position, duration, providerName, resourceId="-") +``` + +PARAMETERS: + +* **escalationChainName** (`string`) +* **position** (`number`) +* **duration** (`number`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"-"` + +`newWait` creates an Escalation of type `wait`. `escalationChainName` is +the resource name (`myescalationchain.metadata.name`) of the parent +Escalation Chain. `position` is the position of the Escalation in the +chain. `duration` is the duration in seconds to wait. `providerName` is +the resource name (`myprovider.metadata.name`) of the Provider. +`resourceId` defaults to `-`. + +### obj escalationChain + + +#### fn escalationChain.new + +```jsonnet +escalationChain.new(name, providerName, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`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. + +### obj integration + + +#### fn integration.new + +```jsonnet +integration.new(name, type, providerName, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **type** (`string`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates an Integration. The `name` is a display-friendly +string, and `resourceId` defaults to a slug-ified version of it. +`type` is the type of Integration. `providerName` is the resource +name (`myprovider.metadata.name`) of the Provider. + +#### fn integration.withDefaultRoute + +```jsonnet +integration.withDefaultRoute(name) +``` + +PARAMETERS: + +* **name** (`string`) + +`withDefaultRoute` configures the default route using an Escalation +Chain object's name. + +### obj route + + +#### fn route.new + +```jsonnet +route.new(id, integrationName, escalationChainName, providerName, routingRegex="null") +``` + +PARAMETERS: + +* **id** (`string`) +* **integrationName** (`string`) +* **escalationChainName** (`string`) +* **providerName** (`string`) +* **routingRegex** (`string`) + - default value: `"null"` + +`new` creates a Route. `id` is the resource name. `integrationName` +is the resource name of the Integration to reference. +`escalationChainName` is the resource name of the Escalation Chain to +reference. `routingRegex` is configured as a routing regex, if +supplied. `providerName` is the resource name +(`myprovider.metadata.name`) of the Provider. + +### obj schedule + + +#### fn schedule.new + +```jsonnet +schedule.new(name, type, providerName, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **type** (`string`) + - valid values: `"ical"`, `"calendar"` +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates a Schedule. The `name` is a display-friendly +string, and `resourceId` defaults to a slug-ified version of it. +`type` is the type of Schedule. `providerName` is the resource +name (`myprovider.metadata.name`) of the Provider. + +#### fn schedule.newCalendar + +```jsonnet +schedule.newCalendar(name, providerName, shiftNames="[]", resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **providerName** (`string`) +* **shiftNames** (`array`) + - default value: `"[]"` +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`newCalendar` creates a Schedule with type `calendar`. 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. If supplied, `shiftNames` +are supplied to `withShiftsRef` to associate an array of shifts by +resource name. + +### obj shift + + +#### fn shift.new + +```jsonnet +shift.new(name, type, start, providerName, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **type** (`string`) +* **start** (`string`) +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates an OnCallShift. The `name` is a display-friendly string, +and `resourceId` defaults to a slug-ified version of it. `type` is the +type of Shift. `start` is the start time of the shift in +`yyyy-MM-dd'T'HH:mm:ss` format. `providerName` is the resource name +(`myprovider.metadata.name`) of the Provider. + +#### fn shift.newRollingUsers + +```jsonnet +shift.newRollingUsers(name, rollingUsers, start, duration, interval, providerName, byDay="null", byMonth="null", byMonthDay="null", resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **rollingUsers** (`array`) +* **start** (`string`) +* **duration** (`number`) +* **interval** (`number`) +* **providerName** (`string`) +* **byDay** (`array`) + - default value: `"null"` +* **byMonth** (`array`) + - default value: `"null"` +* **byMonthDay** (`array`) + - default value: `"null"` +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`newRollingUsers` creates an OnCallShift of `rolling_users` type. The +`name` is a display-friendly string, and `resourceId` defaults to a +slug-ified version of it. `rollingUsers` is the list of users as an array +of strings. `start` is the start time of the shift in +`yyyy-MM-dd'T'HH:mm:ss` format. `duration` is the length of each shift in +seconds. `interval` is the interval at which the recurrence rule repeats. +`providerName` is the resource name (`myprovider.metadata.name`) of the +Provider. `byDay` is a list of days in iCal format on which the shift +takes place. `byMonth` is a list of months in which the shift takes +place. `byMonthDay` is a list of month days on which the shift takes +place. If any of `byDay`, `byMonth`, or `byMonthDay` is `null` (default), +it is omitted. + +#### fn shift.withByDay + +```jsonnet +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 +#### fn shift.withByDayMixin + +```jsonnet +shift.withByDayMixin(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 +#### fn shift.withByMonth + +```jsonnet +shift.withByMonth(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 +This parameter takes a list of months. Valid values are 1 to 12 +#### fn shift.withByMonthMixin + +```jsonnet +shift.withByMonthMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 +This parameter takes a list of months. Valid values are 1 to 12 +#### fn shift.withByMonthday + +```jsonnet +shift.withByMonthday(value) +``` + +PARAMETERS: + +* **value** (`array`) + +31 to -1 +This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 +#### fn shift.withByMonthdayMixin + +```jsonnet +shift.withByMonthdayMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +31 to -1 +This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 +#### fn shift.withDuration + +```jsonnet +shift.withDuration(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The duration of the event. +The duration of the event. +#### fn shift.withFrequency + +```jsonnet +shift.withFrequency(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The frequency of the event. Can be hourly, daily, weekly, monthly +The frequency of the event. Can be hourly, daily, weekly, monthly +#### fn shift.withInterval + +```jsonnet +shift.withInterval(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The positive integer representing at which intervals the recurrence rule repeats. +The positive integer representing at which intervals the recurrence rule repeats. +#### fn shift.withLevel + +```jsonnet +shift.withLevel(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The priority level. The higher the value, the higher the priority. +The priority level. The higher the value, the higher the priority. +#### fn shift.withName + +```jsonnet +shift.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's name. +The shift's name. +#### fn shift.withRollingUsers + +```jsonnet +shift.withRollingUsers(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for rolling_users event type) +The list of lists with on-call users (for rolling_users event type) +#### fn shift.withRollingUsersMixin + +```jsonnet +shift.withRollingUsersMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for rolling_users event type) +The list of lists with on-call users (for rolling_users event type) +#### fn shift.withStart + +```jsonnet +shift.withStart(value) +``` + +PARAMETERS: + +* **value** (`string`) + +call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +The start time of the on-call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +#### fn shift.withStartRotationFromUserIndex + +```jsonnet +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. +#### fn shift.withTeamId + +```jsonnet +shift.withTeamId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. +The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. +#### fn shift.withTimeZone + +```jsonnet +shift.withTimeZone(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's timezone. Overrides schedule's timezone. +The shift's timezone. Overrides schedule's timezone. +#### fn shift.withType + +```jsonnet +shift.withType(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's type. Can be rolling_users, recurrent_event, single_event +The shift's type. Can be rolling_users, recurrent_event, single_event +#### fn shift.withUntil + +```jsonnet +shift.withUntil(value) +``` + +PARAMETERS: + +* **value** (`string`) + +call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +The end time of recurrent on-call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +#### fn shift.withUsers + +```jsonnet +shift.withUsers(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for single_event and recurrent_event event type). +The list of on-call users (for single_event and recurrent_event event type). +#### fn shift.withUsersMixin + +```jsonnet +shift.withUsersMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for single_event and recurrent_event event type). +The list of on-call users (for single_event and recurrent_event event type). +#### fn shift.withWeekStart + +```jsonnet +shift.withWeekStart(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU +Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU \ No newline at end of file From 318bdf94f996e65ed83ccc512c442aa893be87e8 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 13:55:32 -0500 Subject: [PATCH 16/37] refactor(oncall): reduce duplication in the Shift API --- grafanaplane/oncall/shift.libsonnet | 94 ++++++++--------------------- 1 file changed, 25 insertions(+), 69 deletions(-) diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 0602ee2..471458f 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -4,92 +4,48 @@ local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; local raw = import '../zz/main.libsonnet'; local shift = raw.oncall.v1alpha1.onCallShift; +// Add the forProvider functions here for convenience. +shift.spec.parameters.forProvider { local base = self, '#new': d.func.new( ||| `new` creates an OnCallShift. The `name` is a display-friendly string, - and `resourceId` defaults to a slug-ified version of it. `type` is the - type of Shift. `start` is the start time of the shift in - `yyyy-MM-dd'T'HH:mm:ss` format. `providerName` is the resource name - (`myprovider.metadata.name`) of the Provider. + and `id` defaults to a slug-ified version of it. |||, [ d.argument.new('name', d.T.string), - d.argument.new('type', d.T.string), - d.argument.new('start', d.T.string), - d.argument.new('providerName', d.T.string), d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, start, providerName, resourceId=null):: - local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + new(name, id=xtd.ascii.stringToRFC1123(name)):: shift.new(id) - + shift.spec.parameters.providerConfigRef.withName(providerName) - + shift.spec.parameters.forProvider.withName(name) - + shift.spec.parameters.forProvider.withType(type) - + shift.spec.parameters.forProvider.withStart(start), + + shift.spec.parameters.forProvider.withName(name), + + '#withStart':: d.func.new( + ||| + `withStart` sets the start time of the shift in `yyyy-MM-dd'T'HH:mm:ss` + format. + |||, + [d.argument.new('start', d.T.string)] + ), + withStart(start):: shift.spec.parameters.forProvider.withStart(start), - '#newRollingUsers': d.func.new( + '#withRollingUsers': d.func.new( ||| - `newRollingUsers` creates an OnCallShift of `rolling_users` type. The - `name` is a display-friendly string, and `resourceId` defaults to a - slug-ified version of it. `rollingUsers` is the list of users as an array - of strings. `start` is the start time of the shift in - `yyyy-MM-dd'T'HH:mm:ss` format. `duration` is the length of each shift in - seconds. `interval` is the interval at which the recurrence rule repeats. - `providerName` is the resource name (`myprovider.metadata.name`) of the - Provider. `byDay` is a list of days in iCal format on which the shift - takes place. `byMonth` is a list of months in which the shift takes - place. `byMonthDay` is a list of month days on which the shift takes - place. If any of `byDay`, `byMonth`, or `byMonthDay` is `null` (default), - it is omitted. + `withRollingUsers` sets an OnCallShift to type `rolling_users` and + configures required fields. `users` must be an array *of arrays* + of strings referring to users by email address. `frequency` is required + for this shift type. |||, [ - d.argument.new('name', d.T.string), - d.argument.new('rollingUsers', d.T.array), - d.argument.new('start', d.T.string), - d.argument.new('duration', d.T.number), - d.argument.new('interval', d.T.number), - d.argument.new('providerName', d.T.string), - d.argument.new('byDay', d.T.array, default='null'), - d.argument.new('byMonth', d.T.array, default='null'), - d.argument.new('byMonthDay', d.T.array, default='null'), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + d.argument.new('frequency', d.T.string, enums=['hourly', 'daily', 'weekly', 'monthly']), + d.argument.new('users', d.T.array), ] ), - newRollingUsers( - name, - start, - duration, - interval, - rollingUsers, - providerName, - byDay=null, - byMonth=null, - byMonthDay=null, - resourceId=null, - ):: - base.new(name, 'rolling_users', start, providerName, resourceId) - + shift.spec.parameters.forProvider.withRollingUsers(rollingUsers) - + shift.spec.parameters.forProvider.withDuration(duration) - + shift.spec.parameters.forProvider.withInterval(interval) - + ( - if byDay != null - then shift.spec.parameters.forProvider.withByDay(byDay) - else {} - ) - + ( - if byMonth != null - then shift.spec.parameters.forProvider.withByMonth(byMonth) - else {} - ) - + ( - if byMonthDay != null - then shift.spec.parameters.forProvider.withByMonthDay(byMonthDay) - else {} - ), + withRollingUsers(frequency, users):: + shift.spec.parameters.forProvider.withType('rolling_users') + + shift.spec.parameters.forProvider.withRollingUsers(users) + + shift.spec.parameters.forProvider.withFrequency(frequency), } -// Add the forProvider functions here for convenience. -+ shift.spec.parameters.forProvider From 5acf8ca30839f1c7999de203b7389dd405d5b00c Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 14:06:47 -0500 Subject: [PATCH 17/37] refactor(oncall): use super to improve the Shift API --- grafanaplane/oncall/shift.libsonnet | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 471458f..43e5901 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -4,11 +4,9 @@ local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; local raw = import '../zz/main.libsonnet'; local shift = raw.oncall.v1alpha1.onCallShift; -// Add the forProvider functions here for convenience. +// Lift forProvider functions here for convenience. shift.spec.parameters.forProvider { - local base = self, - '#new': d.func.new( ||| `new` creates an OnCallShift. The `name` is a display-friendly string, @@ -21,16 +19,7 @@ shift.spec.parameters.forProvider ), new(name, id=xtd.ascii.stringToRFC1123(name)):: shift.new(id) - + shift.spec.parameters.forProvider.withName(name), - - '#withStart':: d.func.new( - ||| - `withStart` sets the start time of the shift in `yyyy-MM-dd'T'HH:mm:ss` - format. - |||, - [d.argument.new('start', d.T.string)] - ), - withStart(start):: shift.spec.parameters.forProvider.withStart(start), + + super.withName(name), '#withRollingUsers': d.func.new( ||| @@ -45,7 +34,7 @@ shift.spec.parameters.forProvider ] ), withRollingUsers(frequency, users):: - shift.spec.parameters.forProvider.withType('rolling_users') - + shift.spec.parameters.forProvider.withRollingUsers(users) - + shift.spec.parameters.forProvider.withFrequency(frequency), + super.withType('rolling_users') + + super.withRollingUsers(users) + + super.withFrequency(frequency), } From 06a3c0c21c6373c4db3b644edb6423b20cec3477 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 14:22:24 -0500 Subject: [PATCH 18/37] fix(oncall): make Shift member visibility consistent --- grafanaplane/oncall/shift.libsonnet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 43e5901..a064374 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -7,7 +7,7 @@ local shift = raw.oncall.v1alpha1.onCallShift; // Lift forProvider functions here for convenience. shift.spec.parameters.forProvider { - '#new': d.func.new( + '#new':: d.func.new( ||| `new` creates an OnCallShift. The `name` is a display-friendly string, and `id` defaults to a slug-ified version of it. @@ -21,7 +21,7 @@ shift.spec.parameters.forProvider shift.new(id) + super.withName(name), - '#withRollingUsers': d.func.new( + '#withRollingUsers':: d.func.new( ||| `withRollingUsers` sets an OnCallShift to type `rolling_users` and configures required fields. `users` must be an array *of arrays* From 05b7c31fab2925cb2125f0ddec98a13a5aa832f6 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 15:06:54 -0500 Subject: [PATCH 19/37] refactor(oncall): refactor Schedule API to reduce duplication --- grafanaplane/oncall/schedule.libsonnet | 73 ++++++++++++++------------ 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index e3963da..4d7bd0b 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -2,16 +2,17 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; 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 this = self, - local schedule = raw.oncall.v1alpha1.schedule, + local base = self, + '#new': d.func.new( ||| `new` creates a Schedule. The `name` is a display-friendly - string, and `resourceId` defaults to a slug-ified version of it. - `type` is the type of Schedule. `providerName` is the resource - name (`myprovider.metadata.name`) of the Provider. + string, and `id` defaults to a slug-ified version of it. |||, [ d.argument.new('name', d.T.string), @@ -20,40 +21,46 @@ local raw = import '../zz/main.libsonnet'; d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, providerName, resourceId=null):: - local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + new(name, id=xtd.ascii.stringToRFC1123(name)):: schedule.new(id) - + schedule.spec.parameters.providerConfigRef.withName(providerName) - + schedule.spec.parameters.forProvider.withName(name) - + schedule.spec.parameters.forProvider.withType(type), + + schedule.spec.parameters.forProvider.withName(name), - '#newCalendar': d.func.new( + '#withShifts': d.func.new( ||| - `newCalendar` creates a Schedule with type `calendar`. 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. If supplied, `shiftNames` - are supplied to `withShiftsRef` to associate an array of shifts by - resource name. + `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. |||, [ - d.argument.new('name', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('shiftNames', d.T.array, default='[]'), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + d.argument.new('shifts', d.T.array, default='null'), ] ), - newCalendar(name, providerName, shiftNames=[], resourceId=null):: - this.new(name, 'calendar', providerName, resourceId) - + this.withShiftsRef(shiftNames), - - '#withShifts': d.func.new(||| - `withShifts` sets an array of `shiftsRef` objects on a Schedule. `names` is - an array of OnCallShift resource names. - |||), - withShiftsRef(names):: - schedule.spec.parameters.forProvider.withShiftsRef([ - schedule.spec.parameters.forProvider.shiftsRef.withName(name) - for name in names + withShifts(shifts=null):: + super.withType('calendar') + + super.withShiftsRef([ + if std.isString(shift) + then base.shiftsRef.fromName(shift) + else base.shiftsRef.fromManifest(shift) + for shift in shifts ]), + + shiftsRef+: { + '#fromName':: d.func.new( + ||| + Construct a `shiftsRef` from a Shift's resource `name`. + |||, + [d.argument.new('name', d.T.string)] + ), + fromName(name):: + forProvider.shiftsRef.withName(name), + + '#fromManifest':: d.func.new( + ||| + Construct a `shiftsRef` from a Shift manifest. + |||, + [d.argument.new('manifest', d.T.object)] + ), + fromManifest(manifest):: + forProvider.shiftsRef.withName(manifest.metadata.name), + }, } From cde38e84b8bebc844824d19dbb3cb710ecd2ced9 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 15:22:38 -0500 Subject: [PATCH 20/37] refactor(oncall): add getName util to simplify Schedule logic --- grafanaplane/oncall/schedule.libsonnet | 29 ++++---------------------- grafanaplane/util.libsonnet | 17 +++++++++++++++ 2 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 grafanaplane/util.libsonnet diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 4d7bd0b..f6510d2 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -1,6 +1,7 @@ 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; @@ -9,7 +10,7 @@ forProvider // raise forProvider functions to here { local base = self, - '#new': d.func.new( + '#new':: d.func.new( ||| `new` creates a Schedule. The `name` is a display-friendly string, and `id` defaults to a slug-ified version of it. @@ -25,7 +26,7 @@ forProvider // raise forProvider functions to here schedule.new(id) + schedule.spec.parameters.forProvider.withName(name), - '#withShifts': d.func.new( + '#withShifts':: d.func.new( ||| `withShifts` sets a Schedule to type `calendar` and configures shifts. Shifts are only applicable to `calendar` type Schedules. `shifts` is an @@ -38,29 +39,7 @@ forProvider // raise forProvider functions to here withShifts(shifts=null):: super.withType('calendar') + super.withShiftsRef([ - if std.isString(shift) - then base.shiftsRef.fromName(shift) - else base.shiftsRef.fromManifest(shift) + super.shiftsRef.withName(util.getName(shift)) for shift in shifts ]), - - shiftsRef+: { - '#fromName':: d.func.new( - ||| - Construct a `shiftsRef` from a Shift's resource `name`. - |||, - [d.argument.new('name', d.T.string)] - ), - fromName(name):: - forProvider.shiftsRef.withName(name), - - '#fromManifest':: d.func.new( - ||| - Construct a `shiftsRef` from a Shift manifest. - |||, - [d.argument.new('manifest', d.T.object)] - ), - fromManifest(manifest):: - forProvider.shiftsRef.withName(manifest.metadata.name), - }, } diff --git a/grafanaplane/util.libsonnet b/grafanaplane/util.libsonnet new file mode 100644 index 0000000..1c1b8c4 --- /dev/null +++ b/grafanaplane/util.libsonnet @@ -0,0 +1,17 @@ +local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; + +{ + '#':: d.package.newSub('util', 'internal utilities'), + + '#getName':: d.func.new( + ||| + `getName` is supplied either a name or a manifest, and returns just the + name as a string. + |||, + [d.argument.new('nameOrManifest', 'string|object')] + ), + getName(nameOrManifest):: + if std.isString(nameOrManifest) + then nameOrManifest + else nameOrManifest.metadata.name, +} From 338f3e19995bbfbf401b83759a92e1e8ed6776fe Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 16:29:12 -0500 Subject: [PATCH 21/37] refactor(oncall): reorganize Escalation Chain API to reduce duplication Co-authored-by: Jeroen Op 't Eynde --- grafanaplane/oncall/escalation.libsonnet | 140 ------------------ grafanaplane/oncall/escalationchain.libsonnet | 86 +++++++++-- 2 files changed, 74 insertions(+), 152 deletions(-) delete mode 100644 grafanaplane/oncall/escalation.libsonnet diff --git a/grafanaplane/oncall/escalation.libsonnet b/grafanaplane/oncall/escalation.libsonnet deleted file mode 100644 index b0d4ad5..0000000 --- a/grafanaplane/oncall/escalation.libsonnet +++ /dev/null @@ -1,140 +0,0 @@ -local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; -local xtd = import 'github.com/jsonnet-libs/xtd/main.libsonnet'; - -local raw = import '../zz/main.libsonnet'; - -{ - local this = self, - local escalation = raw.oncall.v1alpha1.escalation, - - '#new': d.func.new( - ||| - `new` creates an Escalation. `escalationChainName` is the resource name - (`myescalationchain.metadata.name`) of the parent Escalation Chain. - `position` is the position of the Escalation in the chain. `type` is the - Escalation type. `providerName` is the resource name - (`myprovider.metadata.name`) of the Provider. `resourceId` defaults to - `-`. - |||, - [ - d.argument.new('escalationChainName', d.T.string), - d.argument.new('position', d.T.number), - d.argument.new('type', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new( - 'resourceId', - d.T.string, - default='-' - ), - ] - ), - new( - escalationChainName, - position, - type, - providerName, - resourceId='%s-%d' % [escalationChainName, position] - ):: - escalation.new(resourceId) - + escalation.spec.parameters.providerConfigRef.withName(providerName) - + escalation.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) - + escalation.spec.parameters.forProvider.withPosition(position) - + escalation.spec.parameters.forProvider.withType(type), - - '#newNotifyOnCallFromSchedule': d.func.new( - ||| - `newNotifyOnCallFromSchedule` creates an Escalation of type - `noitfy_on_call_from_schedule`. `escalationChainName` is the resource - name (`myescalationchain.metadata.name`) of the parent Escalation Chain. - `position` is the position of the Escalation in the chain. `scheduleName` - is the resource name of the Schedule to reference. `providerName` is the - resource name (`myprovider.metadata.name`) of the Provider. `resourceId` - defaults to `-`. - |||, - [ - d.argument.new('escalationChainName', d.T.string), - d.argument.new('position', d.T.number), - d.argument.new('scheduleName', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new( - 'resourceId', - d.T.string, - default='-' - ), - ] - ), - newNotifyOnCallFromSchedule( - escalationChainName, - position, - scheduleName, - providerName, - resourceId='%s-%d' % [escalationChainName, position] - ):: - this.new(escalationChainName, position, 'notify_on_call_from_schedule', providerName, resourceId) - + escalation.spec.parameters.forProvider.withNotifyOnCallFromScheduleRef( - escalation.spec.parameters.forProvider.notifyOnCallFromScheduleRef.withName(scheduleName) - ), - - '#newNotifyPersons': d.func.new( - ||| - `newNotifyPersons` creates an Escalation of type `noitfy_persons`. - `escalationChainName` is the resource name - (`myescalationchain.metadata.name`) of the parent Escalation Chain. - `position` is the position of the Escalation in the chain. `persons` is - the array of persons (by email address) to notify. `providerName` is the - resource name (`myprovider.metadata.name`) of the Provider. `resourceId` - defaults to `-`. - |||, - [ - d.argument.new('escalationChainName', d.T.string), - d.argument.new('position', d.T.number), - d.argument.new('persons', d.T.array), - d.argument.new('providerName', d.T.string), - d.argument.new( - 'resourceId', - d.T.string, - default='-' - ), - ] - ), - newNotifyPersons( - escalationChainName, - position, - persons, - providerName, - resourceId='%s-%d' % [escalationChainName, position] - ):: - this.new(escalationChainName, position, 'notify_persons', providerName, resourceId) - + escalation.spec.parameters.forProvider.withPersonsToNotify(persons), - - '#newWait': d.func.new( - ||| - `newWait` creates an Escalation of type `wait`. `escalationChainName` is - the resource name (`myescalationchain.metadata.name`) of the parent - Escalation Chain. `position` is the position of the Escalation in the - chain. `duration` is the duration in seconds to wait. `providerName` is - the resource name (`myprovider.metadata.name`) of the Provider. - `resourceId` defaults to `-`. - |||, - [ - d.argument.new('escalationChainName', d.T.string), - d.argument.new('position', d.T.number), - d.argument.new('duration', d.T.number), - d.argument.new('providerName', d.T.string), - d.argument.new( - 'resourceId', - d.T.string, - default='-' - ), - ] - ), - newWait( - escalationChainName, - position, - duration, - providerName, - resourceId='%s-%d' % [escalationChainName, position] - ):: - this.new(escalationChainName, position, 'wait', providerName, resourceId) - + escalation.spec.parameters.forProvider.withDuration(duration), -} diff --git a/grafanaplane/oncall/escalationchain.libsonnet b/grafanaplane/oncall/escalationchain.libsonnet index 84a389d..379ac0e 100644 --- a/grafanaplane/oncall/escalationchain.libsonnet +++ b/grafanaplane/oncall/escalationchain.libsonnet @@ -1,26 +1,88 @@ 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; +escalationChain.spec.parameters.forProvider { - local escalationChain = raw.oncall.v1alpha1.escalationChain, - '#new': d.func.new( + '#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. + string, and `id` defaults to a slug-ified version of it. |||, [ d.argument.new('name', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + d.argument.new('id', d.T.string, default='rfc1123(name)'), ] ), - new(name, providerName, 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), + new(name, id=xtd.ascii.stringToRFC1123(name)):: { + chainName:: id, + chain: + escalationChain.new(id) + + escalationChain.spec.parameters.forProvider.withName(name), + }, + + '#withSteps':: d.func.new( + ||| + `withSteps` configures one or more Escalation resources as steps within + the calling Escalation Chain. + |||, + [ + ] + ), + withSteps(steps):: { + steps: + std.mapWithIndex( + function(position, step) + local id = '%s-%d' % [self.chainName, position]; + escalation.new(id) + + escalation.spec.parameters.forProvider.escalationChainRef.withName(self.chainName) + + step + , + steps + ), + }, + + step: { + local forProvider = escalation.spec.parameters.forProvider, + + '#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. + |||, + [d.argument.new('schedule', 'string|object')] + ), + notifyOnCallFromSchedule(schedule):: + forProvider.withType('notify_on_call_from_schedule') + + forProvider.withNotifyOnCallFromScheduleRef( + forProvider.notifyOnCallFromScheduleRef.withName(util.getName(schedule)) + ), + + '#notifyPersons':: d.func.new( + ||| + `notifyPersons` configures an Escalation step to notify a list of + persons. + |||, + [d.argument.new('persons', d.T.array)] + ), + notifyPersons(persons):: + forProvider.withType('notify_persons') + + forProvider.withPersonsToNotify(persons), + + '#wait':: d.func.new( + ||| + `wait` configures an Escalation step to wait for acknowledgement for + the given number of seconds before proceeding. + |||, + [d.argument.new('seconds', d.T.number)] + ), + wait(seconds):: + forProvider.withType('wait') + + forProvider.withDuration(seconds), + }, } From a1dd6786ec44e6eced5da19d0b97610dd8ae68b4 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 16:34:06 -0500 Subject: [PATCH 22/37] refactor(oncall): reorganize Integration API for less duplication --- grafanaplane/oncall/integration.libsonnet | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index 30f088a..de13570 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -1,42 +1,42 @@ 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 forProvider = integration.spec.parameters.forProvider; +forProvider { - local integration = raw.oncall.v1alpha1.integration, - '#new': d.func.new( + '#new':: d.func.new( ||| - `new` creates an Integration. The `name` is a display-friendly - string, and `resourceId` defaults to a slug-ified version of it. - `type` is the type of Integration. `providerName` is the resource - name (`myprovider.metadata.name`) of the Provider. + `new` creates an Integration. The `name` is a display-friendly string, + and `id` defaults to a slug-ified version of it. `type` is the type of + Integration. |||, [ d.argument.new('name', d.T.string), d.argument.new('type', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), + d.argument.new('id', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, providerName, resourceId=null):: - local id = if resourceId != null then resourceId else xtd.ascii.stringToRFC1123(name); + new(name, type, id=xtd.ascii.stringToRFC1123(name)):: integration.new(id) - + integration.spec.parameters.providerConfigRef.withName(providerName) + integration.spec.parameters.forProvider.withName(name) + integration.spec.parameters.forProvider.withType(type), - '#withDefaultRoute': d.func.new( + '#withDefaultChain': d.func.new( ||| - `withDefaultRoute` configures the default route using an Escalation - Chain object's name. + `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. |||, [ - d.argument.new('name', d.T.string), + d.argument.new('escalationChain', d.T.string), ] ), - withDefaultRoute(name):: - integration.spec.parameters.forProvider.withDefaultRoute( - integration.spec.parameters.forProvider.defaultRoute.escalationChainRef.withName(name) + withDefaultChain(escalationChain):: + super.withDefaultRoute( + super.defaultRoute.escalationChainRef.withName(util.getName(escalationChain)) ), } From 12e41e526902e9ac0f363ce3ea830316f9a72b6a Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 17:03:35 -0500 Subject: [PATCH 23/37] refactor(oncall): merge Route logic into Integration --- grafanaplane/oncall/integration.libsonnet | 65 ++++++++++++++++++++--- grafanaplane/oncall/route.libsonnet | 30 ----------- 2 files changed, 57 insertions(+), 38 deletions(-) delete mode 100644 grafanaplane/oncall/route.libsonnet diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index de13570..db9ff7e 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -4,6 +4,7 @@ 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; local forProvider = integration.spec.parameters.forProvider; forProvider @@ -20,12 +21,15 @@ forProvider d.argument.new('id', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, id=xtd.ascii.stringToRFC1123(name)):: - integration.new(id) - + integration.spec.parameters.forProvider.withName(name) - + integration.spec.parameters.forProvider.withType(type), + new(name, type, id=xtd.ascii.stringToRFC1123(name)):: { + integrationName:: id, + integration: + integration.new(id) + + integration.spec.parameters.forProvider.withName(name) + + integration.spec.parameters.forProvider.withType(type), + }, - '#withDefaultChain': d.func.new( + '#withDefaultChain':: d.func.new( ||| `withDefaulChain` configures the default route of an Integration to use an Escalation Chain. `escalationChain` is the resource name or manifest @@ -35,8 +39,53 @@ forProvider d.argument.new('escalationChain', d.T.string), ] ), - withDefaultChain(escalationChain):: - super.withDefaultRoute( - super.defaultRoute.escalationChainRef.withName(util.getName(escalationChain)) + withDefaultChain(escalationChain):: { + integration+: + forProvider.withDefaultRoute( + forProvider.defaultRoute.escalationChainRef.withName(util.getName(escalationChain)) + ), + }, + + '#withRoutes':: d.func.new( + ||| + `withRoute` configures Route resources connecting this Integration with + Escalation Chains. + |||, + [d.argument.new('routes', d.T.object)] + ), + withRoutes(routes):: { + local integrationName = self.integrationName, + routes: { + [item.key]: + local id = '%s-%s' % [integrationName, item.key]; + route.new(id) + + route.spec.parameters.forProvider.integrationRef.withName(integrationName) + + item.value + for item in std.objectKeysValues(routes) + }, + }, + + route: { + local forProvider = route.spec.parameters.forProvider, + '#chain':: d.func.new( + ||| + `chain` configures a Route to reference an Escalation Chain. + |||, + [d.argument.new('name', d.T.string)] + ), + chain(name):: + forProvider.escalationChainRef.withName(name), + + + '#withRoutingRegex':: d.func.new( + ||| + `withRoutingRegex` configures a Route to have routing type `regex` and + use the supplied regex. + |||, + [d.argument.new('regex', d.T.string)] ), + withRoutingRegex(regex):: + forProvider.withRoutingType('regex') + + forProvider.withRoutingRegex(regex), + }, } diff --git a/grafanaplane/oncall/route.libsonnet b/grafanaplane/oncall/route.libsonnet deleted file mode 100644 index 273c7c8..0000000 --- a/grafanaplane/oncall/route.libsonnet +++ /dev/null @@ -1,30 +0,0 @@ -local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; - -local raw = import '../zz/main.libsonnet'; - -{ - local route = raw.oncall.v1alpha1.route, - '#new': d.func.new( - ||| - `new` creates a Route. `id` is the resource name. `integrationName` - is the resource name of the Integration to reference. - `escalationChainName` is the resource name of the Escalation Chain to - reference. `routingRegex` is configured as a routing regex, if - supplied. `providerName` is the resource name - (`myprovider.metadata.name`) of the Provider. - |||, - [ - d.argument.new('id', d.T.string), - d.argument.new('integrationName', d.T.string), - d.argument.new('escalationChainName', d.T.string), - d.argument.new('providerName', d.T.string), - d.argument.new('routingRegex', d.T.string, default='null'), - ] - ), - new(id, integrationName, escalationChainName, providerName, routingRegex=null):: - route.new(id) - + route.spec.parameters.providerConfigRef.withName(providerName) - + route.spec.parameters.forProvider.integrationRef.withName(integrationName) - + route.spec.parameters.forProvider.escalationChainRef.withName(escalationChainName) - + if routingRegex != null then route.spec.parameters.forProvider.withRoutingRegex(routingRegex) else {}, -} From 0c363de2d959be24b05a37002ae6c7ab912a0faa Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 17:04:14 -0500 Subject: [PATCH 24/37] fix(oncall): remove dead library imports --- grafanaplane/oncall/main.libsonnet | 2 -- 1 file changed, 2 deletions(-) diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index 128c5f2..8ff504d 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -6,9 +6,7 @@ local raw = import '../zz/main.libsonnet'; { '#': d.package.newSub('oncall', ''), escalationChain: import './escalationchain.libsonnet', - escalation: import './escalation.libsonnet', integration: import './integration.libsonnet', - route: import './route.libsonnet', schedule: import './schedule.libsonnet', shift: import './shift.libsonnet', } From 738b40d6648459ae2fdd5327591a69fa1e568c6d Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Tue, 31 Dec 2024 17:05:03 -0500 Subject: [PATCH 25/37] docs(oncall): build docs --- docs/README.md | 2 +- docs/oncall.md | 592 ----------- docs/oncall/index.md | 925 ++++++++++++++++++ docs/oncall/integration/defaultRoute/index.md | 334 +++++++ .../integration/defaultRoute/msteams.md | 36 + docs/oncall/integration/defaultRoute/slack.md | 36 + .../integration/defaultRoute/telegram.md | 36 + docs/oncall/integration/templates/email.md | 35 + docs/oncall/integration/templates/index.md | 280 ++++++ .../integration/templates/microsoftTeams.md | 48 + .../oncall/integration/templates/mobileApp.md | 35 + .../oncall/integration/templates/phoneCall.md | 22 + docs/oncall/integration/templates/slack.md | 48 + docs/oncall/integration/templates/sms.md | 22 + docs/oncall/integration/templates/telegram.md | 48 + docs/oncall/integration/templates/web.md | 48 + docs/oncall/schedule/shiftsRef.md | 82 ++ docs/oncall/schedule/slack.md | 35 + 18 files changed, 2071 insertions(+), 593 deletions(-) delete mode 100644 docs/oncall.md create mode 100644 docs/oncall/index.md create mode 100644 docs/oncall/integration/defaultRoute/index.md create mode 100644 docs/oncall/integration/defaultRoute/msteams.md create mode 100644 docs/oncall/integration/defaultRoute/slack.md create mode 100644 docs/oncall/integration/defaultRoute/telegram.md create mode 100644 docs/oncall/integration/templates/email.md create mode 100644 docs/oncall/integration/templates/index.md create mode 100644 docs/oncall/integration/templates/microsoftTeams.md create mode 100644 docs/oncall/integration/templates/mobileApp.md create mode 100644 docs/oncall/integration/templates/phoneCall.md create mode 100644 docs/oncall/integration/templates/slack.md create mode 100644 docs/oncall/integration/templates/sms.md create mode 100644 docs/oncall/integration/templates/telegram.md create mode 100644 docs/oncall/integration/templates/web.md create mode 100644 docs/oncall/schedule/shiftsRef.md create mode 100644 docs/oncall/schedule/slack.md diff --git a/docs/README.md b/docs/README.md index 4018c35..47c13f9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,7 +24,7 @@ local grafanaplane = import 'github.com/grafana/grafana-crossplane-libsonnet/gra ## Subpackages * [configurations](configurations.md) -* [oncall](oncall.md) +* [oncall](oncall/index.md) * [oss](oss/index.md) * [raw](raw/index.md) * [sm](sm/index.md) diff --git a/docs/oncall.md b/docs/oncall.md deleted file mode 100644 index 0c70c85..0000000 --- a/docs/oncall.md +++ /dev/null @@ -1,592 +0,0 @@ -# oncall - - - -## Index - -* [`obj escalation`](#obj-escalation) - * [`fn new(escalationChainName, position, type, providerName, resourceId="-")`](#fn-escalationnew) - * [`fn newNotifyOnCallFromSchedule(escalationChainName, position, scheduleName, providerName, resourceId="-")`](#fn-escalationnewnotifyoncallfromschedule) - * [`fn newNotifyPersons(escalationChainName, position, persons, providerName, resourceId="-")`](#fn-escalationnewnotifypersons) - * [`fn newWait(escalationChainName, position, duration, providerName, resourceId="-")`](#fn-escalationnewwait) -* [`obj escalationChain`](#obj-escalationchain) - * [`fn new(name, providerName, resourceId="rfc1123(name)")`](#fn-escalationchainnew) -* [`obj integration`](#obj-integration) - * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-integrationnew) - * [`fn withDefaultRoute(name)`](#fn-integrationwithdefaultroute) -* [`obj route`](#obj-route) - * [`fn new(id, integrationName, escalationChainName, providerName, routingRegex="null")`](#fn-routenew) -* [`obj schedule`](#obj-schedule) - * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-schedulenew) - * [`fn newCalendar(name, providerName, shiftNames="[]", resourceId="rfc1123(name)")`](#fn-schedulenewcalendar) -* [`obj shift`](#obj-shift) - * [`fn new(name, type, start, providerName, resourceId="rfc1123(name)")`](#fn-shiftnew) - * [`fn newRollingUsers(name, rollingUsers, start, duration, interval, providerName, byDay="null", byMonth="null", byMonthDay="null", resourceId="rfc1123(name)")`](#fn-shiftnewrollingusers) - * [`fn withByDay(value)`](#fn-shiftwithbyday) - * [`fn withByDayMixin(value)`](#fn-shiftwithbydaymixin) - * [`fn withByMonth(value)`](#fn-shiftwithbymonth) - * [`fn withByMonthMixin(value)`](#fn-shiftwithbymonthmixin) - * [`fn withByMonthday(value)`](#fn-shiftwithbymonthday) - * [`fn withByMonthdayMixin(value)`](#fn-shiftwithbymonthdaymixin) - * [`fn withDuration(value)`](#fn-shiftwithduration) - * [`fn withFrequency(value)`](#fn-shiftwithfrequency) - * [`fn withInterval(value)`](#fn-shiftwithinterval) - * [`fn withLevel(value)`](#fn-shiftwithlevel) - * [`fn withName(value)`](#fn-shiftwithname) - * [`fn withRollingUsers(value)`](#fn-shiftwithrollingusers) - * [`fn withRollingUsersMixin(value)`](#fn-shiftwithrollingusersmixin) - * [`fn withStart(value)`](#fn-shiftwithstart) - * [`fn withStartRotationFromUserIndex(value)`](#fn-shiftwithstartrotationfromuserindex) - * [`fn withTeamId(value)`](#fn-shiftwithteamid) - * [`fn withTimeZone(value)`](#fn-shiftwithtimezone) - * [`fn withType(value)`](#fn-shiftwithtype) - * [`fn withUntil(value)`](#fn-shiftwithuntil) - * [`fn withUsers(value)`](#fn-shiftwithusers) - * [`fn withUsersMixin(value)`](#fn-shiftwithusersmixin) - * [`fn withWeekStart(value)`](#fn-shiftwithweekstart) - -## Fields - -### obj escalation - - -#### fn escalation.new - -```jsonnet -escalation.new(escalationChainName, position, type, providerName, resourceId="-") -``` - -PARAMETERS: - -* **escalationChainName** (`string`) -* **position** (`number`) -* **type** (`string`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"-"` - -`new` creates an Escalation. `escalationChainName` is the resource name -(`myescalationchain.metadata.name`) of the parent Escalation Chain. -`position` is the position of the Escalation in the chain. `type` is the -Escalation type. `providerName` is the resource name -(`myprovider.metadata.name`) of the Provider. `resourceId` defaults to -`-`. - -#### fn escalation.newNotifyOnCallFromSchedule - -```jsonnet -escalation.newNotifyOnCallFromSchedule(escalationChainName, position, scheduleName, providerName, resourceId="-") -``` - -PARAMETERS: - -* **escalationChainName** (`string`) -* **position** (`number`) -* **scheduleName** (`string`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"-"` - -`newNotifyOnCallFromSchedule` creates an Escalation of type -`noitfy_on_call_from_schedule`. `escalationChainName` is the resource -name (`myescalationchain.metadata.name`) of the parent Escalation Chain. -`position` is the position of the Escalation in the chain. `scheduleName` -is the resource name of the Schedule to reference. `providerName` is the -resource name (`myprovider.metadata.name`) of the Provider. `resourceId` -defaults to `-`. - -#### fn escalation.newNotifyPersons - -```jsonnet -escalation.newNotifyPersons(escalationChainName, position, persons, providerName, resourceId="-") -``` - -PARAMETERS: - -* **escalationChainName** (`string`) -* **position** (`number`) -* **persons** (`array`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"-"` - -`newNotifyPersons` creates an Escalation of type `noitfy_persons`. -`escalationChainName` is the resource name -(`myescalationchain.metadata.name`) of the parent Escalation Chain. -`position` is the position of the Escalation in the chain. `persons` is -the array of persons (by email address) to notify. `providerName` is the -resource name (`myprovider.metadata.name`) of the Provider. `resourceId` -defaults to `-`. - -#### fn escalation.newWait - -```jsonnet -escalation.newWait(escalationChainName, position, duration, providerName, resourceId="-") -``` - -PARAMETERS: - -* **escalationChainName** (`string`) -* **position** (`number`) -* **duration** (`number`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"-"` - -`newWait` creates an Escalation of type `wait`. `escalationChainName` is -the resource name (`myescalationchain.metadata.name`) of the parent -Escalation Chain. `position` is the position of the Escalation in the -chain. `duration` is the duration in seconds to wait. `providerName` is -the resource name (`myprovider.metadata.name`) of the Provider. -`resourceId` defaults to `-`. - -### obj escalationChain - - -#### fn escalationChain.new - -```jsonnet -escalationChain.new(name, providerName, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`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. - -### obj integration - - -#### fn integration.new - -```jsonnet -integration.new(name, type, providerName, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **type** (`string`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates an Integration. The `name` is a display-friendly -string, and `resourceId` defaults to a slug-ified version of it. -`type` is the type of Integration. `providerName` is the resource -name (`myprovider.metadata.name`) of the Provider. - -#### fn integration.withDefaultRoute - -```jsonnet -integration.withDefaultRoute(name) -``` - -PARAMETERS: - -* **name** (`string`) - -`withDefaultRoute` configures the default route using an Escalation -Chain object's name. - -### obj route - - -#### fn route.new - -```jsonnet -route.new(id, integrationName, escalationChainName, providerName, routingRegex="null") -``` - -PARAMETERS: - -* **id** (`string`) -* **integrationName** (`string`) -* **escalationChainName** (`string`) -* **providerName** (`string`) -* **routingRegex** (`string`) - - default value: `"null"` - -`new` creates a Route. `id` is the resource name. `integrationName` -is the resource name of the Integration to reference. -`escalationChainName` is the resource name of the Escalation Chain to -reference. `routingRegex` is configured as a routing regex, if -supplied. `providerName` is the resource name -(`myprovider.metadata.name`) of the Provider. - -### obj schedule - - -#### fn schedule.new - -```jsonnet -schedule.new(name, type, providerName, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **type** (`string`) - - valid values: `"ical"`, `"calendar"` -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates a Schedule. The `name` is a display-friendly -string, and `resourceId` defaults to a slug-ified version of it. -`type` is the type of Schedule. `providerName` is the resource -name (`myprovider.metadata.name`) of the Provider. - -#### fn schedule.newCalendar - -```jsonnet -schedule.newCalendar(name, providerName, shiftNames="[]", resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **providerName** (`string`) -* **shiftNames** (`array`) - - default value: `"[]"` -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`newCalendar` creates a Schedule with type `calendar`. 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. If supplied, `shiftNames` -are supplied to `withShiftsRef` to associate an array of shifts by -resource name. - -### obj shift - - -#### fn shift.new - -```jsonnet -shift.new(name, type, start, providerName, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **type** (`string`) -* **start** (`string`) -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates an OnCallShift. The `name` is a display-friendly string, -and `resourceId` defaults to a slug-ified version of it. `type` is the -type of Shift. `start` is the start time of the shift in -`yyyy-MM-dd'T'HH:mm:ss` format. `providerName` is the resource name -(`myprovider.metadata.name`) of the Provider. - -#### fn shift.newRollingUsers - -```jsonnet -shift.newRollingUsers(name, rollingUsers, start, duration, interval, providerName, byDay="null", byMonth="null", byMonthDay="null", resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **rollingUsers** (`array`) -* **start** (`string`) -* **duration** (`number`) -* **interval** (`number`) -* **providerName** (`string`) -* **byDay** (`array`) - - default value: `"null"` -* **byMonth** (`array`) - - default value: `"null"` -* **byMonthDay** (`array`) - - default value: `"null"` -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`newRollingUsers` creates an OnCallShift of `rolling_users` type. The -`name` is a display-friendly string, and `resourceId` defaults to a -slug-ified version of it. `rollingUsers` is the list of users as an array -of strings. `start` is the start time of the shift in -`yyyy-MM-dd'T'HH:mm:ss` format. `duration` is the length of each shift in -seconds. `interval` is the interval at which the recurrence rule repeats. -`providerName` is the resource name (`myprovider.metadata.name`) of the -Provider. `byDay` is a list of days in iCal format on which the shift -takes place. `byMonth` is a list of months in which the shift takes -place. `byMonthDay` is a list of month days on which the shift takes -place. If any of `byDay`, `byMonth`, or `byMonthDay` is `null` (default), -it is omitted. - -#### fn shift.withByDay - -```jsonnet -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 -#### fn shift.withByDayMixin - -```jsonnet -shift.withByDayMixin(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 -#### fn shift.withByMonth - -```jsonnet -shift.withByMonth(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 -This parameter takes a list of months. Valid values are 1 to 12 -#### fn shift.withByMonthMixin - -```jsonnet -shift.withByMonthMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 -This parameter takes a list of months. Valid values are 1 to 12 -#### fn shift.withByMonthday - -```jsonnet -shift.withByMonthday(value) -``` - -PARAMETERS: - -* **value** (`array`) - -31 to -1 -This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 -#### fn shift.withByMonthdayMixin - -```jsonnet -shift.withByMonthdayMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -31 to -1 -This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 -#### fn shift.withDuration - -```jsonnet -shift.withDuration(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The duration of the event. -The duration of the event. -#### fn shift.withFrequency - -```jsonnet -shift.withFrequency(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The frequency of the event. Can be hourly, daily, weekly, monthly -The frequency of the event. Can be hourly, daily, weekly, monthly -#### fn shift.withInterval - -```jsonnet -shift.withInterval(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The positive integer representing at which intervals the recurrence rule repeats. -The positive integer representing at which intervals the recurrence rule repeats. -#### fn shift.withLevel - -```jsonnet -shift.withLevel(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The priority level. The higher the value, the higher the priority. -The priority level. The higher the value, the higher the priority. -#### fn shift.withName - -```jsonnet -shift.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's name. -The shift's name. -#### fn shift.withRollingUsers - -```jsonnet -shift.withRollingUsers(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for rolling_users event type) -The list of lists with on-call users (for rolling_users event type) -#### fn shift.withRollingUsersMixin - -```jsonnet -shift.withRollingUsersMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for rolling_users event type) -The list of lists with on-call users (for rolling_users event type) -#### fn shift.withStart - -```jsonnet -shift.withStart(value) -``` - -PARAMETERS: - -* **value** (`string`) - -call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -The start time of the on-call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -#### fn shift.withStartRotationFromUserIndex - -```jsonnet -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. -#### fn shift.withTeamId - -```jsonnet -shift.withTeamId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. -The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. -#### fn shift.withTimeZone - -```jsonnet -shift.withTimeZone(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's timezone. Overrides schedule's timezone. -The shift's timezone. Overrides schedule's timezone. -#### fn shift.withType - -```jsonnet -shift.withType(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's type. Can be rolling_users, recurrent_event, single_event -The shift's type. Can be rolling_users, recurrent_event, single_event -#### fn shift.withUntil - -```jsonnet -shift.withUntil(value) -``` - -PARAMETERS: - -* **value** (`string`) - -call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -The end time of recurrent on-call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -#### fn shift.withUsers - -```jsonnet -shift.withUsers(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for single_event and recurrent_event event type). -The list of on-call users (for single_event and recurrent_event event type). -#### fn shift.withUsersMixin - -```jsonnet -shift.withUsersMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for single_event and recurrent_event event type). -The list of on-call users (for single_event and recurrent_event event type). -#### fn shift.withWeekStart - -```jsonnet -shift.withWeekStart(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU -Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU \ No newline at end of file diff --git a/docs/oncall/index.md b/docs/oncall/index.md new file mode 100644 index 0000000..da5fd5b --- /dev/null +++ b/docs/oncall/index.md @@ -0,0 +1,925 @@ +# oncall + + + +## Subpackages + +* [integration.defaultRoute](integration/defaultRoute/index.md) +* [integration.templates](integration/templates/index.md) +* [schedule.shiftsRef](schedule/shiftsRef.md) +* [schedule.slack](schedule/slack.md) + +## Index + +* [`obj escalationChain`](#obj-escalationchain) + * [`fn new(name, id="rfc1123(name)")`](#fn-escalationchainnew) + * [`fn withName(value)`](#fn-escalationchainwithname) + * [`fn withSteps()`](#fn-escalationchainwithsteps) + * [`fn withTeamId(value)`](#fn-escalationchainwithteamid) + * [`obj step`](#obj-escalationchainstep) + * [`fn notifyOnCallFromSchedule(schedule)`](#fn-escalationchainstepnotifyoncallfromschedule) + * [`fn notifyPersons(persons)`](#fn-escalationchainstepnotifypersons) + * [`fn wait(seconds)`](#fn-escalationchainstepwait) +* [`obj integration`](#obj-integration) + * [`fn new(name, type, id="rfc1123(name)")`](#fn-integrationnew) + * [`fn withDefaultChain(escalationChain)`](#fn-integrationwithdefaultchain) + * [`fn withDefaultRoute(value)`](#fn-integrationwithdefaultroute) + * [`fn withDefaultRouteMixin(value)`](#fn-integrationwithdefaultroutemixin) + * [`fn withName(value)`](#fn-integrationwithname) + * [`fn withRoutes(routes)`](#fn-integrationwithroutes) + * [`fn withTeamId(value)`](#fn-integrationwithteamid) + * [`fn withTemplates(value)`](#fn-integrationwithtemplates) + * [`fn withTemplatesMixin(value)`](#fn-integrationwithtemplatesmixin) + * [`fn withType(value)`](#fn-integrationwithtype) + * [`obj route`](#obj-integrationroute) + * [`fn chain(name)`](#fn-integrationroutechain) + * [`fn withRoutingRegex(regex)`](#fn-integrationroutewithroutingregex) +* [`obj schedule`](#obj-schedule) + * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-schedulenew) + * [`fn withEnableWebOverrides(value=true)`](#fn-schedulewithenableweboverrides) + * [`fn withIcalUrlOverrides(value)`](#fn-schedulewithicalurloverrides) + * [`fn withIcalUrlPrimary(value)`](#fn-schedulewithicalurlprimary) + * [`fn withName(value)`](#fn-schedulewithname) + * [`fn withShifts(shifts="null")`](#fn-schedulewithshifts) + * [`fn withShiftsMixin(value)`](#fn-schedulewithshiftsmixin) + * [`fn withShiftsRef(value)`](#fn-schedulewithshiftsref) + * [`fn withShiftsRefMixin(value)`](#fn-schedulewithshiftsrefmixin) + * [`fn withShiftsSelector(value)`](#fn-schedulewithshiftsselector) + * [`fn withShiftsSelectorMixin(value)`](#fn-schedulewithshiftsselectormixin) + * [`fn withSlack(value)`](#fn-schedulewithslack) + * [`fn withSlackMixin(value)`](#fn-schedulewithslackmixin) + * [`fn withTeamId(value)`](#fn-schedulewithteamid) + * [`fn withTimeZone(value)`](#fn-schedulewithtimezone) + * [`fn withType(value)`](#fn-schedulewithtype) + * [`obj shiftsSelector`](#obj-scheduleshiftsselector) + * [`fn withMatchControllerRef(value=true)`](#fn-scheduleshiftsselectorwithmatchcontrollerref) + * [`fn withMatchLabels(value)`](#fn-scheduleshiftsselectorwithmatchlabels) + * [`fn withMatchLabelsMixin(value)`](#fn-scheduleshiftsselectorwithmatchlabelsmixin) + * [`fn withPolicy(value)`](#fn-scheduleshiftsselectorwithpolicy) + * [`fn withPolicyMixin(value)`](#fn-scheduleshiftsselectorwithpolicymixin) + * [`obj policy`](#obj-scheduleshiftsselectorpolicy) + * [`fn withResolution(value="Required")`](#fn-scheduleshiftsselectorpolicywithresolution) + * [`fn withResolve(value)`](#fn-scheduleshiftsselectorpolicywithresolve) +* [`obj shift`](#obj-shift) + * [`fn new(name, resourceId="rfc1123(name)")`](#fn-shiftnew) + * [`fn withByDay(value)`](#fn-shiftwithbyday) + * [`fn withByDayMixin(value)`](#fn-shiftwithbydaymixin) + * [`fn withByMonth(value)`](#fn-shiftwithbymonth) + * [`fn withByMonthMixin(value)`](#fn-shiftwithbymonthmixin) + * [`fn withByMonthday(value)`](#fn-shiftwithbymonthday) + * [`fn withByMonthdayMixin(value)`](#fn-shiftwithbymonthdaymixin) + * [`fn withDuration(value)`](#fn-shiftwithduration) + * [`fn withFrequency(value)`](#fn-shiftwithfrequency) + * [`fn withInterval(value)`](#fn-shiftwithinterval) + * [`fn withLevel(value)`](#fn-shiftwithlevel) + * [`fn withName(value)`](#fn-shiftwithname) + * [`fn withRollingUsers(frequency, users)`](#fn-shiftwithrollingusers) + * [`fn withRollingUsersMixin(value)`](#fn-shiftwithrollingusersmixin) + * [`fn withStart(value)`](#fn-shiftwithstart) + * [`fn withStartRotationFromUserIndex(value)`](#fn-shiftwithstartrotationfromuserindex) + * [`fn withTeamId(value)`](#fn-shiftwithteamid) + * [`fn withTimeZone(value)`](#fn-shiftwithtimezone) + * [`fn withType(value)`](#fn-shiftwithtype) + * [`fn withUntil(value)`](#fn-shiftwithuntil) + * [`fn withUsers(value)`](#fn-shiftwithusers) + * [`fn withUsersMixin(value)`](#fn-shiftwithusersmixin) + * [`fn withWeekStart(value)`](#fn-shiftwithweekstart) + +## Fields + +### obj escalationChain + + +#### fn escalationChain.new + +```jsonnet +escalationChain.new(name, id="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **id** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates an Escalation Chain. The `name` is a display-friendly +string, and `id` defaults to a slug-ified version of it. + +#### fn escalationChain.withName + +```jsonnet +escalationChain.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The name of the escalation chain. +The name of the escalation chain. +#### fn escalationChain.withSteps + +```jsonnet +escalationChain.withSteps() +``` + + +`withSteps` configures one or more Escalation resources as steps within +the calling Escalation Chain. + +#### fn escalationChain.withTeamId + +```jsonnet +escalationChain.withTeamId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. +The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. +#### obj escalationChain.step + + +##### fn escalationChain.step.notifyOnCallFromSchedule + +```jsonnet +escalationChain.step.notifyOnCallFromSchedule(schedule) +``` + +PARAMETERS: + +* **schedule** (`string|object`) + +`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. + +##### fn escalationChain.step.notifyPersons + +```jsonnet +escalationChain.step.notifyPersons(persons) +``` + +PARAMETERS: + +* **persons** (`array`) + +`notifyPersons` configures an Escalation step to notify a list of +persons. + +##### fn escalationChain.step.wait + +```jsonnet +escalationChain.step.wait(seconds) +``` + +PARAMETERS: + +* **seconds** (`number`) + +`wait` configures an Escalation step to wait for acknowledgement for +the given number of seconds before proceeding. + +### obj integration + + +#### fn integration.new + +```jsonnet +integration.new(name, type, id="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **type** (`string`) +* **id** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates an Integration. The `name` is a display-friendly string, +and `id` defaults to a slug-ified version of it. `type` is the type of +Integration. + +#### fn integration.withDefaultChain + +```jsonnet +integration.withDefaultChain(escalationChain) +``` + +PARAMETERS: + +* **escalationChain** (`string`) + +`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. + +#### fn integration.withDefaultRoute + +```jsonnet +integration.withDefaultRoute(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Min: 1, Max: 1) The Default route for all alerts from the given integration (see below for nested schema) +The Default route for all alerts from the given integration +#### fn integration.withDefaultRouteMixin + +```jsonnet +integration.withDefaultRouteMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Min: 1, Max: 1) The Default route for all alerts from the given integration (see below for nested schema) +The Default route for all alerts from the given integration +#### fn integration.withName + +```jsonnet +integration.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The name of the service integration. +The name of the service integration. +#### fn integration.withRoutes + +```jsonnet +integration.withRoutes(routes) +``` + +PARAMETERS: + +* **routes** (`object`) + +`withRoute` configures Route resources connecting this Integration with +Escalation Chains. + +#### fn integration.withTeamId + +```jsonnet +integration.withTeamId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. +The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. +#### fn integration.withTemplates + +```jsonnet +integration.withTemplates(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Jinja2 templates for Alert payload. An empty templates block will be ignored. (see below for nested schema) +Jinja2 templates for Alert payload. An empty templates block will be ignored. +#### fn integration.withTemplatesMixin + +```jsonnet +integration.withTemplatesMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Jinja2 templates for Alert payload. An empty templates block will be ignored. (see below for nested schema) +Jinja2 templates for Alert payload. An empty templates block will be ignored. +#### fn integration.withType + +```jsonnet +integration.withType(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The type of integration. Can be grafana, grafana_alerting, webhook, alertmanager, kapacitor, fabric, newrelic, datadog, pagerduty, pingdom, elastalert, amazon_sns, curler, sentry, formatted_webhook, heartbeat, demo, manual, stackdriver, uptimerobot, sentry_platform, zabbix, prtg, slack_channel, inbound_email, direct_paging, jira. +The type of integration. Can be grafana, grafana_alerting, webhook, alertmanager, kapacitor, fabric, newrelic, datadog, pagerduty, pingdom, elastalert, amazon_sns, curler, sentry, formatted_webhook, heartbeat, demo, manual, stackdriver, uptimerobot, sentry_platform, zabbix, prtg, slack_channel, inbound_email, direct_paging, jira. +#### obj integration.route + + +##### fn integration.route.chain + +```jsonnet +integration.route.chain(name) +``` + +PARAMETERS: + +* **name** (`string`) + +`chain` configures a Route to reference an Escalation Chain. + +##### fn integration.route.withRoutingRegex + +```jsonnet +integration.route.withRoutingRegex(regex) +``` + +PARAMETERS: + +* **regex** (`string`) + +`withRoutingRegex` configures a Route to have routing type `regex` and +use the supplied regex. + +### obj schedule + + +#### fn schedule.new + +```jsonnet +schedule.new(name, type, providerName, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **type** (`string`) + - valid values: `"ical"`, `"calendar"` +* **providerName** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates a Schedule. The `name` is a display-friendly +string, and `id` defaults to a slug-ified version of it. + +#### fn schedule.withEnableWebOverrides + +```jsonnet +schedule.withEnableWebOverrides(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +(Boolean) Enable overrides via web UI (it will ignore ical_url_overrides). +Enable overrides via web UI (it will ignore ical_url_overrides). +#### fn schedule.withIcalUrlOverrides + +```jsonnet +schedule.withIcalUrlOverrides(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The URL of external iCal calendar which override primary events. +The URL of external iCal calendar which override primary events. +#### fn schedule.withIcalUrlPrimary + +```jsonnet +schedule.withIcalUrlPrimary(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The URL of the external calendar iCal file. +The URL of the external calendar iCal file. +#### fn schedule.withName + +```jsonnet +schedule.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The schedule's name. +The schedule's name. +#### fn schedule.withShifts + +```jsonnet +schedule.withShifts(shifts="null") +``` + +PARAMETERS: + +* **shifts** (`array`) + - default value: `"null"` + +`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. + +#### fn schedule.withShiftsMixin + +```jsonnet +schedule.withShiftsMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call shifts. +The list of ID's of on-call shifts. +#### fn schedule.withShiftsRef + +```jsonnet +schedule.withShiftsRef(value) +``` + +PARAMETERS: + +* **value** (`array`) + +References to OnCallShift in oncall to populate shifts. +#### fn schedule.withShiftsRefMixin + +```jsonnet +schedule.withShiftsRefMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +References to OnCallShift in oncall to populate shifts. +#### fn schedule.withShiftsSelector + +```jsonnet +schedule.withShiftsSelector(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Selector for a list of OnCallShift in oncall to populate shifts. +#### fn schedule.withShiftsSelectorMixin + +```jsonnet +schedule.withShiftsSelectorMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Selector for a list of OnCallShift in oncall to populate shifts. +#### fn schedule.withSlack + +```jsonnet +schedule.withSlack(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a schedule. (see below for nested schema) +The Slack-specific settings for a schedule. +#### fn schedule.withSlackMixin + +```jsonnet +schedule.withSlackMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a schedule. (see below for nested schema) +The Slack-specific settings for a schedule. +#### fn schedule.withTeamId + +```jsonnet +schedule.withTeamId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. +The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. +#### fn schedule.withTimeZone + +```jsonnet +schedule.withTimeZone(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The schedule's time zone. +The schedule's time zone. +#### fn schedule.withType + +```jsonnet +schedule.withType(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The schedule's type. Valid values are ical, calendar. +The schedule's type. Valid values are `ical`, `calendar`. +#### obj schedule.shiftsSelector + + +##### fn schedule.shiftsSelector.withMatchControllerRef + +```jsonnet +schedule.shiftsSelector.withMatchControllerRef(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +MatchControllerRef ensures an object with the same controller reference +as the selecting object is selected. +##### fn schedule.shiftsSelector.withMatchLabels + +```jsonnet +schedule.shiftsSelector.withMatchLabels(value) +``` + +PARAMETERS: + +* **value** (`object`) + +MatchLabels ensures an object with matching labels is selected. +##### fn schedule.shiftsSelector.withMatchLabelsMixin + +```jsonnet +schedule.shiftsSelector.withMatchLabelsMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +MatchLabels ensures an object with matching labels is selected. +##### fn schedule.shiftsSelector.withPolicy + +```jsonnet +schedule.shiftsSelector.withPolicy(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for selection. +##### fn schedule.shiftsSelector.withPolicyMixin + +```jsonnet +schedule.shiftsSelector.withPolicyMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for selection. +##### obj schedule.shiftsSelector.policy + + +###### fn schedule.shiftsSelector.policy.withResolution + +```jsonnet +schedule.shiftsSelector.policy.withResolution(value="Required") +``` + +PARAMETERS: + +* **value** (`string`) + - default value: `"Required"` + - valid values: `"Required"`, `"Optional"` + +Resolution specifies whether resolution of this reference is required. +The default is 'Required', which means the reconcile will fail if the +reference cannot be resolved. 'Optional' means this reference will be +a no-op if it cannot be resolved. +###### fn schedule.shiftsSelector.policy.withResolve + +```jsonnet +schedule.shiftsSelector.policy.withResolve(value) +``` + +PARAMETERS: + +* **value** (`string`) + - valid values: `"Always"`, `"IfNotPresent"` + +Resolve specifies when this reference should be resolved. The default +is 'IfNotPresent', which will attempt to resolve the reference only when +the corresponding field is not present. Use 'Always' to resolve the +reference on every reconcile. +### obj shift + + +#### fn shift.new + +```jsonnet +shift.new(name, resourceId="rfc1123(name)") +``` + +PARAMETERS: + +* **name** (`string`) +* **resourceId** (`string`) + - default value: `"rfc1123(name)"` + +`new` creates an OnCallShift. The `name` is a display-friendly string, +and `id` defaults to a slug-ified version of it. + +#### fn shift.withByDay + +```jsonnet +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 +#### fn shift.withByDayMixin + +```jsonnet +shift.withByDayMixin(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 +#### fn shift.withByMonth + +```jsonnet +shift.withByMonth(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 +This parameter takes a list of months. Valid values are 1 to 12 +#### fn shift.withByMonthMixin + +```jsonnet +shift.withByMonthMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 +This parameter takes a list of months. Valid values are 1 to 12 +#### fn shift.withByMonthday + +```jsonnet +shift.withByMonthday(value) +``` + +PARAMETERS: + +* **value** (`array`) + +31 to -1 +This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 +#### fn shift.withByMonthdayMixin + +```jsonnet +shift.withByMonthdayMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +31 to -1 +This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 +#### fn shift.withDuration + +```jsonnet +shift.withDuration(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The duration of the event. +The duration of the event. +#### fn shift.withFrequency + +```jsonnet +shift.withFrequency(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The frequency of the event. Can be hourly, daily, weekly, monthly +The frequency of the event. Can be hourly, daily, weekly, monthly +#### fn shift.withInterval + +```jsonnet +shift.withInterval(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The positive integer representing at which intervals the recurrence rule repeats. +The positive integer representing at which intervals the recurrence rule repeats. +#### fn shift.withLevel + +```jsonnet +shift.withLevel(value) +``` + +PARAMETERS: + +* **value** (`number`) + +(Number) The priority level. The higher the value, the higher the priority. +The priority level. The higher the value, the higher the priority. +#### fn shift.withName + +```jsonnet +shift.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's name. +The shift's name. +#### fn shift.withRollingUsers + +```jsonnet +shift.withRollingUsers(frequency, users) +``` + +PARAMETERS: + +* **frequency** (`string`) + - valid values: `"hourly"`, `"daily"`, `"weekly"`, `"monthly"` +* **users** (`array`) + +`withRollingUsers` sets an OnCallShift to type `rolling_users` and +configures required fields. `users` must be an array *of arrays* +of strings referring to users by email address. `frequency` is required +for this shift type. + +#### fn shift.withRollingUsersMixin + +```jsonnet +shift.withRollingUsersMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for rolling_users event type) +The list of lists with on-call users (for rolling_users event type) +#### fn shift.withStart + +```jsonnet +shift.withStart(value) +``` + +PARAMETERS: + +* **value** (`string`) + +call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +The start time of the on-call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +#### fn shift.withStartRotationFromUserIndex + +```jsonnet +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. +#### fn shift.withTeamId + +```jsonnet +shift.withTeamId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. +The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. +#### fn shift.withTimeZone + +```jsonnet +shift.withTimeZone(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's timezone. Overrides schedule's timezone. +The shift's timezone. Overrides schedule's timezone. +#### fn shift.withType + +```jsonnet +shift.withType(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The shift's type. Can be rolling_users, recurrent_event, single_event +The shift's type. Can be rolling_users, recurrent_event, single_event +#### fn shift.withUntil + +```jsonnet +shift.withUntil(value) +``` + +PARAMETERS: + +* **value** (`string`) + +call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +The end time of recurrent on-call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") +#### fn shift.withUsers + +```jsonnet +shift.withUsers(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for single_event and recurrent_event event type). +The list of on-call users (for single_event and recurrent_event event type). +#### fn shift.withUsersMixin + +```jsonnet +shift.withUsersMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +call users (for single_event and recurrent_event event type). +The list of on-call users (for single_event and recurrent_event event type). +#### fn shift.withWeekStart + +```jsonnet +shift.withWeekStart(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU +Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/index.md b/docs/oncall/integration/defaultRoute/index.md new file mode 100644 index 0000000..c7411f9 --- /dev/null +++ b/docs/oncall/integration/defaultRoute/index.md @@ -0,0 +1,334 @@ +# defaultRoute + + + +## Subpackages + +* [msteams](msteams.md) +* [slack](slack.md) +* [telegram](telegram.md) + +## Index + +* [`fn withEscalationChainId(value)`](#fn-withescalationchainid) +* [`fn withEscalationChainRef(value)`](#fn-withescalationchainref) +* [`fn withEscalationChainRefMixin(value)`](#fn-withescalationchainrefmixin) +* [`fn withEscalationChainSelector(value)`](#fn-withescalationchainselector) +* [`fn withEscalationChainSelectorMixin(value)`](#fn-withescalationchainselectormixin) +* [`fn withMsteams(value)`](#fn-withmsteams) +* [`fn withMsteamsMixin(value)`](#fn-withmsteamsmixin) +* [`fn withSlack(value)`](#fn-withslack) +* [`fn withSlackMixin(value)`](#fn-withslackmixin) +* [`fn withTelegram(value)`](#fn-withtelegram) +* [`fn withTelegramMixin(value)`](#fn-withtelegrammixin) +* [`obj escalationChainRef`](#obj-escalationchainref) + * [`fn withName(value)`](#fn-escalationchainrefwithname) + * [`fn withPolicy(value)`](#fn-escalationchainrefwithpolicy) + * [`fn withPolicyMixin(value)`](#fn-escalationchainrefwithpolicymixin) + * [`obj policy`](#obj-escalationchainrefpolicy) + * [`fn withResolution(value="Required")`](#fn-escalationchainrefpolicywithresolution) + * [`fn withResolve(value)`](#fn-escalationchainrefpolicywithresolve) +* [`obj escalationChainSelector`](#obj-escalationchainselector) + * [`fn withMatchControllerRef(value=true)`](#fn-escalationchainselectorwithmatchcontrollerref) + * [`fn withMatchLabels(value)`](#fn-escalationchainselectorwithmatchlabels) + * [`fn withMatchLabelsMixin(value)`](#fn-escalationchainselectorwithmatchlabelsmixin) + * [`fn withPolicy(value)`](#fn-escalationchainselectorwithpolicy) + * [`fn withPolicyMixin(value)`](#fn-escalationchainselectorwithpolicymixin) + * [`obj policy`](#obj-escalationchainselectorpolicy) + * [`fn withResolution(value="Required")`](#fn-escalationchainselectorpolicywithresolution) + * [`fn withResolve(value)`](#fn-escalationchainselectorpolicywithresolve) + +## Fields + +### fn withEscalationChainId + +```jsonnet +withEscalationChainId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of the escalation chain. +The ID of the escalation chain. +### fn withEscalationChainRef + +```jsonnet +withEscalationChainRef(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Reference to a EscalationChain in oncall to populate escalationChainId. +### fn withEscalationChainRefMixin + +```jsonnet +withEscalationChainRefMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Reference to a EscalationChain in oncall to populate escalationChainId. +### fn withEscalationChainSelector + +```jsonnet +withEscalationChainSelector(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Selector for a EscalationChain in oncall to populate escalationChainId. +### fn withEscalationChainSelectorMixin + +```jsonnet +withEscalationChainSelectorMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Selector for a EscalationChain in oncall to populate escalationChainId. +### fn withMsteams + +```jsonnet +withMsteams(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +MS teams-specific settings for a route. +### fn withMsteamsMixin + +```jsonnet +withMsteamsMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +MS teams-specific settings for a route. +### fn withSlack + +```jsonnet +withSlack(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Slack-specific settings for a route. +### fn withSlackMixin + +```jsonnet +withSlackMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Slack-specific settings for a route. +### fn withTelegram + +```jsonnet +withTelegram(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Telegram-specific settings for a route. +### fn withTelegramMixin + +```jsonnet +withTelegramMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Telegram-specific settings for a route. +### obj escalationChainRef + + +#### fn escalationChainRef.withName + +```jsonnet +escalationChainRef.withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +Name of the referenced object. +#### fn escalationChainRef.withPolicy + +```jsonnet +escalationChainRef.withPolicy(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for referencing. +#### fn escalationChainRef.withPolicyMixin + +```jsonnet +escalationChainRef.withPolicyMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for referencing. +#### obj escalationChainRef.policy + + +##### fn escalationChainRef.policy.withResolution + +```jsonnet +escalationChainRef.policy.withResolution(value="Required") +``` + +PARAMETERS: + +* **value** (`string`) + - default value: `"Required"` + - valid values: `"Required"`, `"Optional"` + +Resolution specifies whether resolution of this reference is required. +The default is 'Required', which means the reconcile will fail if the +reference cannot be resolved. 'Optional' means this reference will be +a no-op if it cannot be resolved. +##### fn escalationChainRef.policy.withResolve + +```jsonnet +escalationChainRef.policy.withResolve(value) +``` + +PARAMETERS: + +* **value** (`string`) + - valid values: `"Always"`, `"IfNotPresent"` + +Resolve specifies when this reference should be resolved. The default +is 'IfNotPresent', which will attempt to resolve the reference only when +the corresponding field is not present. Use 'Always' to resolve the +reference on every reconcile. +### obj escalationChainSelector + + +#### fn escalationChainSelector.withMatchControllerRef + +```jsonnet +escalationChainSelector.withMatchControllerRef(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +MatchControllerRef ensures an object with the same controller reference +as the selecting object is selected. +#### fn escalationChainSelector.withMatchLabels + +```jsonnet +escalationChainSelector.withMatchLabels(value) +``` + +PARAMETERS: + +* **value** (`object`) + +MatchLabels ensures an object with matching labels is selected. +#### fn escalationChainSelector.withMatchLabelsMixin + +```jsonnet +escalationChainSelector.withMatchLabelsMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +MatchLabels ensures an object with matching labels is selected. +#### fn escalationChainSelector.withPolicy + +```jsonnet +escalationChainSelector.withPolicy(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for selection. +#### fn escalationChainSelector.withPolicyMixin + +```jsonnet +escalationChainSelector.withPolicyMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for selection. +#### obj escalationChainSelector.policy + + +##### fn escalationChainSelector.policy.withResolution + +```jsonnet +escalationChainSelector.policy.withResolution(value="Required") +``` + +PARAMETERS: + +* **value** (`string`) + - default value: `"Required"` + - valid values: `"Required"`, `"Optional"` + +Resolution specifies whether resolution of this reference is required. +The default is 'Required', which means the reconcile will fail if the +reference cannot be resolved. 'Optional' means this reference will be +a no-op if it cannot be resolved. +##### fn escalationChainSelector.policy.withResolve + +```jsonnet +escalationChainSelector.policy.withResolve(value) +``` + +PARAMETERS: + +* **value** (`string`) + - valid values: `"Always"`, `"IfNotPresent"` + +Resolve specifies when this reference should be resolved. The default +is 'IfNotPresent', which will attempt to resolve the reference only when +the corresponding field is not present. Use 'Always' to resolve the +reference on every reconcile. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/msteams.md b/docs/oncall/integration/defaultRoute/msteams.md new file mode 100644 index 0000000..3ecf5af --- /dev/null +++ b/docs/oncall/integration/defaultRoute/msteams.md @@ -0,0 +1,36 @@ +# msteams + + + +## Index + +* [`fn withEnabled(value=true)`](#fn-withenabled) +* [`fn withId(value)`](#fn-withid) + +## Fields + +### fn withEnabled + +```jsonnet +withEnabled(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +(Boolean) Enable notification in MS teams. Defaults to true. +Enable notification in MS teams. Defaults to `true`. +### fn withId + +```jsonnet +withId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of this resource. +MS teams channel id. Alerts will be directed to this channel in Microsoft teams. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/slack.md b/docs/oncall/integration/defaultRoute/slack.md new file mode 100644 index 0000000..e0307df --- /dev/null +++ b/docs/oncall/integration/defaultRoute/slack.md @@ -0,0 +1,36 @@ +# slack + + + +## Index + +* [`fn withChannelId(value)`](#fn-withchannelid) +* [`fn withEnabled(value=true)`](#fn-withenabled) + +## Fields + +### fn withChannelId + +```jsonnet +withChannelId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Slack channel id. Alerts will be directed to this channel in Slack. +Slack channel id. Alerts will be directed to this channel in Slack. +### fn withEnabled + +```jsonnet +withEnabled(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +(Boolean) Enable notification in MS teams. Defaults to true. +Enable notification in Slack. Defaults to `true`. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/telegram.md b/docs/oncall/integration/defaultRoute/telegram.md new file mode 100644 index 0000000..66b0cbc --- /dev/null +++ b/docs/oncall/integration/defaultRoute/telegram.md @@ -0,0 +1,36 @@ +# telegram + + + +## Index + +* [`fn withEnabled(value=true)`](#fn-withenabled) +* [`fn withId(value)`](#fn-withid) + +## Fields + +### fn withEnabled + +```jsonnet +withEnabled(value=true) +``` + +PARAMETERS: + +* **value** (`boolean`) + - default value: `true` + +(Boolean) Enable notification in MS teams. Defaults to true. +Enable notification in Telegram. Defaults to `true`. +### fn withId + +```jsonnet +withId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) The ID of this resource. +Telegram channel id. Alerts will be directed to this channel in Telegram. \ No newline at end of file diff --git a/docs/oncall/integration/templates/email.md b/docs/oncall/integration/templates/email.md new file mode 100644 index 0000000..794c3e5 --- /dev/null +++ b/docs/oncall/integration/templates/email.md @@ -0,0 +1,35 @@ +# email + + + +## Index + +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/index.md b/docs/oncall/integration/templates/index.md new file mode 100644 index 0000000..b40828b --- /dev/null +++ b/docs/oncall/integration/templates/index.md @@ -0,0 +1,280 @@ +# templates + + + +## Subpackages + +* [email](email.md) +* [microsoftTeams](microsoftTeams.md) +* [mobileApp](mobileApp.md) +* [phoneCall](phoneCall.md) +* [slack](slack.md) +* [sms](sms.md) +* [telegram](telegram.md) +* [web](web.md) + +## Index + +* [`fn withAcknowledgeSignal(value)`](#fn-withacknowledgesignal) +* [`fn withEmail(value)`](#fn-withemail) +* [`fn withEmailMixin(value)`](#fn-withemailmixin) +* [`fn withGroupingKey(value)`](#fn-withgroupingkey) +* [`fn withMicrosoftTeams(value)`](#fn-withmicrosoftteams) +* [`fn withMicrosoftTeamsMixin(value)`](#fn-withmicrosoftteamsmixin) +* [`fn withMobileApp(value)`](#fn-withmobileapp) +* [`fn withMobileAppMixin(value)`](#fn-withmobileappmixin) +* [`fn withPhoneCall(value)`](#fn-withphonecall) +* [`fn withPhoneCallMixin(value)`](#fn-withphonecallmixin) +* [`fn withResolveSignal(value)`](#fn-withresolvesignal) +* [`fn withSlack(value)`](#fn-withslack) +* [`fn withSlackMixin(value)`](#fn-withslackmixin) +* [`fn withSms(value)`](#fn-withsms) +* [`fn withSmsMixin(value)`](#fn-withsmsmixin) +* [`fn withSourceLink(value)`](#fn-withsourcelink) +* [`fn withTelegram(value)`](#fn-withtelegram) +* [`fn withTelegramMixin(value)`](#fn-withtelegrammixin) +* [`fn withWeb(value)`](#fn-withweb) +* [`fn withWebMixin(value)`](#fn-withwebmixin) + +## Fields + +### fn withAcknowledgeSignal + +```jsonnet +withAcknowledgeSignal(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for sending a signal to acknowledge the Incident. +Template for sending a signal to acknowledge the Incident. +### fn withEmail + +```jsonnet +withEmail(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Email. (see below for nested schema) +Templates for Email. +### fn withEmailMixin + +```jsonnet +withEmailMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Email. (see below for nested schema) +Templates for Email. +### fn withGroupingKey + +```jsonnet +withGroupingKey(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for the key by which alerts are grouped. +Template for the key by which alerts are grouped. +### fn withMicrosoftTeams + +```jsonnet +withMicrosoftTeams(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Microsoft Teams. NOTE: Microsoft Teams templates are only available on Grafana Cloud. (see below for nested schema) +Templates for Microsoft Teams. **NOTE**: Microsoft Teams templates are only available on Grafana Cloud. +### fn withMicrosoftTeamsMixin + +```jsonnet +withMicrosoftTeamsMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Microsoft Teams. NOTE: Microsoft Teams templates are only available on Grafana Cloud. (see below for nested schema) +Templates for Microsoft Teams. **NOTE**: Microsoft Teams templates are only available on Grafana Cloud. +### fn withMobileApp + +```jsonnet +withMobileApp(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Mobile app push notifications. (see below for nested schema) +Templates for Mobile app push notifications. +### fn withMobileAppMixin + +```jsonnet +withMobileAppMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Mobile app push notifications. (see below for nested schema) +Templates for Mobile app push notifications. +### fn withPhoneCall + +```jsonnet +withPhoneCall(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Phone Call. (see below for nested schema) +Templates for Phone Call. +### fn withPhoneCallMixin + +```jsonnet +withPhoneCallMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Phone Call. (see below for nested schema) +Templates for Phone Call. +### fn withResolveSignal + +```jsonnet +withResolveSignal(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for sending a signal to resolve the Incident. +Template for sending a signal to resolve the Incident. +### fn withSlack + +```jsonnet +withSlack(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Templates for Slack. +### fn withSlackMixin + +```jsonnet +withSlackMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Templates for Slack. +### fn withSms + +```jsonnet +withSms(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for SMS. (see below for nested schema) +Templates for SMS. +### fn withSmsMixin + +```jsonnet +withSmsMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for SMS. (see below for nested schema) +Templates for SMS. +### fn withSourceLink + +```jsonnet +withSourceLink(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for a source link. +Template for a source link. +### fn withTelegram + +```jsonnet +withTelegram(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Templates for Telegram. +### fn withTelegramMixin + +```jsonnet +withTelegramMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +specific settings for a route. (see below for nested schema) +Templates for Telegram. +### fn withWeb + +```jsonnet +withWeb(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Web. (see below for nested schema) +Templates for Web. +### fn withWebMixin + +```jsonnet +withWebMixin(value) +``` + +PARAMETERS: + +* **value** (`array`) + +(Block List, Max: 1) Templates for Web. (see below for nested schema) +Templates for Web. \ No newline at end of file diff --git a/docs/oncall/integration/templates/microsoftTeams.md b/docs/oncall/integration/templates/microsoftTeams.md new file mode 100644 index 0000000..12fda25 --- /dev/null +++ b/docs/oncall/integration/templates/microsoftTeams.md @@ -0,0 +1,48 @@ +# microsoftTeams + + + +## Index + +* [`fn withImageUrl(value)`](#fn-withimageurl) +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withImageUrl + +```jsonnet +withImageUrl(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert image url. +Template for Alert image url. +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/mobileApp.md b/docs/oncall/integration/templates/mobileApp.md new file mode 100644 index 0000000..58619d3 --- /dev/null +++ b/docs/oncall/integration/templates/mobileApp.md @@ -0,0 +1,35 @@ +# mobileApp + + + +## Index + +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/phoneCall.md b/docs/oncall/integration/templates/phoneCall.md new file mode 100644 index 0000000..381d2d8 --- /dev/null +++ b/docs/oncall/integration/templates/phoneCall.md @@ -0,0 +1,22 @@ +# phoneCall + + + +## Index + +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/slack.md b/docs/oncall/integration/templates/slack.md new file mode 100644 index 0000000..15d3ba5 --- /dev/null +++ b/docs/oncall/integration/templates/slack.md @@ -0,0 +1,48 @@ +# slack + + + +## Index + +* [`fn withImageUrl(value)`](#fn-withimageurl) +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withImageUrl + +```jsonnet +withImageUrl(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert image url. +Template for Alert image url. +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/sms.md b/docs/oncall/integration/templates/sms.md new file mode 100644 index 0000000..7011ae3 --- /dev/null +++ b/docs/oncall/integration/templates/sms.md @@ -0,0 +1,22 @@ +# sms + + + +## Index + +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/telegram.md b/docs/oncall/integration/templates/telegram.md new file mode 100644 index 0000000..931fb64 --- /dev/null +++ b/docs/oncall/integration/templates/telegram.md @@ -0,0 +1,48 @@ +# telegram + + + +## Index + +* [`fn withImageUrl(value)`](#fn-withimageurl) +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withImageUrl + +```jsonnet +withImageUrl(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert image url. +Template for Alert image url. +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/web.md b/docs/oncall/integration/templates/web.md new file mode 100644 index 0000000..c7102ef --- /dev/null +++ b/docs/oncall/integration/templates/web.md @@ -0,0 +1,48 @@ +# web + + + +## Index + +* [`fn withImageUrl(value)`](#fn-withimageurl) +* [`fn withMessage(value)`](#fn-withmessage) +* [`fn withTitle(value)`](#fn-withtitle) + +## Fields + +### fn withImageUrl + +```jsonnet +withImageUrl(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert image url. +Template for Alert image url. +### fn withMessage + +```jsonnet +withMessage(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert message. +Template for Alert message. +### fn withTitle + +```jsonnet +withTitle(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Template for Alert title. +Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/schedule/shiftsRef.md b/docs/oncall/schedule/shiftsRef.md new file mode 100644 index 0000000..1ec53f3 --- /dev/null +++ b/docs/oncall/schedule/shiftsRef.md @@ -0,0 +1,82 @@ +# shiftsRef + + + +## Index + +* [`fn withName(value)`](#fn-withname) +* [`fn withPolicy(value)`](#fn-withpolicy) +* [`fn withPolicyMixin(value)`](#fn-withpolicymixin) +* [`obj policy`](#obj-policy) + * [`fn withResolution(value="Required")`](#fn-policywithresolution) + * [`fn withResolve(value)`](#fn-policywithresolve) + +## Fields + +### fn withName + +```jsonnet +withName(value) +``` + +PARAMETERS: + +* **value** (`string`) + +Name of the referenced object. +### fn withPolicy + +```jsonnet +withPolicy(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for referencing. +### fn withPolicyMixin + +```jsonnet +withPolicyMixin(value) +``` + +PARAMETERS: + +* **value** (`object`) + +Policies for referencing. +### obj policy + + +#### fn policy.withResolution + +```jsonnet +policy.withResolution(value="Required") +``` + +PARAMETERS: + +* **value** (`string`) + - default value: `"Required"` + - valid values: `"Required"`, `"Optional"` + +Resolution specifies whether resolution of this reference is required. +The default is 'Required', which means the reconcile will fail if the +reference cannot be resolved. 'Optional' means this reference will be +a no-op if it cannot be resolved. +#### fn policy.withResolve + +```jsonnet +policy.withResolve(value) +``` + +PARAMETERS: + +* **value** (`string`) + - valid values: `"Always"`, `"IfNotPresent"` + +Resolve specifies when this reference should be resolved. The default +is 'IfNotPresent', which will attempt to resolve the reference only when +the corresponding field is not present. Use 'Always' to resolve the +reference on every reconcile. \ No newline at end of file diff --git a/docs/oncall/schedule/slack.md b/docs/oncall/schedule/slack.md new file mode 100644 index 0000000..669f0ea --- /dev/null +++ b/docs/oncall/schedule/slack.md @@ -0,0 +1,35 @@ +# slack + + + +## Index + +* [`fn withChannelId(value)`](#fn-withchannelid) +* [`fn withUserGroupId(value)`](#fn-withusergroupid) + +## Fields + +### fn withChannelId + +```jsonnet +withChannelId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +(String) Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack. +Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack. +### fn withUserGroupId + +```jsonnet +withUserGroupId(value) +``` + +PARAMETERS: + +* **value** (`string`) + +call users change. +Slack user group id. Members of user group will be updated when on-call users change. \ No newline at end of file From dc79cebed3d206960b59de7ee5b8a49b567af25b Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 13:26:23 -0500 Subject: [PATCH 26/37] docs(oncall): remove docs for already-removed parameter Co-authored-by: Jeroen Op 't Eynde --- grafanaplane/oncall/schedule.libsonnet | 1 - 1 file changed, 1 deletion(-) diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index f6510d2..6ab7690 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -18,7 +18,6 @@ forProvider // raise forProvider functions to here [ d.argument.new('name', d.T.string), d.argument.new('type', d.T.string, enums=['ical', 'calendar']), - d.argument.new('providerName', d.T.string), d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), ] ), From f7fc2a24ca3c01130790ff5136336381ae7080b3 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 13:41:36 -0500 Subject: [PATCH 27/37] feat(oncall): add Escalation Chain withTeamId and remove raw inheritance --- grafanaplane/oncall/escalationchain.libsonnet | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/grafanaplane/oncall/escalationchain.libsonnet b/grafanaplane/oncall/escalationchain.libsonnet index 379ac0e..f4393c7 100644 --- a/grafanaplane/oncall/escalationchain.libsonnet +++ b/grafanaplane/oncall/escalationchain.libsonnet @@ -6,7 +6,6 @@ local raw = import '../zz/main.libsonnet'; local escalationChain = raw.oncall.v1alpha1.escalationChain; local escalation = raw.oncall.v1alpha1.escalation; -escalationChain.spec.parameters.forProvider { '#new':: d.func.new( ||| @@ -46,6 +45,21 @@ escalationChain.spec.parameters.forProvider ), }, + '#withTeamId':: d.func.new( + ||| + `withTeamId` configures the Team ID on the Escalation Chain. `teamId` + should be the ID of the team as a string. + |||, + [ + d.argument.new('teamId', d.T.string), + ] + ), + withTeamId(teamId):: { + // Constructor nests the resource beneath the `chain` key, so we wrap the + // raw function to do the same. + chain+: escalationChain.spec.parameters.forProvider.withTeamId(teamId), + }, + step: { local forProvider = escalation.spec.parameters.forProvider, From 104017cde3fdbd8c3a6e43237481f4526b84e11d Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 13:47:04 -0500 Subject: [PATCH 28/37] fix(oncall): require names, rather than names or manifests --- grafanaplane/oncall/escalationchain.libsonnet | 11 +++++------ grafanaplane/oncall/integration.libsonnet | 11 +++++------ grafanaplane/oncall/schedule.libsonnet | 9 ++++----- grafanaplane/util.libsonnet | 17 ----------------- 4 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 grafanaplane/util.libsonnet diff --git a/grafanaplane/oncall/escalationchain.libsonnet b/grafanaplane/oncall/escalationchain.libsonnet index f4393c7..c7dc718 100644 --- a/grafanaplane/oncall/escalationchain.libsonnet +++ b/grafanaplane/oncall/escalationchain.libsonnet @@ -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; @@ -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( diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index db9ff7e..4f549ec 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -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; @@ -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) ), }, diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 6ab7690..c60d7a1 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -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; @@ -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 ]), } diff --git a/grafanaplane/util.libsonnet b/grafanaplane/util.libsonnet deleted file mode 100644 index 1c1b8c4..0000000 --- a/grafanaplane/util.libsonnet +++ /dev/null @@ -1,17 +0,0 @@ -local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; - -{ - '#':: d.package.newSub('util', 'internal utilities'), - - '#getName':: d.func.new( - ||| - `getName` is supplied either a name or a manifest, and returns just the - name as a string. - |||, - [d.argument.new('nameOrManifest', 'string|object')] - ), - getName(nameOrManifest):: - if std.isString(nameOrManifest) - then nameOrManifest - else nameOrManifest.metadata.name, -} From 8a4cc12a096da6523a9da67b3ba3ccc4d02c24a0 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 13:50:34 -0500 Subject: [PATCH 29/37] fix(oncall): remove raw inheritance from Integrations --- grafanaplane/oncall/integration.libsonnet | 1 - 1 file changed, 1 deletion(-) diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index 4f549ec..2c31680 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -6,7 +6,6 @@ local integration = raw.oncall.v1alpha1.integration; local route = raw.oncall.v1alpha1.route; local forProvider = integration.spec.parameters.forProvider; -forProvider { '#new':: d.func.new( ||| From 2ead4234280e0d4b2afb8b717d95a2c6b97967ff Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 14:21:26 -0500 Subject: [PATCH 30/37] fix(oncall): remove raw inheritance from Shift and Schedule --- grafanaplane/oncall/schedule.libsonnet | 7 +++---- grafanaplane/oncall/shift.libsonnet | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index c60d7a1..50a95e7 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -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, @@ -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 ]), } diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index a064374..9f7944d 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -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( ||| @@ -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( ||| @@ -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, } From a733ef028e10fb6cad82ebb7c5c6d19fcd94f657 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 15:02:10 -0500 Subject: [PATCH 31/37] fix(oncall): improve withRollingUsers docs and error checking --- grafanaplane/oncall/shift.libsonnet | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 9f7944d..0b7abee 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -23,9 +23,25 @@ local forProvider = shift.spec.parameters.forProvider; '#withRollingUsers':: d.func.new( ||| `withRollingUsers` sets an OnCallShift to type `rolling_users` and - configures required fields. `users` must be an array *of arrays* - of strings referring to users by email address. `frequency` is required - for this shift type. + 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. + + [HTTP API docs]: https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts/ |||, [ d.argument.new('frequency', d.T.string, enums=['hourly', 'daily', 'weekly', 'monthly']), @@ -33,6 +49,9 @@ local forProvider = shift.spec.parameters.forProvider; ] ), withRollingUsers(frequency, users):: + assert std.isArray(users) : 'Users is not an array!'; + assert std.all([std.isArray(item) for item in users]) + : 'Users is not an array of arrays!'; forProvider.withType('rolling_users') + forProvider.withRollingUsers(users) + forProvider.withFrequency(frequency), From 39908f7deebee5f829b24f4d28d12e736dcd9678 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 15:14:53 -0500 Subject: [PATCH 32/37] fix(oncall): change Route constructor --- grafanaplane/oncall/integration.libsonnet | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index 2c31680..d07b508 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -65,25 +65,23 @@ local forProvider = integration.spec.parameters.forProvider; route: { local forProvider = route.spec.parameters.forProvider, - '#chain':: d.func.new( + '#new':: d.func.new( ||| - `chain` configures a Route to reference an Escalation Chain. + `new` configures a Route with a given `routingRegex`. |||, - [d.argument.new('name', d.T.string)] + [d.argument.new('routingRegex', d.T.string)] ), - chain(name):: - forProvider.escalationChainRef.withName(name), + new(routingRegex):: + forProvider.withRoutingRegex(routingRegex), - - '#withRoutingRegex':: d.func.new( + '#withEscalationChain':: d.func.new( ||| - `withRoutingRegex` configures a Route to have routing type `regex` and - use the supplied regex. + `withEscalationChain` configures a Route with a destination Escalation + Chain. `escalationChainName` is the resource name of the chain. |||, - [d.argument.new('regex', d.T.string)] + [d.argument.new('escalationChainName', d.T.string)] ), - withRoutingRegex(regex):: - forProvider.withRoutingType('regex') - + forProvider.withRoutingRegex(regex), + withEscalationChain(escalationChainName):: + forProvider.escalationChainRef.withName(escalationChainName), }, } From 023dbbaac55a440f174b7ceaedf2a479d1fcb946 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 15:25:59 -0500 Subject: [PATCH 33/37] fix(oncall): rework Routes API Co-authored-by: Jeroen Op 't Eynde --- grafanaplane/oncall/integration.libsonnet | 56 ++++++++++------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index d07b508..ee8e9d3 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -11,56 +11,48 @@ local forProvider = integration.spec.parameters.forProvider; ||| `new` creates an Integration. The `name` is a display-friendly string, and `id` defaults to a slug-ified version of it. `type` is the type of - Integration. + Integration. `defaultChainName` is the resource name of the default + Escalation Chain. |||, [ d.argument.new('name', d.T.string), d.argument.new('type', d.T.string), + d.argument.new('defaultChainName', d.T.string), d.argument.new('id', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, id=xtd.ascii.stringToRFC1123(name)):: { + new(name, type, defaultChainName, id=xtd.ascii.stringToRFC1123(name)):: { integrationName:: id, + defaultChainName:: defaultChainName, integration: integration.new(id) - + integration.spec.parameters.forProvider.withName(name) - + integration.spec.parameters.forProvider.withType(type), - }, - - '#withDefaultChain':: d.func.new( - ||| - `withDefaulChain` configures the default route of an Integration to use - an Escalation Chain. `escalationChain` is the resource name of the - desired Escalation Chain. - |||, - [ - d.argument.new('escalationChainName', d.T.string), - ] - ), - withDefaultChain(escalationChainName):: { - integration+: - forProvider.withDefaultRoute( - forProvider.defaultRoute.escalationChainRef.withName(escalationChainName) - ), + + forProvider.withName(name) + + forProvider.withType(type) + + forProvider.defaultRoute.escalationChainRef.withName(defaultChainName), }, '#withRoutes':: d.func.new( ||| `withRoute` configures Route resources connecting this Integration with - Escalation Chains. + 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. |||, - [d.argument.new('routes', d.T.object)] + [d.argument.new('routes', d.T.array)] ), withRoutes(routes):: { - local integrationName = self.integrationName, - routes: { - [item.key]: - local id = '%s-%s' % [integrationName, item.key]; - route.new(id) - + route.spec.parameters.forProvider.integrationRef.withName(integrationName) - + item.value - for item in std.objectKeysValues(routes) - }, + local forProvider = route.spec.parameters.forProvider, + routes: + std.mapWithIndex( + function(position, item) + route.new('%s-%d' % [self.integrationName, position]) + + forProvider.integrationRef.withName(self.integrationName) + // use the default chain if not specified + + forProvider.escalationChainRef.withName(self.defaultChainName) + + forProvider.withPosition(position) + + item, + routes + ), }, route: { From c035b6dc1dc239b29b044103cb1e7ad95ec493f2 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 15:35:42 -0500 Subject: [PATCH 34/37] refactor(oncall): break ID-setting out to withId functions --- grafanaplane/oncall/escalationchain.libsonnet | 26 +++++++++++-------- grafanaplane/oncall/integration.libsonnet | 23 ++++++++++------ grafanaplane/oncall/schedule.libsonnet | 21 +++++++-------- grafanaplane/oncall/shift.libsonnet | 20 +++++++------- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/grafanaplane/oncall/escalationchain.libsonnet b/grafanaplane/oncall/escalationchain.libsonnet index c7dc718..812de9b 100644 --- a/grafanaplane/oncall/escalationchain.libsonnet +++ b/grafanaplane/oncall/escalationchain.libsonnet @@ -7,28 +7,32 @@ local escalation = raw.oncall.v1alpha1.escalation; { '#new':: d.func.new( - ||| - `new` creates an Escalation Chain. The `name` is a display-friendly - string, and `id` defaults to a slug-ified version of it. - |||, - [ - d.argument.new('name', d.T.string), - d.argument.new('id', d.T.string, default='rfc1123(name)'), - ] + '`new` creates an Escalation Chain. The `name` is a display-friendly string.', + [d.argument.new('name', d.T.string)] ), - new(name, id=xtd.ascii.stringToRFC1123(name)):: { - chainName:: id, + new(name):: { + chainName:: xtd.ascii.stringToRFC1123(name), chain: - escalationChain.new(id) + escalationChain.new(self.chainName) + escalationChain.spec.parameters.forProvider.withName(name), }, + '#withId':: d.func.new( + '`withId` sets the resource name for an Escalation Chain', + [d.argument.new('id', d.T.string)] + ), + withId(id):: { + chainName:: id, + chain+: escalationChain.metadata.withName(id), + }, + '#withSteps':: d.func.new( ||| `withSteps` configures one or more Escalation resources as steps within the calling Escalation Chain. |||, [ + d.argument.new('steps', d.T.array), ] ), withSteps(steps):: { diff --git a/grafanaplane/oncall/integration.libsonnet b/grafanaplane/oncall/integration.libsonnet index ee8e9d3..3877b84 100644 --- a/grafanaplane/oncall/integration.libsonnet +++ b/grafanaplane/oncall/integration.libsonnet @@ -9,28 +9,35 @@ local forProvider = integration.spec.parameters.forProvider; { '#new':: d.func.new( ||| - `new` creates an Integration. The `name` is a display-friendly string, - and `id` defaults to a slug-ified version of it. `type` is the type of - Integration. `defaultChainName` is the resource name of the default - Escalation Chain. + `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. |||, [ d.argument.new('name', d.T.string), d.argument.new('type', d.T.string), d.argument.new('defaultChainName', d.T.string), - d.argument.new('id', d.T.string, default='rfc1123(name)'), ] ), - new(name, type, defaultChainName, id=xtd.ascii.stringToRFC1123(name)):: { - integrationName:: id, + new(name, type, defaultChainName):: { + integrationName:: xtd.ascii.stringToRFC1123(name), defaultChainName:: defaultChainName, integration: - integration.new(id) + integration.new(self.integrationName) + forProvider.withName(name) + forProvider.withType(type) + forProvider.defaultRoute.escalationChainRef.withName(defaultChainName), }, + '#withId':: d.func.new( + '`withId` sets the resource name for an Integration', + [d.argument.new('id', d.T.string)] + ), + withId(id):: { + integrationName:: id, + integration+: integration.metadata.withName(id), + }, + '#withRoutes':: d.func.new( ||| `withRoute` configures Route resources connecting this Integration with diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 50a95e7..8a8c5a1 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -9,20 +9,19 @@ local forProvider = schedule.spec.parameters.forProvider; local base = self, '#new':: d.func.new( - ||| - `new` creates a Schedule. The `name` is a display-friendly - string, and `id` defaults to a slug-ified version of it. - |||, - [ - d.argument.new('name', d.T.string), - d.argument.new('type', d.T.string, enums=['ical', 'calendar']), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), - ] + '`new` creates a Schedule. The `name` is a display-friendly string.', + [d.argument.new('name', d.T.string)] ), - new(name, id=xtd.ascii.stringToRFC1123(name)):: - schedule.new(id) + new(name):: + schedule.new(xtd.ascii.stringToRFC1123(name)) + schedule.spec.parameters.forProvider.withName(name), + '#withId':: d.func.new( + '`withId` sets the resource name for a Schedule', + [d.argument.new('id', d.T.string)] + ), + withId(id):: schedule.metadata.withName(id), + '#withShifts':: d.func.new( ||| `withShifts` sets a Schedule to type `calendar` and configures shifts. diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 0b7abee..68ab473 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -7,19 +7,19 @@ local forProvider = shift.spec.parameters.forProvider; { '#new':: d.func.new( - ||| - `new` creates an OnCallShift. The `name` is a display-friendly string, - and `id` defaults to a slug-ified version of it. - |||, - [ - d.argument.new('name', d.T.string), - d.argument.new('resourceId', d.T.string, default='rfc1123(name)'), - ] + '`new` creates an OnCallShift. The `name` is a display-friendly string.', + [d.argument.new('name', d.T.string)] ), - new(name, id=xtd.ascii.stringToRFC1123(name)):: - shift.new(id) + new(name):: + shift.new(xtd.ascii.stringToRFC1123(name)) + forProvider.withName(name), + '#withId':: d.func.new( + '`withId` sets the resource name for a Shift', + [d.argument.new('id', d.T.string)] + ), + withId(id):: shift.metadata.withName(id), + '#withRollingUsers':: d.func.new( ||| `withRollingUsers` sets an OnCallShift to type `rolling_users` and From 347c0342e7fbb6bd74383343c4c2d9e5c148a670 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 17:27:25 -0500 Subject: [PATCH 35/37] refactor(oncall): reorganize Shift API underneath Schedules --- grafanaplane/oncall/main.libsonnet | 1 - grafanaplane/oncall/schedule.libsonnet | 106 +++++++++++++++++-------- grafanaplane/oncall/shift.libsonnet | 21 +++-- 3 files changed, 89 insertions(+), 39 deletions(-) diff --git a/grafanaplane/oncall/main.libsonnet b/grafanaplane/oncall/main.libsonnet index 8ff504d..bd5f03f 100644 --- a/grafanaplane/oncall/main.libsonnet +++ b/grafanaplane/oncall/main.libsonnet @@ -8,5 +8,4 @@ local raw = import '../zz/main.libsonnet'; escalationChain: import './escalationchain.libsonnet', integration: import './integration.libsonnet', schedule: import './schedule.libsonnet', - shift: import './shift.libsonnet', } diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 8a8c5a1..9a60981 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -6,36 +6,78 @@ local schedule = raw.oncall.v1alpha1.schedule; local forProvider = schedule.spec.parameters.forProvider; { - local base = self, - - '#new':: d.func.new( - '`new` creates a Schedule. The `name` is a display-friendly string.', - [d.argument.new('name', d.T.string)] - ), - new(name):: - schedule.new(xtd.ascii.stringToRFC1123(name)) - + schedule.spec.parameters.forProvider.withName(name), - - '#withId':: d.func.new( - '`withId` sets the resource name for a Schedule', - [d.argument.new('id', d.T.string)] - ), - withId(id):: schedule.metadata.withName(id), - - '#withShifts':: d.func.new( - ||| - `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. - |||, - [ - d.argument.new('shifts', d.T.array), - ] - ), - withShifts(shifts):: - forProvider.withType('calendar') - + forProvider.withShiftsRef([ - forProvider.shiftsRef.withName(shift) - for shift in shifts - ]), + calendar: { + '#new':: d.func.new( + ||| + `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', { + weekday: // 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), + weekend: // 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), + }), + + secondary: calendar.new('Secondary', { + [shift.key]: + shift.value + // replace the resource ID + + calendar.shift.withId('secondary-' + shift.value.metadata.name) + // start rotating from the second person + + calendar.shift.withStartRotationFromUserIndex(1) + for shift in std.objectKeysValues(self.primary.shifts) + }), + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('shifts', d.T.object, default='{}'), + ] + ), + new(name, shifts={}): { + scheduleName:: xtd.ascii.stringToRFC1123(name), + schedule: + schedule.new(self.scheduleName) + + forProvider.withName(name) + + forProvider.withType('calendar') + + forProvider.withShiftsRef([ + forProvider.shiftsRef.withName(shift.metadata.name) + for shift in std.objectValues(self.shifts) + ]), + shifts: shifts, + }, + + '#withId':: d.func.new( + '`withId` sets the resource name for a Schedule', + [d.argument.new('id', d.T.string)] + ), + withId(id):: { + scheduleName:: id, + schedule+: schedule.metadata.withName(id), + }, + + '#withShifts':: d.func.new( + ||| + `withShifts` sets a map of Shifts on a calendar-type Schedule. + |||, + [d.argument.new('shifts', d.T.object)] + ), + withShifts(shifts):: { + shifts: shifts, + }, + + shift: import './shift.libsonnet', + }, } diff --git a/grafanaplane/oncall/shift.libsonnet b/grafanaplane/oncall/shift.libsonnet index 68ab473..686ef7c 100644 --- a/grafanaplane/oncall/shift.libsonnet +++ b/grafanaplane/oncall/shift.libsonnet @@ -7,12 +7,23 @@ local forProvider = shift.spec.parameters.forProvider; { '#new':: d.func.new( - '`new` creates an OnCallShift. The `name` is a display-friendly string.', - [d.argument.new('name', d.T.string)] + ||| + `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. + |||, + [ + d.argument.new('name', d.T.string), + d.argument.new('start', d.T.string), + d.argument.new('duration', d.T.number), + ] ), - new(name):: + new(name, start, duration):: shift.new(xtd.ascii.stringToRFC1123(name)) - + forProvider.withName(name), + + forProvider.withName(name) + + forProvider.withStart(start) + + forProvider.withDuration(duration), '#withId':: d.func.new( '`withId` sets the resource name for a Shift', @@ -57,8 +68,6 @@ local forProvider = shift.spec.parameters.forProvider; + forProvider.withFrequency(frequency), // Expose some generated functions here. - '#withStart':: forProvider['#withStart'], - withStart:: forProvider.withStart, '#withStartRotationFromUserIndex':: forProvider['#withStartRotationFromUserIndex'], withStartRotationFromUserIndex:: forProvider.withStartRotationFromUserIndex, '#withByDay':: forProvider['#withByDay'], From 10a24870470d647fd07be936d1ce9f7746b995a8 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Thu, 2 Jan 2025 17:28:39 -0500 Subject: [PATCH 36/37] docs(oncall): rebuild docs --- docs/README.md | 2 +- docs/oncall.md | 364 +++++++ docs/oncall/index.md | 925 ------------------ docs/oncall/integration/defaultRoute/index.md | 334 ------- .../integration/defaultRoute/msteams.md | 36 - docs/oncall/integration/defaultRoute/slack.md | 36 - .../integration/defaultRoute/telegram.md | 36 - docs/oncall/integration/templates/email.md | 35 - docs/oncall/integration/templates/index.md | 280 ------ .../integration/templates/microsoftTeams.md | 48 - .../oncall/integration/templates/mobileApp.md | 35 - .../oncall/integration/templates/phoneCall.md | 22 - docs/oncall/integration/templates/slack.md | 48 - docs/oncall/integration/templates/sms.md | 22 - docs/oncall/integration/templates/telegram.md | 48 - docs/oncall/integration/templates/web.md | 48 - docs/oncall/schedule/shiftsRef.md | 82 -- docs/oncall/schedule/slack.md | 35 - 18 files changed, 365 insertions(+), 2071 deletions(-) create mode 100644 docs/oncall.md delete mode 100644 docs/oncall/index.md delete mode 100644 docs/oncall/integration/defaultRoute/index.md delete mode 100644 docs/oncall/integration/defaultRoute/msteams.md delete mode 100644 docs/oncall/integration/defaultRoute/slack.md delete mode 100644 docs/oncall/integration/defaultRoute/telegram.md delete mode 100644 docs/oncall/integration/templates/email.md delete mode 100644 docs/oncall/integration/templates/index.md delete mode 100644 docs/oncall/integration/templates/microsoftTeams.md delete mode 100644 docs/oncall/integration/templates/mobileApp.md delete mode 100644 docs/oncall/integration/templates/phoneCall.md delete mode 100644 docs/oncall/integration/templates/slack.md delete mode 100644 docs/oncall/integration/templates/sms.md delete mode 100644 docs/oncall/integration/templates/telegram.md delete mode 100644 docs/oncall/integration/templates/web.md delete mode 100644 docs/oncall/schedule/shiftsRef.md delete mode 100644 docs/oncall/schedule/slack.md diff --git a/docs/README.md b/docs/README.md index 47c13f9..4018c35 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,7 +24,7 @@ local grafanaplane = import 'github.com/grafana/grafana-crossplane-libsonnet/gra ## Subpackages * [configurations](configurations.md) -* [oncall](oncall/index.md) +* [oncall](oncall.md) * [oss](oss/index.md) * [raw](raw/index.md) * [sm](sm/index.md) diff --git a/docs/oncall.md b/docs/oncall.md new file mode 100644 index 0000000..07d14ca --- /dev/null +++ b/docs/oncall.md @@ -0,0 +1,364 @@ +# oncall + + + +## Index + +* [`obj escalationChain`](#obj-escalationchain) + * [`fn new(name)`](#fn-escalationchainnew) + * [`fn withId(id)`](#fn-escalationchainwithid) + * [`fn withSteps(steps)`](#fn-escalationchainwithsteps) + * [`fn withTeamId(teamId)`](#fn-escalationchainwithteamid) + * [`obj step`](#obj-escalationchainstep) + * [`fn notifyOnCallFromSchedule(schedule)`](#fn-escalationchainstepnotifyoncallfromschedule) + * [`fn notifyPersons(persons)`](#fn-escalationchainstepnotifypersons) + * [`fn wait(seconds)`](#fn-escalationchainstepwait) +* [`obj integration`](#obj-integration) + * [`fn new(name, type, defaultChainName)`](#fn-integrationnew) + * [`fn withId(id)`](#fn-integrationwithid) + * [`fn withRoutes(routes)`](#fn-integrationwithroutes) + * [`obj route`](#obj-integrationroute) + * [`fn new(routingRegex)`](#fn-integrationroutenew) + * [`fn withEscalationChain(escalationChainName)`](#fn-integrationroutewithescalationchain) +* [`obj schedule`](#obj-schedule) + * [`obj calendar`](#obj-schedulecalendar) + * [`fn new(name, shifts="{}")`](#fn-schedulecalendarnew) + * [`fn withId(id)`](#fn-schedulecalendarwithid) + * [`fn withShifts(shifts)`](#fn-schedulecalendarwithshifts) + * [`obj shift`](#obj-schedulecalendarshift) + * [`fn new(name, start, duration)`](#fn-schedulecalendarshiftnew) + * [`fn withByDay(value)`](#fn-schedulecalendarshiftwithbyday) + * [`fn withId(id)`](#fn-schedulecalendarshiftwithid) + * [`fn withRollingUsers(frequency, users)`](#fn-schedulecalendarshiftwithrollingusers) + * [`fn withStartRotationFromUserIndex(value)`](#fn-schedulecalendarshiftwithstartrotationfromuserindex) + +## Fields + +### obj escalationChain + + +#### fn escalationChain.new + +```jsonnet +escalationChain.new(name) +``` + +PARAMETERS: + +* **name** (`string`) + +`new` creates an Escalation Chain. The `name` is a display-friendly string. +#### fn escalationChain.withId + +```jsonnet +escalationChain.withId(id) +``` + +PARAMETERS: + +* **id** (`string`) + +`withId` sets the resource name for an Escalation Chain +#### fn escalationChain.withSteps + +```jsonnet +escalationChain.withSteps(steps) +``` + +PARAMETERS: + +* **steps** (`array`) + +`withSteps` configures one or more Escalation resources as steps within +the calling Escalation Chain. + +#### fn escalationChain.withTeamId + +```jsonnet +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. + +#### obj escalationChain.step + + +##### fn escalationChain.step.notifyOnCallFromSchedule + +```jsonnet +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. + +##### fn escalationChain.step.notifyPersons + +```jsonnet +escalationChain.step.notifyPersons(persons) +``` + +PARAMETERS: + +* **persons** (`array`) + +`notifyPersons` configures an Escalation step to notify a list of +persons. + +##### fn escalationChain.step.wait + +```jsonnet +escalationChain.step.wait(seconds) +``` + +PARAMETERS: + +* **seconds** (`number`) + +`wait` configures an Escalation step to wait for acknowledgement for +the given number of seconds before proceeding. + +### obj integration + + +#### fn integration.new + +```jsonnet +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. + +#### fn integration.withId + +```jsonnet +integration.withId(id) +``` + +PARAMETERS: + +* **id** (`string`) + +`withId` sets the resource name for an Integration +#### fn integration.withRoutes + +```jsonnet +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. + +#### obj integration.route + + +##### fn integration.route.new + +```jsonnet +integration.route.new(routingRegex) +``` + +PARAMETERS: + +* **routingRegex** (`string`) + +`new` configures a Route with a given `routingRegex`. + +##### fn integration.route.withEscalationChain + +```jsonnet +integration.route.withEscalationChain(escalationChainName) +``` + +PARAMETERS: + +* **escalationChainName** (`string`) + +`withEscalationChain` configures a Route with a destination Escalation +Chain. `escalationChainName` is the resource name of the chain. + +### obj schedule + + +#### obj schedule.calendar + + +##### fn schedule.calendar.new + +```jsonnet +schedule.calendar.new(name, shifts="{}") +``` + +PARAMETERS: + +* **name** (`string`) +* **shifts** (`object`) + - 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', { + weekday: // 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), + weekend: // 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), + }), + + secondary: calendar.new('Secondary', { + [shift.key]: + shift.value + // replace the resource ID + + calendar.shift.withId('secondary-' + shift.value.metadata.name) + // start rotating from the second person + + calendar.shift.withStartRotationFromUserIndex(1) + for shift in std.objectKeysValues(self.primary.shifts) + }), + +##### fn schedule.calendar.withId + +```jsonnet +schedule.calendar.withId(id) +``` + +PARAMETERS: + +* **id** (`string`) + +`withId` sets the resource name for a Schedule +##### fn schedule.calendar.withShifts + +```jsonnet +schedule.calendar.withShifts(shifts) +``` + +PARAMETERS: + +* **shifts** (`object`) + +`withShifts` sets a map of Shifts on a calendar-type Schedule. + +##### obj schedule.calendar.shift + + +###### fn schedule.calendar.shift.new + +```jsonnet +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. + +###### fn schedule.calendar.shift.withByDay + +```jsonnet +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 +###### fn schedule.calendar.shift.withId + +```jsonnet +schedule.calendar.shift.withId(id) +``` + +PARAMETERS: + +* **id** (`string`) + +`withId` sets the resource name for a Shift +###### fn schedule.calendar.shift.withRollingUsers + +```jsonnet +schedule.calendar.shift.withRollingUsers(frequency, users) +``` + +PARAMETERS: + +* **frequency** (`string`) + - valid values: `"hourly"`, `"daily"`, `"weekly"`, `"monthly"` +* **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. + +[HTTP API docs]: https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts/ + +###### fn schedule.calendar.shift.withStartRotationFromUserIndex + +```jsonnet +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. \ No newline at end of file diff --git a/docs/oncall/index.md b/docs/oncall/index.md deleted file mode 100644 index da5fd5b..0000000 --- a/docs/oncall/index.md +++ /dev/null @@ -1,925 +0,0 @@ -# oncall - - - -## Subpackages - -* [integration.defaultRoute](integration/defaultRoute/index.md) -* [integration.templates](integration/templates/index.md) -* [schedule.shiftsRef](schedule/shiftsRef.md) -* [schedule.slack](schedule/slack.md) - -## Index - -* [`obj escalationChain`](#obj-escalationchain) - * [`fn new(name, id="rfc1123(name)")`](#fn-escalationchainnew) - * [`fn withName(value)`](#fn-escalationchainwithname) - * [`fn withSteps()`](#fn-escalationchainwithsteps) - * [`fn withTeamId(value)`](#fn-escalationchainwithteamid) - * [`obj step`](#obj-escalationchainstep) - * [`fn notifyOnCallFromSchedule(schedule)`](#fn-escalationchainstepnotifyoncallfromschedule) - * [`fn notifyPersons(persons)`](#fn-escalationchainstepnotifypersons) - * [`fn wait(seconds)`](#fn-escalationchainstepwait) -* [`obj integration`](#obj-integration) - * [`fn new(name, type, id="rfc1123(name)")`](#fn-integrationnew) - * [`fn withDefaultChain(escalationChain)`](#fn-integrationwithdefaultchain) - * [`fn withDefaultRoute(value)`](#fn-integrationwithdefaultroute) - * [`fn withDefaultRouteMixin(value)`](#fn-integrationwithdefaultroutemixin) - * [`fn withName(value)`](#fn-integrationwithname) - * [`fn withRoutes(routes)`](#fn-integrationwithroutes) - * [`fn withTeamId(value)`](#fn-integrationwithteamid) - * [`fn withTemplates(value)`](#fn-integrationwithtemplates) - * [`fn withTemplatesMixin(value)`](#fn-integrationwithtemplatesmixin) - * [`fn withType(value)`](#fn-integrationwithtype) - * [`obj route`](#obj-integrationroute) - * [`fn chain(name)`](#fn-integrationroutechain) - * [`fn withRoutingRegex(regex)`](#fn-integrationroutewithroutingregex) -* [`obj schedule`](#obj-schedule) - * [`fn new(name, type, providerName, resourceId="rfc1123(name)")`](#fn-schedulenew) - * [`fn withEnableWebOverrides(value=true)`](#fn-schedulewithenableweboverrides) - * [`fn withIcalUrlOverrides(value)`](#fn-schedulewithicalurloverrides) - * [`fn withIcalUrlPrimary(value)`](#fn-schedulewithicalurlprimary) - * [`fn withName(value)`](#fn-schedulewithname) - * [`fn withShifts(shifts="null")`](#fn-schedulewithshifts) - * [`fn withShiftsMixin(value)`](#fn-schedulewithshiftsmixin) - * [`fn withShiftsRef(value)`](#fn-schedulewithshiftsref) - * [`fn withShiftsRefMixin(value)`](#fn-schedulewithshiftsrefmixin) - * [`fn withShiftsSelector(value)`](#fn-schedulewithshiftsselector) - * [`fn withShiftsSelectorMixin(value)`](#fn-schedulewithshiftsselectormixin) - * [`fn withSlack(value)`](#fn-schedulewithslack) - * [`fn withSlackMixin(value)`](#fn-schedulewithslackmixin) - * [`fn withTeamId(value)`](#fn-schedulewithteamid) - * [`fn withTimeZone(value)`](#fn-schedulewithtimezone) - * [`fn withType(value)`](#fn-schedulewithtype) - * [`obj shiftsSelector`](#obj-scheduleshiftsselector) - * [`fn withMatchControllerRef(value=true)`](#fn-scheduleshiftsselectorwithmatchcontrollerref) - * [`fn withMatchLabels(value)`](#fn-scheduleshiftsselectorwithmatchlabels) - * [`fn withMatchLabelsMixin(value)`](#fn-scheduleshiftsselectorwithmatchlabelsmixin) - * [`fn withPolicy(value)`](#fn-scheduleshiftsselectorwithpolicy) - * [`fn withPolicyMixin(value)`](#fn-scheduleshiftsselectorwithpolicymixin) - * [`obj policy`](#obj-scheduleshiftsselectorpolicy) - * [`fn withResolution(value="Required")`](#fn-scheduleshiftsselectorpolicywithresolution) - * [`fn withResolve(value)`](#fn-scheduleshiftsselectorpolicywithresolve) -* [`obj shift`](#obj-shift) - * [`fn new(name, resourceId="rfc1123(name)")`](#fn-shiftnew) - * [`fn withByDay(value)`](#fn-shiftwithbyday) - * [`fn withByDayMixin(value)`](#fn-shiftwithbydaymixin) - * [`fn withByMonth(value)`](#fn-shiftwithbymonth) - * [`fn withByMonthMixin(value)`](#fn-shiftwithbymonthmixin) - * [`fn withByMonthday(value)`](#fn-shiftwithbymonthday) - * [`fn withByMonthdayMixin(value)`](#fn-shiftwithbymonthdaymixin) - * [`fn withDuration(value)`](#fn-shiftwithduration) - * [`fn withFrequency(value)`](#fn-shiftwithfrequency) - * [`fn withInterval(value)`](#fn-shiftwithinterval) - * [`fn withLevel(value)`](#fn-shiftwithlevel) - * [`fn withName(value)`](#fn-shiftwithname) - * [`fn withRollingUsers(frequency, users)`](#fn-shiftwithrollingusers) - * [`fn withRollingUsersMixin(value)`](#fn-shiftwithrollingusersmixin) - * [`fn withStart(value)`](#fn-shiftwithstart) - * [`fn withStartRotationFromUserIndex(value)`](#fn-shiftwithstartrotationfromuserindex) - * [`fn withTeamId(value)`](#fn-shiftwithteamid) - * [`fn withTimeZone(value)`](#fn-shiftwithtimezone) - * [`fn withType(value)`](#fn-shiftwithtype) - * [`fn withUntil(value)`](#fn-shiftwithuntil) - * [`fn withUsers(value)`](#fn-shiftwithusers) - * [`fn withUsersMixin(value)`](#fn-shiftwithusersmixin) - * [`fn withWeekStart(value)`](#fn-shiftwithweekstart) - -## Fields - -### obj escalationChain - - -#### fn escalationChain.new - -```jsonnet -escalationChain.new(name, id="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **id** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates an Escalation Chain. The `name` is a display-friendly -string, and `id` defaults to a slug-ified version of it. - -#### fn escalationChain.withName - -```jsonnet -escalationChain.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The name of the escalation chain. -The name of the escalation chain. -#### fn escalationChain.withSteps - -```jsonnet -escalationChain.withSteps() -``` - - -`withSteps` configures one or more Escalation resources as steps within -the calling Escalation Chain. - -#### fn escalationChain.withTeamId - -```jsonnet -escalationChain.withTeamId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. -The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. -#### obj escalationChain.step - - -##### fn escalationChain.step.notifyOnCallFromSchedule - -```jsonnet -escalationChain.step.notifyOnCallFromSchedule(schedule) -``` - -PARAMETERS: - -* **schedule** (`string|object`) - -`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. - -##### fn escalationChain.step.notifyPersons - -```jsonnet -escalationChain.step.notifyPersons(persons) -``` - -PARAMETERS: - -* **persons** (`array`) - -`notifyPersons` configures an Escalation step to notify a list of -persons. - -##### fn escalationChain.step.wait - -```jsonnet -escalationChain.step.wait(seconds) -``` - -PARAMETERS: - -* **seconds** (`number`) - -`wait` configures an Escalation step to wait for acknowledgement for -the given number of seconds before proceeding. - -### obj integration - - -#### fn integration.new - -```jsonnet -integration.new(name, type, id="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **type** (`string`) -* **id** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates an Integration. The `name` is a display-friendly string, -and `id` defaults to a slug-ified version of it. `type` is the type of -Integration. - -#### fn integration.withDefaultChain - -```jsonnet -integration.withDefaultChain(escalationChain) -``` - -PARAMETERS: - -* **escalationChain** (`string`) - -`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. - -#### fn integration.withDefaultRoute - -```jsonnet -integration.withDefaultRoute(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Min: 1, Max: 1) The Default route for all alerts from the given integration (see below for nested schema) -The Default route for all alerts from the given integration -#### fn integration.withDefaultRouteMixin - -```jsonnet -integration.withDefaultRouteMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Min: 1, Max: 1) The Default route for all alerts from the given integration (see below for nested schema) -The Default route for all alerts from the given integration -#### fn integration.withName - -```jsonnet -integration.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The name of the service integration. -The name of the service integration. -#### fn integration.withRoutes - -```jsonnet -integration.withRoutes(routes) -``` - -PARAMETERS: - -* **routes** (`object`) - -`withRoute` configures Route resources connecting this Integration with -Escalation Chains. - -#### fn integration.withTeamId - -```jsonnet -integration.withTeamId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. -The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. -#### fn integration.withTemplates - -```jsonnet -integration.withTemplates(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Jinja2 templates for Alert payload. An empty templates block will be ignored. (see below for nested schema) -Jinja2 templates for Alert payload. An empty templates block will be ignored. -#### fn integration.withTemplatesMixin - -```jsonnet -integration.withTemplatesMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Jinja2 templates for Alert payload. An empty templates block will be ignored. (see below for nested schema) -Jinja2 templates for Alert payload. An empty templates block will be ignored. -#### fn integration.withType - -```jsonnet -integration.withType(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The type of integration. Can be grafana, grafana_alerting, webhook, alertmanager, kapacitor, fabric, newrelic, datadog, pagerduty, pingdom, elastalert, amazon_sns, curler, sentry, formatted_webhook, heartbeat, demo, manual, stackdriver, uptimerobot, sentry_platform, zabbix, prtg, slack_channel, inbound_email, direct_paging, jira. -The type of integration. Can be grafana, grafana_alerting, webhook, alertmanager, kapacitor, fabric, newrelic, datadog, pagerduty, pingdom, elastalert, amazon_sns, curler, sentry, formatted_webhook, heartbeat, demo, manual, stackdriver, uptimerobot, sentry_platform, zabbix, prtg, slack_channel, inbound_email, direct_paging, jira. -#### obj integration.route - - -##### fn integration.route.chain - -```jsonnet -integration.route.chain(name) -``` - -PARAMETERS: - -* **name** (`string`) - -`chain` configures a Route to reference an Escalation Chain. - -##### fn integration.route.withRoutingRegex - -```jsonnet -integration.route.withRoutingRegex(regex) -``` - -PARAMETERS: - -* **regex** (`string`) - -`withRoutingRegex` configures a Route to have routing type `regex` and -use the supplied regex. - -### obj schedule - - -#### fn schedule.new - -```jsonnet -schedule.new(name, type, providerName, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **type** (`string`) - - valid values: `"ical"`, `"calendar"` -* **providerName** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates a Schedule. The `name` is a display-friendly -string, and `id` defaults to a slug-ified version of it. - -#### fn schedule.withEnableWebOverrides - -```jsonnet -schedule.withEnableWebOverrides(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -(Boolean) Enable overrides via web UI (it will ignore ical_url_overrides). -Enable overrides via web UI (it will ignore ical_url_overrides). -#### fn schedule.withIcalUrlOverrides - -```jsonnet -schedule.withIcalUrlOverrides(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The URL of external iCal calendar which override primary events. -The URL of external iCal calendar which override primary events. -#### fn schedule.withIcalUrlPrimary - -```jsonnet -schedule.withIcalUrlPrimary(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The URL of the external calendar iCal file. -The URL of the external calendar iCal file. -#### fn schedule.withName - -```jsonnet -schedule.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The schedule's name. -The schedule's name. -#### fn schedule.withShifts - -```jsonnet -schedule.withShifts(shifts="null") -``` - -PARAMETERS: - -* **shifts** (`array`) - - default value: `"null"` - -`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. - -#### fn schedule.withShiftsMixin - -```jsonnet -schedule.withShiftsMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call shifts. -The list of ID's of on-call shifts. -#### fn schedule.withShiftsRef - -```jsonnet -schedule.withShiftsRef(value) -``` - -PARAMETERS: - -* **value** (`array`) - -References to OnCallShift in oncall to populate shifts. -#### fn schedule.withShiftsRefMixin - -```jsonnet -schedule.withShiftsRefMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -References to OnCallShift in oncall to populate shifts. -#### fn schedule.withShiftsSelector - -```jsonnet -schedule.withShiftsSelector(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Selector for a list of OnCallShift in oncall to populate shifts. -#### fn schedule.withShiftsSelectorMixin - -```jsonnet -schedule.withShiftsSelectorMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Selector for a list of OnCallShift in oncall to populate shifts. -#### fn schedule.withSlack - -```jsonnet -schedule.withSlack(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a schedule. (see below for nested schema) -The Slack-specific settings for a schedule. -#### fn schedule.withSlackMixin - -```jsonnet -schedule.withSlackMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a schedule. (see below for nested schema) -The Slack-specific settings for a schedule. -#### fn schedule.withTeamId - -```jsonnet -schedule.withTeamId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. -The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. -#### fn schedule.withTimeZone - -```jsonnet -schedule.withTimeZone(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The schedule's time zone. -The schedule's time zone. -#### fn schedule.withType - -```jsonnet -schedule.withType(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The schedule's type. Valid values are ical, calendar. -The schedule's type. Valid values are `ical`, `calendar`. -#### obj schedule.shiftsSelector - - -##### fn schedule.shiftsSelector.withMatchControllerRef - -```jsonnet -schedule.shiftsSelector.withMatchControllerRef(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -MatchControllerRef ensures an object with the same controller reference -as the selecting object is selected. -##### fn schedule.shiftsSelector.withMatchLabels - -```jsonnet -schedule.shiftsSelector.withMatchLabels(value) -``` - -PARAMETERS: - -* **value** (`object`) - -MatchLabels ensures an object with matching labels is selected. -##### fn schedule.shiftsSelector.withMatchLabelsMixin - -```jsonnet -schedule.shiftsSelector.withMatchLabelsMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -MatchLabels ensures an object with matching labels is selected. -##### fn schedule.shiftsSelector.withPolicy - -```jsonnet -schedule.shiftsSelector.withPolicy(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for selection. -##### fn schedule.shiftsSelector.withPolicyMixin - -```jsonnet -schedule.shiftsSelector.withPolicyMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for selection. -##### obj schedule.shiftsSelector.policy - - -###### fn schedule.shiftsSelector.policy.withResolution - -```jsonnet -schedule.shiftsSelector.policy.withResolution(value="Required") -``` - -PARAMETERS: - -* **value** (`string`) - - default value: `"Required"` - - valid values: `"Required"`, `"Optional"` - -Resolution specifies whether resolution of this reference is required. -The default is 'Required', which means the reconcile will fail if the -reference cannot be resolved. 'Optional' means this reference will be -a no-op if it cannot be resolved. -###### fn schedule.shiftsSelector.policy.withResolve - -```jsonnet -schedule.shiftsSelector.policy.withResolve(value) -``` - -PARAMETERS: - -* **value** (`string`) - - valid values: `"Always"`, `"IfNotPresent"` - -Resolve specifies when this reference should be resolved. The default -is 'IfNotPresent', which will attempt to resolve the reference only when -the corresponding field is not present. Use 'Always' to resolve the -reference on every reconcile. -### obj shift - - -#### fn shift.new - -```jsonnet -shift.new(name, resourceId="rfc1123(name)") -``` - -PARAMETERS: - -* **name** (`string`) -* **resourceId** (`string`) - - default value: `"rfc1123(name)"` - -`new` creates an OnCallShift. The `name` is a display-friendly string, -and `id` defaults to a slug-ified version of it. - -#### fn shift.withByDay - -```jsonnet -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 -#### fn shift.withByDayMixin - -```jsonnet -shift.withByDayMixin(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 -#### fn shift.withByMonth - -```jsonnet -shift.withByMonth(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 -This parameter takes a list of months. Valid values are 1 to 12 -#### fn shift.withByMonthMixin - -```jsonnet -shift.withByMonthMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Set of Number) This parameter takes a list of months. Valid values are 1 to 12 -This parameter takes a list of months. Valid values are 1 to 12 -#### fn shift.withByMonthday - -```jsonnet -shift.withByMonthday(value) -``` - -PARAMETERS: - -* **value** (`array`) - -31 to -1 -This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 -#### fn shift.withByMonthdayMixin - -```jsonnet -shift.withByMonthdayMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -31 to -1 -This parameter takes a list of days of the month. Valid values are 1 to 31 or -31 to -1 -#### fn shift.withDuration - -```jsonnet -shift.withDuration(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The duration of the event. -The duration of the event. -#### fn shift.withFrequency - -```jsonnet -shift.withFrequency(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The frequency of the event. Can be hourly, daily, weekly, monthly -The frequency of the event. Can be hourly, daily, weekly, monthly -#### fn shift.withInterval - -```jsonnet -shift.withInterval(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The positive integer representing at which intervals the recurrence rule repeats. -The positive integer representing at which intervals the recurrence rule repeats. -#### fn shift.withLevel - -```jsonnet -shift.withLevel(value) -``` - -PARAMETERS: - -* **value** (`number`) - -(Number) The priority level. The higher the value, the higher the priority. -The priority level. The higher the value, the higher the priority. -#### fn shift.withName - -```jsonnet -shift.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's name. -The shift's name. -#### fn shift.withRollingUsers - -```jsonnet -shift.withRollingUsers(frequency, users) -``` - -PARAMETERS: - -* **frequency** (`string`) - - valid values: `"hourly"`, `"daily"`, `"weekly"`, `"monthly"` -* **users** (`array`) - -`withRollingUsers` sets an OnCallShift to type `rolling_users` and -configures required fields. `users` must be an array *of arrays* -of strings referring to users by email address. `frequency` is required -for this shift type. - -#### fn shift.withRollingUsersMixin - -```jsonnet -shift.withRollingUsersMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for rolling_users event type) -The list of lists with on-call users (for rolling_users event type) -#### fn shift.withStart - -```jsonnet -shift.withStart(value) -``` - -PARAMETERS: - -* **value** (`string`) - -call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -The start time of the on-call shift. This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -#### fn shift.withStartRotationFromUserIndex - -```jsonnet -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. -#### fn shift.withTeamId - -```jsonnet -shift.withTeamId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the grafana_oncall_team datasource. -The ID of the OnCall team. To get one, create a team in Grafana, and navigate to the OnCall plugin (to sync the team with OnCall). You can then get the ID using the `grafana_oncall_team` datasource. -#### fn shift.withTimeZone - -```jsonnet -shift.withTimeZone(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's timezone. Overrides schedule's timezone. -The shift's timezone. Overrides schedule's timezone. -#### fn shift.withType - -```jsonnet -shift.withType(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The shift's type. Can be rolling_users, recurrent_event, single_event -The shift's type. Can be rolling_users, recurrent_event, single_event -#### fn shift.withUntil - -```jsonnet -shift.withUntil(value) -``` - -PARAMETERS: - -* **value** (`string`) - -call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -The end time of recurrent on-call shifts (endless if null). This parameter takes a date format as yyyy-MM-dd'T'HH:mm:ss (for example "2020-09-05T08:00:00") -#### fn shift.withUsers - -```jsonnet -shift.withUsers(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for single_event and recurrent_event event type). -The list of on-call users (for single_event and recurrent_event event type). -#### fn shift.withUsersMixin - -```jsonnet -shift.withUsersMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -call users (for single_event and recurrent_event event type). -The list of on-call users (for single_event and recurrent_event event type). -#### fn shift.withWeekStart - -```jsonnet -shift.withWeekStart(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU -Start day of the week in iCal format. Can be MO, TU, WE, TH, FR, SA, SU \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/index.md b/docs/oncall/integration/defaultRoute/index.md deleted file mode 100644 index c7411f9..0000000 --- a/docs/oncall/integration/defaultRoute/index.md +++ /dev/null @@ -1,334 +0,0 @@ -# defaultRoute - - - -## Subpackages - -* [msteams](msteams.md) -* [slack](slack.md) -* [telegram](telegram.md) - -## Index - -* [`fn withEscalationChainId(value)`](#fn-withescalationchainid) -* [`fn withEscalationChainRef(value)`](#fn-withescalationchainref) -* [`fn withEscalationChainRefMixin(value)`](#fn-withescalationchainrefmixin) -* [`fn withEscalationChainSelector(value)`](#fn-withescalationchainselector) -* [`fn withEscalationChainSelectorMixin(value)`](#fn-withescalationchainselectormixin) -* [`fn withMsteams(value)`](#fn-withmsteams) -* [`fn withMsteamsMixin(value)`](#fn-withmsteamsmixin) -* [`fn withSlack(value)`](#fn-withslack) -* [`fn withSlackMixin(value)`](#fn-withslackmixin) -* [`fn withTelegram(value)`](#fn-withtelegram) -* [`fn withTelegramMixin(value)`](#fn-withtelegrammixin) -* [`obj escalationChainRef`](#obj-escalationchainref) - * [`fn withName(value)`](#fn-escalationchainrefwithname) - * [`fn withPolicy(value)`](#fn-escalationchainrefwithpolicy) - * [`fn withPolicyMixin(value)`](#fn-escalationchainrefwithpolicymixin) - * [`obj policy`](#obj-escalationchainrefpolicy) - * [`fn withResolution(value="Required")`](#fn-escalationchainrefpolicywithresolution) - * [`fn withResolve(value)`](#fn-escalationchainrefpolicywithresolve) -* [`obj escalationChainSelector`](#obj-escalationchainselector) - * [`fn withMatchControllerRef(value=true)`](#fn-escalationchainselectorwithmatchcontrollerref) - * [`fn withMatchLabels(value)`](#fn-escalationchainselectorwithmatchlabels) - * [`fn withMatchLabelsMixin(value)`](#fn-escalationchainselectorwithmatchlabelsmixin) - * [`fn withPolicy(value)`](#fn-escalationchainselectorwithpolicy) - * [`fn withPolicyMixin(value)`](#fn-escalationchainselectorwithpolicymixin) - * [`obj policy`](#obj-escalationchainselectorpolicy) - * [`fn withResolution(value="Required")`](#fn-escalationchainselectorpolicywithresolution) - * [`fn withResolve(value)`](#fn-escalationchainselectorpolicywithresolve) - -## Fields - -### fn withEscalationChainId - -```jsonnet -withEscalationChainId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of the escalation chain. -The ID of the escalation chain. -### fn withEscalationChainRef - -```jsonnet -withEscalationChainRef(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Reference to a EscalationChain in oncall to populate escalationChainId. -### fn withEscalationChainRefMixin - -```jsonnet -withEscalationChainRefMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Reference to a EscalationChain in oncall to populate escalationChainId. -### fn withEscalationChainSelector - -```jsonnet -withEscalationChainSelector(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Selector for a EscalationChain in oncall to populate escalationChainId. -### fn withEscalationChainSelectorMixin - -```jsonnet -withEscalationChainSelectorMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Selector for a EscalationChain in oncall to populate escalationChainId. -### fn withMsteams - -```jsonnet -withMsteams(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -MS teams-specific settings for a route. -### fn withMsteamsMixin - -```jsonnet -withMsteamsMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -MS teams-specific settings for a route. -### fn withSlack - -```jsonnet -withSlack(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Slack-specific settings for a route. -### fn withSlackMixin - -```jsonnet -withSlackMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Slack-specific settings for a route. -### fn withTelegram - -```jsonnet -withTelegram(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Telegram-specific settings for a route. -### fn withTelegramMixin - -```jsonnet -withTelegramMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Telegram-specific settings for a route. -### obj escalationChainRef - - -#### fn escalationChainRef.withName - -```jsonnet -escalationChainRef.withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -Name of the referenced object. -#### fn escalationChainRef.withPolicy - -```jsonnet -escalationChainRef.withPolicy(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for referencing. -#### fn escalationChainRef.withPolicyMixin - -```jsonnet -escalationChainRef.withPolicyMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for referencing. -#### obj escalationChainRef.policy - - -##### fn escalationChainRef.policy.withResolution - -```jsonnet -escalationChainRef.policy.withResolution(value="Required") -``` - -PARAMETERS: - -* **value** (`string`) - - default value: `"Required"` - - valid values: `"Required"`, `"Optional"` - -Resolution specifies whether resolution of this reference is required. -The default is 'Required', which means the reconcile will fail if the -reference cannot be resolved. 'Optional' means this reference will be -a no-op if it cannot be resolved. -##### fn escalationChainRef.policy.withResolve - -```jsonnet -escalationChainRef.policy.withResolve(value) -``` - -PARAMETERS: - -* **value** (`string`) - - valid values: `"Always"`, `"IfNotPresent"` - -Resolve specifies when this reference should be resolved. The default -is 'IfNotPresent', which will attempt to resolve the reference only when -the corresponding field is not present. Use 'Always' to resolve the -reference on every reconcile. -### obj escalationChainSelector - - -#### fn escalationChainSelector.withMatchControllerRef - -```jsonnet -escalationChainSelector.withMatchControllerRef(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -MatchControllerRef ensures an object with the same controller reference -as the selecting object is selected. -#### fn escalationChainSelector.withMatchLabels - -```jsonnet -escalationChainSelector.withMatchLabels(value) -``` - -PARAMETERS: - -* **value** (`object`) - -MatchLabels ensures an object with matching labels is selected. -#### fn escalationChainSelector.withMatchLabelsMixin - -```jsonnet -escalationChainSelector.withMatchLabelsMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -MatchLabels ensures an object with matching labels is selected. -#### fn escalationChainSelector.withPolicy - -```jsonnet -escalationChainSelector.withPolicy(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for selection. -#### fn escalationChainSelector.withPolicyMixin - -```jsonnet -escalationChainSelector.withPolicyMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for selection. -#### obj escalationChainSelector.policy - - -##### fn escalationChainSelector.policy.withResolution - -```jsonnet -escalationChainSelector.policy.withResolution(value="Required") -``` - -PARAMETERS: - -* **value** (`string`) - - default value: `"Required"` - - valid values: `"Required"`, `"Optional"` - -Resolution specifies whether resolution of this reference is required. -The default is 'Required', which means the reconcile will fail if the -reference cannot be resolved. 'Optional' means this reference will be -a no-op if it cannot be resolved. -##### fn escalationChainSelector.policy.withResolve - -```jsonnet -escalationChainSelector.policy.withResolve(value) -``` - -PARAMETERS: - -* **value** (`string`) - - valid values: `"Always"`, `"IfNotPresent"` - -Resolve specifies when this reference should be resolved. The default -is 'IfNotPresent', which will attempt to resolve the reference only when -the corresponding field is not present. Use 'Always' to resolve the -reference on every reconcile. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/msteams.md b/docs/oncall/integration/defaultRoute/msteams.md deleted file mode 100644 index 3ecf5af..0000000 --- a/docs/oncall/integration/defaultRoute/msteams.md +++ /dev/null @@ -1,36 +0,0 @@ -# msteams - - - -## Index - -* [`fn withEnabled(value=true)`](#fn-withenabled) -* [`fn withId(value)`](#fn-withid) - -## Fields - -### fn withEnabled - -```jsonnet -withEnabled(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -(Boolean) Enable notification in MS teams. Defaults to true. -Enable notification in MS teams. Defaults to `true`. -### fn withId - -```jsonnet -withId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of this resource. -MS teams channel id. Alerts will be directed to this channel in Microsoft teams. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/slack.md b/docs/oncall/integration/defaultRoute/slack.md deleted file mode 100644 index e0307df..0000000 --- a/docs/oncall/integration/defaultRoute/slack.md +++ /dev/null @@ -1,36 +0,0 @@ -# slack - - - -## Index - -* [`fn withChannelId(value)`](#fn-withchannelid) -* [`fn withEnabled(value=true)`](#fn-withenabled) - -## Fields - -### fn withChannelId - -```jsonnet -withChannelId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Slack channel id. Alerts will be directed to this channel in Slack. -Slack channel id. Alerts will be directed to this channel in Slack. -### fn withEnabled - -```jsonnet -withEnabled(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -(Boolean) Enable notification in MS teams. Defaults to true. -Enable notification in Slack. Defaults to `true`. \ No newline at end of file diff --git a/docs/oncall/integration/defaultRoute/telegram.md b/docs/oncall/integration/defaultRoute/telegram.md deleted file mode 100644 index 66b0cbc..0000000 --- a/docs/oncall/integration/defaultRoute/telegram.md +++ /dev/null @@ -1,36 +0,0 @@ -# telegram - - - -## Index - -* [`fn withEnabled(value=true)`](#fn-withenabled) -* [`fn withId(value)`](#fn-withid) - -## Fields - -### fn withEnabled - -```jsonnet -withEnabled(value=true) -``` - -PARAMETERS: - -* **value** (`boolean`) - - default value: `true` - -(Boolean) Enable notification in MS teams. Defaults to true. -Enable notification in Telegram. Defaults to `true`. -### fn withId - -```jsonnet -withId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) The ID of this resource. -Telegram channel id. Alerts will be directed to this channel in Telegram. \ No newline at end of file diff --git a/docs/oncall/integration/templates/email.md b/docs/oncall/integration/templates/email.md deleted file mode 100644 index 794c3e5..0000000 --- a/docs/oncall/integration/templates/email.md +++ /dev/null @@ -1,35 +0,0 @@ -# email - - - -## Index - -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/index.md b/docs/oncall/integration/templates/index.md deleted file mode 100644 index b40828b..0000000 --- a/docs/oncall/integration/templates/index.md +++ /dev/null @@ -1,280 +0,0 @@ -# templates - - - -## Subpackages - -* [email](email.md) -* [microsoftTeams](microsoftTeams.md) -* [mobileApp](mobileApp.md) -* [phoneCall](phoneCall.md) -* [slack](slack.md) -* [sms](sms.md) -* [telegram](telegram.md) -* [web](web.md) - -## Index - -* [`fn withAcknowledgeSignal(value)`](#fn-withacknowledgesignal) -* [`fn withEmail(value)`](#fn-withemail) -* [`fn withEmailMixin(value)`](#fn-withemailmixin) -* [`fn withGroupingKey(value)`](#fn-withgroupingkey) -* [`fn withMicrosoftTeams(value)`](#fn-withmicrosoftteams) -* [`fn withMicrosoftTeamsMixin(value)`](#fn-withmicrosoftteamsmixin) -* [`fn withMobileApp(value)`](#fn-withmobileapp) -* [`fn withMobileAppMixin(value)`](#fn-withmobileappmixin) -* [`fn withPhoneCall(value)`](#fn-withphonecall) -* [`fn withPhoneCallMixin(value)`](#fn-withphonecallmixin) -* [`fn withResolveSignal(value)`](#fn-withresolvesignal) -* [`fn withSlack(value)`](#fn-withslack) -* [`fn withSlackMixin(value)`](#fn-withslackmixin) -* [`fn withSms(value)`](#fn-withsms) -* [`fn withSmsMixin(value)`](#fn-withsmsmixin) -* [`fn withSourceLink(value)`](#fn-withsourcelink) -* [`fn withTelegram(value)`](#fn-withtelegram) -* [`fn withTelegramMixin(value)`](#fn-withtelegrammixin) -* [`fn withWeb(value)`](#fn-withweb) -* [`fn withWebMixin(value)`](#fn-withwebmixin) - -## Fields - -### fn withAcknowledgeSignal - -```jsonnet -withAcknowledgeSignal(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for sending a signal to acknowledge the Incident. -Template for sending a signal to acknowledge the Incident. -### fn withEmail - -```jsonnet -withEmail(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Email. (see below for nested schema) -Templates for Email. -### fn withEmailMixin - -```jsonnet -withEmailMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Email. (see below for nested schema) -Templates for Email. -### fn withGroupingKey - -```jsonnet -withGroupingKey(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for the key by which alerts are grouped. -Template for the key by which alerts are grouped. -### fn withMicrosoftTeams - -```jsonnet -withMicrosoftTeams(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Microsoft Teams. NOTE: Microsoft Teams templates are only available on Grafana Cloud. (see below for nested schema) -Templates for Microsoft Teams. **NOTE**: Microsoft Teams templates are only available on Grafana Cloud. -### fn withMicrosoftTeamsMixin - -```jsonnet -withMicrosoftTeamsMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Microsoft Teams. NOTE: Microsoft Teams templates are only available on Grafana Cloud. (see below for nested schema) -Templates for Microsoft Teams. **NOTE**: Microsoft Teams templates are only available on Grafana Cloud. -### fn withMobileApp - -```jsonnet -withMobileApp(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Mobile app push notifications. (see below for nested schema) -Templates for Mobile app push notifications. -### fn withMobileAppMixin - -```jsonnet -withMobileAppMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Mobile app push notifications. (see below for nested schema) -Templates for Mobile app push notifications. -### fn withPhoneCall - -```jsonnet -withPhoneCall(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Phone Call. (see below for nested schema) -Templates for Phone Call. -### fn withPhoneCallMixin - -```jsonnet -withPhoneCallMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Phone Call. (see below for nested schema) -Templates for Phone Call. -### fn withResolveSignal - -```jsonnet -withResolveSignal(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for sending a signal to resolve the Incident. -Template for sending a signal to resolve the Incident. -### fn withSlack - -```jsonnet -withSlack(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Templates for Slack. -### fn withSlackMixin - -```jsonnet -withSlackMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Templates for Slack. -### fn withSms - -```jsonnet -withSms(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for SMS. (see below for nested schema) -Templates for SMS. -### fn withSmsMixin - -```jsonnet -withSmsMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for SMS. (see below for nested schema) -Templates for SMS. -### fn withSourceLink - -```jsonnet -withSourceLink(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for a source link. -Template for a source link. -### fn withTelegram - -```jsonnet -withTelegram(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Templates for Telegram. -### fn withTelegramMixin - -```jsonnet -withTelegramMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -specific settings for a route. (see below for nested schema) -Templates for Telegram. -### fn withWeb - -```jsonnet -withWeb(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Web. (see below for nested schema) -Templates for Web. -### fn withWebMixin - -```jsonnet -withWebMixin(value) -``` - -PARAMETERS: - -* **value** (`array`) - -(Block List, Max: 1) Templates for Web. (see below for nested schema) -Templates for Web. \ No newline at end of file diff --git a/docs/oncall/integration/templates/microsoftTeams.md b/docs/oncall/integration/templates/microsoftTeams.md deleted file mode 100644 index 12fda25..0000000 --- a/docs/oncall/integration/templates/microsoftTeams.md +++ /dev/null @@ -1,48 +0,0 @@ -# microsoftTeams - - - -## Index - -* [`fn withImageUrl(value)`](#fn-withimageurl) -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withImageUrl - -```jsonnet -withImageUrl(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert image url. -Template for Alert image url. -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/mobileApp.md b/docs/oncall/integration/templates/mobileApp.md deleted file mode 100644 index 58619d3..0000000 --- a/docs/oncall/integration/templates/mobileApp.md +++ /dev/null @@ -1,35 +0,0 @@ -# mobileApp - - - -## Index - -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/phoneCall.md b/docs/oncall/integration/templates/phoneCall.md deleted file mode 100644 index 381d2d8..0000000 --- a/docs/oncall/integration/templates/phoneCall.md +++ /dev/null @@ -1,22 +0,0 @@ -# phoneCall - - - -## Index - -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/slack.md b/docs/oncall/integration/templates/slack.md deleted file mode 100644 index 15d3ba5..0000000 --- a/docs/oncall/integration/templates/slack.md +++ /dev/null @@ -1,48 +0,0 @@ -# slack - - - -## Index - -* [`fn withImageUrl(value)`](#fn-withimageurl) -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withImageUrl - -```jsonnet -withImageUrl(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert image url. -Template for Alert image url. -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/sms.md b/docs/oncall/integration/templates/sms.md deleted file mode 100644 index 7011ae3..0000000 --- a/docs/oncall/integration/templates/sms.md +++ /dev/null @@ -1,22 +0,0 @@ -# sms - - - -## Index - -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/telegram.md b/docs/oncall/integration/templates/telegram.md deleted file mode 100644 index 931fb64..0000000 --- a/docs/oncall/integration/templates/telegram.md +++ /dev/null @@ -1,48 +0,0 @@ -# telegram - - - -## Index - -* [`fn withImageUrl(value)`](#fn-withimageurl) -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withImageUrl - -```jsonnet -withImageUrl(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert image url. -Template for Alert image url. -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/integration/templates/web.md b/docs/oncall/integration/templates/web.md deleted file mode 100644 index c7102ef..0000000 --- a/docs/oncall/integration/templates/web.md +++ /dev/null @@ -1,48 +0,0 @@ -# web - - - -## Index - -* [`fn withImageUrl(value)`](#fn-withimageurl) -* [`fn withMessage(value)`](#fn-withmessage) -* [`fn withTitle(value)`](#fn-withtitle) - -## Fields - -### fn withImageUrl - -```jsonnet -withImageUrl(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert image url. -Template for Alert image url. -### fn withMessage - -```jsonnet -withMessage(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert message. -Template for Alert message. -### fn withTitle - -```jsonnet -withTitle(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Template for Alert title. -Template for Alert title. \ No newline at end of file diff --git a/docs/oncall/schedule/shiftsRef.md b/docs/oncall/schedule/shiftsRef.md deleted file mode 100644 index 1ec53f3..0000000 --- a/docs/oncall/schedule/shiftsRef.md +++ /dev/null @@ -1,82 +0,0 @@ -# shiftsRef - - - -## Index - -* [`fn withName(value)`](#fn-withname) -* [`fn withPolicy(value)`](#fn-withpolicy) -* [`fn withPolicyMixin(value)`](#fn-withpolicymixin) -* [`obj policy`](#obj-policy) - * [`fn withResolution(value="Required")`](#fn-policywithresolution) - * [`fn withResolve(value)`](#fn-policywithresolve) - -## Fields - -### fn withName - -```jsonnet -withName(value) -``` - -PARAMETERS: - -* **value** (`string`) - -Name of the referenced object. -### fn withPolicy - -```jsonnet -withPolicy(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for referencing. -### fn withPolicyMixin - -```jsonnet -withPolicyMixin(value) -``` - -PARAMETERS: - -* **value** (`object`) - -Policies for referencing. -### obj policy - - -#### fn policy.withResolution - -```jsonnet -policy.withResolution(value="Required") -``` - -PARAMETERS: - -* **value** (`string`) - - default value: `"Required"` - - valid values: `"Required"`, `"Optional"` - -Resolution specifies whether resolution of this reference is required. -The default is 'Required', which means the reconcile will fail if the -reference cannot be resolved. 'Optional' means this reference will be -a no-op if it cannot be resolved. -#### fn policy.withResolve - -```jsonnet -policy.withResolve(value) -``` - -PARAMETERS: - -* **value** (`string`) - - valid values: `"Always"`, `"IfNotPresent"` - -Resolve specifies when this reference should be resolved. The default -is 'IfNotPresent', which will attempt to resolve the reference only when -the corresponding field is not present. Use 'Always' to resolve the -reference on every reconcile. \ No newline at end of file diff --git a/docs/oncall/schedule/slack.md b/docs/oncall/schedule/slack.md deleted file mode 100644 index 669f0ea..0000000 --- a/docs/oncall/schedule/slack.md +++ /dev/null @@ -1,35 +0,0 @@ -# slack - - - -## Index - -* [`fn withChannelId(value)`](#fn-withchannelid) -* [`fn withUserGroupId(value)`](#fn-withusergroupid) - -## Fields - -### fn withChannelId - -```jsonnet -withChannelId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -(String) Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack. -Slack channel id. Reminder about schedule shifts will be directed to this channel in Slack. -### fn withUserGroupId - -```jsonnet -withUserGroupId(value) -``` - -PARAMETERS: - -* **value** (`string`) - -call users change. -Slack user group id. Members of user group will be updated when on-call users change. \ No newline at end of file From 573a54a79850ad947d34fd3e504a31396a575837 Mon Sep 17 00:00:00 2001 From: Sasha Bauer Date: Mon, 6 Jan 2025 12:29:19 -0500 Subject: [PATCH 37/37] refactor(oncall): take an array in withShifts rather than an bject --- docs/oncall.md | 43 +++++++++++++------------- grafanaplane/oncall/schedule.libsonnet | 43 +++++++++++++------------- 2 files changed, 42 insertions(+), 44 deletions(-) diff --git a/docs/oncall.md b/docs/oncall.md index 07d14ca..61204f7 100644 --- a/docs/oncall.md +++ b/docs/oncall.md @@ -229,27 +229,26 @@ declared like: local calendar = grafanaplane.oncall.schedule.calendar, local onCallUsers = [['bob@example.com'], ['alice@example.com']], - - primary: calendar.new('Primary', { - weekday: // 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), - weekend: // 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), - }), - - secondary: calendar.new('Secondary', { - [shift.key]: - shift.value - // replace the resource ID - + calendar.shift.withId('secondary-' + shift.value.metadata.name) - // start rotating from the second person - + calendar.shift.withStartRotationFromUserIndex(1) + 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 std.objectKeysValues(self.primary.shifts) - }), + ]), ##### fn schedule.calendar.withId @@ -270,9 +269,9 @@ schedule.calendar.withShifts(shifts) PARAMETERS: -* **shifts** (`object`) +* **shifts** (`array`) -`withShifts` sets a map of Shifts on a calendar-type Schedule. +`withShifts` sets an array of Shifts on a calendar-type Schedule. ##### obj schedule.calendar.shift diff --git a/grafanaplane/oncall/schedule.libsonnet b/grafanaplane/oncall/schedule.libsonnet index 9a60981..66f79af 100644 --- a/grafanaplane/oncall/schedule.libsonnet +++ b/grafanaplane/oncall/schedule.libsonnet @@ -19,27 +19,26 @@ local forProvider = schedule.spec.parameters.forProvider; 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), + ]), - primary: calendar.new('Primary', { - weekday: // 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), - weekend: // 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), - }), - - secondary: calendar.new('Secondary', { - [shift.key]: - shift.value - // replace the resource ID - + calendar.shift.withId('secondary-' + shift.value.metadata.name) - // start rotating from the second person - + calendar.shift.withStartRotationFromUserIndex(1) + // 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 std.objectKeysValues(self.primary.shifts) - }), + ]), |||, [ d.argument.new('name', d.T.string), @@ -54,7 +53,7 @@ local forProvider = schedule.spec.parameters.forProvider; + forProvider.withType('calendar') + forProvider.withShiftsRef([ forProvider.shiftsRef.withName(shift.metadata.name) - for shift in std.objectValues(self.shifts) + for shift in self.shifts ]), shifts: shifts, }, @@ -70,9 +69,9 @@ local forProvider = schedule.spec.parameters.forProvider; '#withShifts':: d.func.new( ||| - `withShifts` sets a map of Shifts on a calendar-type Schedule. + `withShifts` sets an array of Shifts on a calendar-type Schedule. |||, - [d.argument.new('shifts', d.T.object)] + [d.argument.new('shifts', d.T.array)] ), withShifts(shifts):: { shifts: shifts,