diff --git a/docs/API/alerting/contactPoint.md b/docs/API/alerting/contactPoint.md index b796b0c1..c36edb87 100644 --- a/docs/API/alerting/contactPoint.md +++ b/docs/API/alerting/contactPoint.md @@ -28,7 +28,8 @@ PARAMETERS: * **value** (`boolean`) - default value: `true` - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withName ```jsonnet @@ -39,8 +40,8 @@ PARAMETERS: * **value** (`string`) -Name is used as grouping key in the UI. Contact points with the -same name will be grouped in the UI. +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withProvenance ```jsonnet @@ -51,7 +52,8 @@ PARAMETERS: * **value** (`string`) - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withSettings ```jsonnet @@ -85,7 +87,8 @@ PARAMETERS: * **value** (`string`) - valid values: `"alertmanager"`, `" dingding"`, `" discord"`, `" email"`, `" googlechat"`, `" kafka"`, `" line"`, `" opsgenie"`, `" pagerduty"`, `" pushover"`, `" sensugo"`, `" slack"`, `" teams"`, `" telegram"`, `" threema"`, `" victorops"`, `" webhook"`, `" wecom"` - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withUid ```jsonnet @@ -96,5 +99,5 @@ PARAMETERS: * **value** (`string`) -UID is the unique identifier of the contact point. The UID can be -set by the user. \ No newline at end of file +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. \ No newline at end of file diff --git a/docs/API/alerting/index.md b/docs/API/alerting/index.md index b77a82d0..3715aa47 100644 --- a/docs/API/alerting/index.md +++ b/docs/API/alerting/index.md @@ -5,7 +5,7 @@ grafonnet.alerting ## Subpackages * [contactPoint](contactPoint.md) -* [messageTemplate](messageTemplate.md) * [muteTiming](muteTiming/index.md) * [notificationPolicy](notificationPolicy/index.md) +* [notificationTemplate](notificationTemplate.md) * [ruleGroup](ruleGroup/index.md) diff --git a/docs/API/alerting/notificationPolicy/index.md b/docs/API/alerting/notificationPolicy/index.md index cb4aa0a9..00072439 100644 --- a/docs/API/alerting/notificationPolicy/index.md +++ b/docs/API/alerting/notificationPolicy/index.md @@ -34,7 +34,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withContinue ```jsonnet @@ -46,7 +47,8 @@ PARAMETERS: * **value** (`boolean`) - default value: `true` - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupBy ```jsonnet @@ -57,7 +59,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupByMixin ```jsonnet @@ -68,7 +71,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupInterval ```jsonnet @@ -79,7 +83,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupWait ```jsonnet @@ -90,7 +95,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withMatchers ```jsonnet @@ -127,7 +133,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withMuteTimeIntervalsMixin ```jsonnet @@ -138,7 +145,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withPolicy ```jsonnet @@ -149,7 +157,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withPolicyMixin ```jsonnet @@ -160,7 +169,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withRepeatInterval ```jsonnet @@ -171,3 +181,5 @@ PARAMETERS: * **value** (`string`) +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. \ No newline at end of file diff --git a/docs/API/alerting/notificationPolicy/matcher.md b/docs/API/alerting/notificationPolicy/matcher.md index f31b1d85..7cad0a72 100644 --- a/docs/API/alerting/notificationPolicy/matcher.md +++ b/docs/API/alerting/notificationPolicy/matcher.md @@ -32,7 +32,7 @@ PARAMETERS: * **value** (`string`) - valid values: `"="`, `"!="`, `"=~"`, `"!~"` -MatchType is an enum for label matching types. + ### fn withValue ```jsonnet diff --git a/docs/API/alerting/messageTemplate.md b/docs/API/alerting/notificationTemplate.md similarity index 57% rename from docs/API/alerting/messageTemplate.md rename to docs/API/alerting/notificationTemplate.md index df7c2333..47ce2da7 100644 --- a/docs/API/alerting/messageTemplate.md +++ b/docs/API/alerting/notificationTemplate.md @@ -1,10 +1,11 @@ -# messageTemplate +# notificationTemplate -grafonnet.alerting.messageTemplate +grafonnet.alerting.notificationTemplate ## Index * [`fn withName(value)`](#fn-withname) +* [`fn withProvenance(value)`](#fn-withprovenance) * [`fn withTemplate(value)`](#fn-withtemplate) ## Fields @@ -20,6 +21,17 @@ PARAMETERS: * **value** (`string`) +### fn withProvenance + +```jsonnet +withProvenance(value) +``` + +PARAMETERS: + +* **value** (`string`) + + ### fn withTemplate ```jsonnet diff --git a/docs/API/alerting/ruleGroup/index.md b/docs/API/alerting/ruleGroup/index.md index 21d94b5f..588ead07 100644 --- a/docs/API/alerting/ruleGroup/index.md +++ b/docs/API/alerting/ruleGroup/index.md @@ -37,7 +37,7 @@ PARAMETERS: * **value** (`integer`) - +Duration in seconds. ### fn withName ```jsonnet diff --git a/docs/API/alerting/ruleGroup/rule/data.md b/docs/API/alerting/ruleGroup/rule/data.md index 0c605200..abe5cdaa 100644 --- a/docs/API/alerting/ruleGroup/rule/data.md +++ b/docs/API/alerting/ruleGroup/rule/data.md @@ -27,7 +27,7 @@ PARAMETERS: * **value** (`string`) -Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation. + ### fn withModel ```jsonnet @@ -38,7 +38,7 @@ PARAMETERS: * **value** (`object`) -JSON is the raw JSON query and includes the above properties as well as custom properties. + ### fn withModelMixin ```jsonnet @@ -49,7 +49,7 @@ PARAMETERS: * **value** (`object`) -JSON is the raw JSON query and includes the above properties as well as custom properties. + ### fn withQueryType ```jsonnet @@ -60,8 +60,7 @@ PARAMETERS: * **value** (`string`) -QueryType is an optional identifier for the type of query. -It can be used to distinguish different types of queries. + ### fn withRefId ```jsonnet @@ -72,7 +71,7 @@ PARAMETERS: * **value** (`string`) -RefID is the unique identifier of the query, set by the frontend call. + ### fn withRelativeTimeRange ```jsonnet @@ -110,9 +109,7 @@ PARAMETERS: * **value** (`integer`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. +Duration in seconds. #### fn relativeTimeRange.withTo ```jsonnet @@ -123,6 +120,4 @@ PARAMETERS: * **value** (`integer`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. \ No newline at end of file +Duration in seconds. \ No newline at end of file diff --git a/docs/API/alerting/ruleGroup/rule/index.md b/docs/API/alerting/ruleGroup/rule/index.md index 811a0440..27748f0e 100644 --- a/docs/API/alerting/ruleGroup/rule/index.md +++ b/docs/API/alerting/ruleGroup/rule/index.md @@ -112,11 +112,10 @@ withFor(value) PARAMETERS: -* **value** (`integer`) +* **value** (`string`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. +The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing. +Before this time has elapsed, the rule is only considered to be Pending. ### fn withIsPaused ```jsonnet diff --git a/gen/grafonnet-v11.0.0/alerting.libsonnet b/gen/grafonnet-v11.0.0/alerting.libsonnet index 621020b7..c5e14153 100644 --- a/gen/grafonnet-v11.0.0/alerting.libsonnet +++ b/gen/grafonnet-v11.0.0/alerting.libsonnet @@ -5,5 +5,5 @@ notificationPolicy: import 'clean/alerting/notificationPolicy.libsonnet', muteTiming: import 'clean/alerting/muteTiming.libsonnet', ruleGroup: import 'clean/alerting/ruleGroup.libsonnet', - messageTemplate: import 'clean/alerting/messageTemplate.libsonnet', + notificationTemplate: import 'clean/alerting/notificationTemplate.libsonnet', } diff --git a/gen/grafonnet-v11.0.0/clean/alerting/contactPoint.libsonnet b/gen/grafonnet-v11.0.0/clean/alerting/contactPoint.libsonnet index 13c81df1..3f601b30 100644 --- a/gen/grafonnet-v11.0.0/clean/alerting/contactPoint.libsonnet +++ b/gen/grafonnet-v11.0.0/clean/alerting/contactPoint.libsonnet @@ -1,15 +1,15 @@ // This file is generated, do not manually edit. { '#': { help: 'grafonnet.alerting.contactPoint', name: 'contactPoint' }, - '#withDisableResolveMessage': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: '' } }, + '#withDisableResolveMessage': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: 'EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.' } }, withDisableResolveMessage(value=true): { disableResolveMessage: value, }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.' } }, + '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.' } }, withName(value): { name: value, }, - '#withProvenance': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, + '#withProvenance': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.' } }, withProvenance(value): { provenance: value, }, @@ -21,11 +21,11 @@ withSettingsMixin(value): { settings+: value, }, - '#withType': { 'function': { args: [{ default: null, enums: ['alertmanager', ' dingding', ' discord', ' email', ' googlechat', ' kafka', ' line', ' opsgenie', ' pagerduty', ' pushover', ' sensugo', ' slack', ' teams', ' telegram', ' threema', ' victorops', ' webhook', ' wecom'], name: 'value', type: ['string'] }], help: '' } }, + '#withType': { 'function': { args: [{ default: null, enums: ['alertmanager', ' dingding', ' discord', ' email', ' googlechat', ' kafka', ' line', ' opsgenie', ' pagerduty', ' pushover', ' sensugo', ' slack', ' teams', ' telegram', ' threema', ' victorops', ' webhook', ' wecom'], name: 'value', type: ['string'] }], help: 'EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.' } }, withType(value): { type: value, }, - '#withUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'UID is the unique identifier of the contact point. The UID can be\nset by the user.' } }, + '#withUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'EmbeddedContactPoint is the contact point type that is used\nby grafanas embedded alertmanager implementation.' } }, withUid(value): { uid: value, }, diff --git a/gen/grafonnet-v11.0.0/clean/alerting/messageTemplate.libsonnet b/gen/grafonnet-v11.0.0/clean/alerting/messageTemplate.libsonnet deleted file mode 100644 index 7e9bc9e2..00000000 --- a/gen/grafonnet-v11.0.0/clean/alerting/messageTemplate.libsonnet +++ /dev/null @@ -1,12 +0,0 @@ -// This file is generated, do not manually edit. -{ - '#': { help: 'grafonnet.alerting.messageTemplate', name: 'messageTemplate' }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withName(value): { - name: value, - }, - '#withTemplate': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withTemplate(value): { - template: value, - }, -} diff --git a/gen/grafonnet-v11.0.0/clean/alerting/notificationPolicy.libsonnet b/gen/grafonnet-v11.0.0/clean/alerting/notificationPolicy.libsonnet index 684b33b2..618b6a9a 100644 --- a/gen/grafonnet-v11.0.0/clean/alerting/notificationPolicy.libsonnet +++ b/gen/grafonnet-v11.0.0/clean/alerting/notificationPolicy.libsonnet @@ -1,30 +1,30 @@ // This file is generated, do not manually edit. { '#': { help: 'grafonnet.alerting.notificationPolicy', name: 'notificationPolicy' }, - '#withContinue': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: '' } }, + '#withContinue': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withContinue(value=true): { continue: value, }, - '#withGroupInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, + '#withGroupInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withGroupInterval(value): { group_interval: value, }, - '#withGroupWait': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, + '#withGroupWait': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withGroupWait(value): { group_wait: value, }, - '#withRepeatInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, + '#withRepeatInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withRepeatInterval(value): { repeat_interval: value, }, - '#withGroupBy': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withGroupBy': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withGroupBy(value): { group_by: (if std.isArray(value) then value else [value]), }, - '#withGroupByMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withGroupByMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withGroupByMixin(value): { group_by+: (if std.isArray(value) @@ -45,32 +45,32 @@ then value else [value]), }, - '#withMuteTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withMuteTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withMuteTimeIntervals(value): { mute_time_intervals: (if std.isArray(value) then value else [value]), }, - '#withMuteTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withMuteTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withMuteTimeIntervalsMixin(value): { mute_time_intervals+: (if std.isArray(value) then value else [value]), }, - '#withReceiver': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, + '#withReceiver': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withReceiver(value): { receiver: value, }, - '#withRoutes': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withRoutes': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withRoutes(value): { routes: (if std.isArray(value) then value else [value]), }, - '#withRoutesMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, + '#withRoutesMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'A Route is a node that contains definitions of how to handle alerts. This is modified\nfrom the upstream alertmanager in that it adds the ObjectMatchers property.' } }, withRoutesMixin(value): { routes+: (if std.isArray(value) @@ -84,7 +84,7 @@ withName(value): { Name: value, }, - '#withType': { 'function': { args: [{ default: null, enums: ['=', '!=', '=~', '!~'], name: 'value', type: ['string'] }], help: 'MatchType is an enum for label matching types.' } }, + '#withType': { 'function': { args: [{ default: null, enums: ['=', '!=', '=~', '!~'], name: 'value', type: ['string'] }], help: '' } }, withType(value): { Type: value, }, diff --git a/gen/grafonnet-v11.0.0/raw/alerting/messageTemplate.libsonnet b/gen/grafonnet-v11.0.0/clean/alerting/notificationTemplate.libsonnet similarity index 86% rename from gen/grafonnet-v11.0.0/raw/alerting/messageTemplate.libsonnet rename to gen/grafonnet-v11.0.0/clean/alerting/notificationTemplate.libsonnet index 8ddfaf2c..fe210e89 100644 --- a/gen/grafonnet-v11.0.0/raw/alerting/messageTemplate.libsonnet +++ b/gen/grafonnet-v11.0.0/clean/alerting/notificationTemplate.libsonnet @@ -1,6 +1,6 @@ // This file is generated, do not manually edit. { - '#': { help: 'grafonnet.alerting.messageTemplate', name: 'messageTemplate' }, + '#': { help: 'grafonnet.alerting.notificationTemplate', name: 'notificationTemplate' }, '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, withName(value): { name: value, diff --git a/gen/grafonnet-v11.0.0/clean/alerting/ruleGroup.libsonnet b/gen/grafonnet-v11.0.0/clean/alerting/ruleGroup.libsonnet index 38bd9a01..f844a0a2 100644 --- a/gen/grafonnet-v11.0.0/clean/alerting/ruleGroup.libsonnet +++ b/gen/grafonnet-v11.0.0/clean/alerting/ruleGroup.libsonnet @@ -5,7 +5,7 @@ withFolderUid(value): { folderUid: value, }, - '#withInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: '' } }, + '#withInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'Duration in seconds.' } }, withInterval(value): { interval: value, }, @@ -63,7 +63,7 @@ withFolderUID(value): { folderUID: value, }, - '#withFor': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, + '#withFor': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing.\nBefore this time has elapsed, the rule is only considered to be Pending.' } }, withFor(value): { 'for': value, }, @@ -98,23 +98,23 @@ data+: { '#': { help: '', name: 'data' }, - '#withDatasourceUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: "Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation." } }, + '#withDatasourceUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, withDatasourceUid(value): { datasourceUid: value, }, - '#withModel': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'JSON is the raw JSON query and includes the above properties as well as custom properties.' } }, + '#withModel': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, withModel(value): { model: value, }, - '#withModelMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'JSON is the raw JSON query and includes the above properties as well as custom properties.' } }, + '#withModelMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, withModelMixin(value): { model+: value, }, - '#withQueryType': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'QueryType is an optional identifier for the type of query.\nIt can be used to distinguish different types of queries.' } }, + '#withQueryType': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, withQueryType(value): { queryType: value, }, - '#withRefId': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'RefID is the unique identifier of the query, set by the frontend call.' } }, + '#withRefId': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, withRefId(value): { refId: value, }, @@ -128,13 +128,13 @@ }, relativeTimeRange+: { - '#withFrom': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, + '#withFrom': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'Duration in seconds.' } }, withFrom(value): { relativeTimeRange+: { from: value, }, }, - '#withTo': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, + '#withTo': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'Duration in seconds.' } }, withTo(value): { relativeTimeRange+: { to: value, diff --git a/gen/grafonnet-v11.0.0/docs/alerting/contactPoint.md b/gen/grafonnet-v11.0.0/docs/alerting/contactPoint.md index b796b0c1..c36edb87 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/contactPoint.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/contactPoint.md @@ -28,7 +28,8 @@ PARAMETERS: * **value** (`boolean`) - default value: `true` - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withName ```jsonnet @@ -39,8 +40,8 @@ PARAMETERS: * **value** (`string`) -Name is used as grouping key in the UI. Contact points with the -same name will be grouped in the UI. +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withProvenance ```jsonnet @@ -51,7 +52,8 @@ PARAMETERS: * **value** (`string`) - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withSettings ```jsonnet @@ -85,7 +87,8 @@ PARAMETERS: * **value** (`string`) - valid values: `"alertmanager"`, `" dingding"`, `" discord"`, `" email"`, `" googlechat"`, `" kafka"`, `" line"`, `" opsgenie"`, `" pagerduty"`, `" pushover"`, `" sensugo"`, `" slack"`, `" teams"`, `" telegram"`, `" threema"`, `" victorops"`, `" webhook"`, `" wecom"` - +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. ### fn withUid ```jsonnet @@ -96,5 +99,5 @@ PARAMETERS: * **value** (`string`) -UID is the unique identifier of the contact point. The UID can be -set by the user. \ No newline at end of file +EmbeddedContactPoint is the contact point type that is used +by grafanas embedded alertmanager implementation. \ No newline at end of file diff --git a/gen/grafonnet-v11.0.0/docs/alerting/index.md b/gen/grafonnet-v11.0.0/docs/alerting/index.md index b77a82d0..3715aa47 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/index.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/index.md @@ -5,7 +5,7 @@ grafonnet.alerting ## Subpackages * [contactPoint](contactPoint.md) -* [messageTemplate](messageTemplate.md) * [muteTiming](muteTiming/index.md) * [notificationPolicy](notificationPolicy/index.md) +* [notificationTemplate](notificationTemplate.md) * [ruleGroup](ruleGroup/index.md) diff --git a/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/index.md b/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/index.md index cb4aa0a9..00072439 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/index.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/index.md @@ -34,7 +34,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withContinue ```jsonnet @@ -46,7 +47,8 @@ PARAMETERS: * **value** (`boolean`) - default value: `true` - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupBy ```jsonnet @@ -57,7 +59,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupByMixin ```jsonnet @@ -68,7 +71,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupInterval ```jsonnet @@ -79,7 +83,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withGroupWait ```jsonnet @@ -90,7 +95,8 @@ PARAMETERS: * **value** (`string`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withMatchers ```jsonnet @@ -127,7 +133,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withMuteTimeIntervalsMixin ```jsonnet @@ -138,7 +145,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withPolicy ```jsonnet @@ -149,7 +157,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withPolicyMixin ```jsonnet @@ -160,7 +169,8 @@ PARAMETERS: * **value** (`array`) - +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. ### fn withRepeatInterval ```jsonnet @@ -171,3 +181,5 @@ PARAMETERS: * **value** (`string`) +A Route is a node that contains definitions of how to handle alerts. This is modified +from the upstream alertmanager in that it adds the ObjectMatchers property. \ No newline at end of file diff --git a/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/matcher.md b/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/matcher.md index f31b1d85..7cad0a72 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/matcher.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/notificationPolicy/matcher.md @@ -32,7 +32,7 @@ PARAMETERS: * **value** (`string`) - valid values: `"="`, `"!="`, `"=~"`, `"!~"` -MatchType is an enum for label matching types. + ### fn withValue ```jsonnet diff --git a/gen/grafonnet-v11.0.0/docs/alerting/messageTemplate.md b/gen/grafonnet-v11.0.0/docs/alerting/notificationTemplate.md similarity index 57% rename from gen/grafonnet-v11.0.0/docs/alerting/messageTemplate.md rename to gen/grafonnet-v11.0.0/docs/alerting/notificationTemplate.md index df7c2333..47ce2da7 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/messageTemplate.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/notificationTemplate.md @@ -1,10 +1,11 @@ -# messageTemplate +# notificationTemplate -grafonnet.alerting.messageTemplate +grafonnet.alerting.notificationTemplate ## Index * [`fn withName(value)`](#fn-withname) +* [`fn withProvenance(value)`](#fn-withprovenance) * [`fn withTemplate(value)`](#fn-withtemplate) ## Fields @@ -20,6 +21,17 @@ PARAMETERS: * **value** (`string`) +### fn withProvenance + +```jsonnet +withProvenance(value) +``` + +PARAMETERS: + +* **value** (`string`) + + ### fn withTemplate ```jsonnet diff --git a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/index.md b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/index.md index 21d94b5f..588ead07 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/index.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/index.md @@ -37,7 +37,7 @@ PARAMETERS: * **value** (`integer`) - +Duration in seconds. ### fn withName ```jsonnet diff --git a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/data.md b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/data.md index 0c605200..abe5cdaa 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/data.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/data.md @@ -27,7 +27,7 @@ PARAMETERS: * **value** (`string`) -Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation. + ### fn withModel ```jsonnet @@ -38,7 +38,7 @@ PARAMETERS: * **value** (`object`) -JSON is the raw JSON query and includes the above properties as well as custom properties. + ### fn withModelMixin ```jsonnet @@ -49,7 +49,7 @@ PARAMETERS: * **value** (`object`) -JSON is the raw JSON query and includes the above properties as well as custom properties. + ### fn withQueryType ```jsonnet @@ -60,8 +60,7 @@ PARAMETERS: * **value** (`string`) -QueryType is an optional identifier for the type of query. -It can be used to distinguish different types of queries. + ### fn withRefId ```jsonnet @@ -72,7 +71,7 @@ PARAMETERS: * **value** (`string`) -RefID is the unique identifier of the query, set by the frontend call. + ### fn withRelativeTimeRange ```jsonnet @@ -110,9 +109,7 @@ PARAMETERS: * **value** (`integer`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. +Duration in seconds. #### fn relativeTimeRange.withTo ```jsonnet @@ -123,6 +120,4 @@ PARAMETERS: * **value** (`integer`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. \ No newline at end of file +Duration in seconds. \ No newline at end of file diff --git a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/index.md b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/index.md index 811a0440..27748f0e 100644 --- a/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/index.md +++ b/gen/grafonnet-v11.0.0/docs/alerting/ruleGroup/rule/index.md @@ -112,11 +112,10 @@ withFor(value) PARAMETERS: -* **value** (`integer`) +* **value** (`string`) -A Duration represents the elapsed time between two instants -as an int64 nanosecond count. The representation limits the -largest representable duration to approximately 290 years. +The amount of time, in seconds, for which the rule must be breached for the rule to be considered to be Firing. +Before this time has elapsed, the rule is only considered to be Pending. ### fn withIsPaused ```jsonnet diff --git a/gen/grafonnet-v11.0.0/panel/barChart.libsonnet b/gen/grafonnet-v11.0.0/panel/barChart.libsonnet index 7fc1e1af..f86fafdf 100644 --- a/gen/grafonnet-v11.0.0/panel/barChart.libsonnet +++ b/gen/grafonnet-v11.0.0/panel/barChart.libsonnet @@ -297,8 +297,8 @@ barRadius: value, }, }, - '#withBarWidth': { 'function': { args: [{ default: 0.96999999999999997, enums: null, name: 'value', type: ['number'] }], help: 'Controls the width of bars. 1 = Max width, 0 = Min width.' } }, - withBarWidth(value=0.96999999999999997): { + '#withBarWidth': { 'function': { args: [{ default: 0.97, enums: null, name: 'value', type: ['number'] }], help: 'Controls the width of bars. 1 = Max width, 0 = Min width.' } }, + withBarWidth(value=0.97): { options+: { barWidth: value, }, @@ -315,8 +315,8 @@ fullHighlight: value, }, }, - '#withGroupWidth': { 'function': { args: [{ default: 0.69999999999999996, enums: null, name: 'value', type: ['number'] }], help: 'Controls the width of groups. 1 = max with, 0 = min width.' } }, - withGroupWidth(value=0.69999999999999996): { + '#withGroupWidth': { 'function': { args: [{ default: 0.7, enums: null, name: 'value', type: ['number'] }], help: 'Controls the width of groups. 1 = max with, 0 = min width.' } }, + withGroupWidth(value=0.7): { options+: { groupWidth: value, }, diff --git a/gen/grafonnet-v11.0.0/panel/stateTimeline.libsonnet b/gen/grafonnet-v11.0.0/panel/stateTimeline.libsonnet index bb9a3068..a18899dd 100644 --- a/gen/grafonnet-v11.0.0/panel/stateTimeline.libsonnet +++ b/gen/grafonnet-v11.0.0/panel/stateTimeline.libsonnet @@ -210,8 +210,8 @@ mergeValues: value, }, }, - '#withRowHeight': { 'function': { args: [{ default: 0.90000000000000002, enums: null, name: 'value', type: ['number'] }], help: 'Controls the row height' } }, - withRowHeight(value=0.90000000000000002): { + '#withRowHeight': { 'function': { args: [{ default: 0.9, enums: null, name: 'value', type: ['number'] }], help: 'Controls the row height' } }, + withRowHeight(value=0.9): { options+: { rowHeight: value, }, diff --git a/gen/grafonnet-v11.0.0/panel/statusHistory.libsonnet b/gen/grafonnet-v11.0.0/panel/statusHistory.libsonnet index b4a4987f..676b5f78 100644 --- a/gen/grafonnet-v11.0.0/panel/statusHistory.libsonnet +++ b/gen/grafonnet-v11.0.0/panel/statusHistory.libsonnet @@ -97,8 +97,8 @@ }, options+: { - '#withColWidth': { 'function': { args: [{ default: 0.90000000000000002, enums: null, name: 'value', type: ['number'] }], help: 'Controls the column width' } }, - withColWidth(value=0.90000000000000002): { + '#withColWidth': { 'function': { args: [{ default: 0.9, enums: null, name: 'value', type: ['number'] }], help: 'Controls the column width' } }, + withColWidth(value=0.9): { options+: { colWidth: value, }, @@ -204,8 +204,8 @@ }, }, }, - '#withRowHeight': { 'function': { args: [{ default: 0.90000000000000002, enums: null, name: 'value', type: ['number'] }], help: 'Set the height of the rows' } }, - withRowHeight(value=0.90000000000000002): { + '#withRowHeight': { 'function': { args: [{ default: 0.9, enums: null, name: 'value', type: ['number'] }], help: 'Set the height of the rows' } }, + withRowHeight(value=0.9): { options+: { rowHeight: value, }, diff --git a/gen/grafonnet-v11.0.0/raw/alerting/contactPoint.libsonnet b/gen/grafonnet-v11.0.0/raw/alerting/contactPoint.libsonnet deleted file mode 100644 index a3d1859a..00000000 --- a/gen/grafonnet-v11.0.0/raw/alerting/contactPoint.libsonnet +++ /dev/null @@ -1,32 +0,0 @@ -// This file is generated, do not manually edit. -{ - '#': { help: 'grafonnet.alerting.contactPoint', name: 'contactPoint' }, - '#withDisableResolveMessage': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: '' } }, - withDisableResolveMessage(value=true): { - disableResolveMessage: value, - }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'Name is used as grouping key in the UI. Contact points with the\nsame name will be grouped in the UI.' } }, - withName(value): { - name: value, - }, - '#withProvenance': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withProvenance(value): { - provenance: value, - }, - '#withSettings': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withSettings(value): { - settings: value, - }, - '#withSettingsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withSettingsMixin(value): { - settings+: value, - }, - '#withType': { 'function': { args: [{ default: null, enums: ['alertmanager', ' dingding', ' discord', ' email', ' googlechat', ' kafka', ' line', ' opsgenie', ' pagerduty', ' pushover', ' sensugo', ' slack', ' teams', ' telegram', ' threema', ' victorops', ' webhook', ' wecom'], name: 'value', type: ['string'] }], help: '' } }, - withType(value): { - type: value, - }, - '#withUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'UID is the unique identifier of the contact point. The UID can be\nset by the user.' } }, - withUid(value): { - uid: value, - }, -} diff --git a/gen/grafonnet-v11.0.0/raw/alerting/muteTiming.libsonnet b/gen/grafonnet-v11.0.0/raw/alerting/muteTiming.libsonnet deleted file mode 100644 index 4988afb0..00000000 --- a/gen/grafonnet-v11.0.0/raw/alerting/muteTiming.libsonnet +++ /dev/null @@ -1,134 +0,0 @@ -// This file is generated, do not manually edit. -{ - '#': { help: 'grafonnet.alerting.muteTiming', name: 'muteTiming' }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withName(value): { - name: value, - }, - '#withTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimeIntervals(value): { - time_intervals: - (if std.isArray(value) - then value - else [value]), - }, - '#withTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimeIntervalsMixin(value): { - time_intervals+: - (if std.isArray(value) - then value - else [value]), - }, - time_intervals+: - { - '#': { help: '', name: 'time_intervals' }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withName(value): { - name: value, - }, - '#withTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimeIntervals(value): { - time_intervals: - (if std.isArray(value) - then value - else [value]), - }, - '#withTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimeIntervalsMixin(value): { - time_intervals+: - (if std.isArray(value) - then value - else [value]), - }, - time_intervals+: - { - '#': { help: '', name: 'time_intervals' }, - '#withDaysOfMonth': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withDaysOfMonth(value): { - days_of_month: - (if std.isArray(value) - then value - else [value]), - }, - '#withDaysOfMonthMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withDaysOfMonthMixin(value): { - days_of_month+: - (if std.isArray(value) - then value - else [value]), - }, - '#withLocation': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withLocation(value): { - location: value, - }, - '#withMonths': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withMonths(value): { - months: - (if std.isArray(value) - then value - else [value]), - }, - '#withMonthsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withMonthsMixin(value): { - months+: - (if std.isArray(value) - then value - else [value]), - }, - '#withTimes': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimes(value): { - times: - (if std.isArray(value) - then value - else [value]), - }, - '#withTimesMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withTimesMixin(value): { - times+: - (if std.isArray(value) - then value - else [value]), - }, - times+: - { - '#': { help: '', name: 'times' }, - '#withEndTime': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withEndTime(value): { - end_time: value, - }, - '#withStartTime': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withStartTime(value): { - start_time: value, - }, - }, - '#withWeekdays': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withWeekdays(value): { - weekdays: - (if std.isArray(value) - then value - else [value]), - }, - '#withWeekdaysMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withWeekdaysMixin(value): { - weekdays+: - (if std.isArray(value) - then value - else [value]), - }, - '#withYears': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withYears(value): { - years: - (if std.isArray(value) - then value - else [value]), - }, - '#withYearsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withYearsMixin(value): { - years+: - (if std.isArray(value) - then value - else [value]), - }, - }, - }, -} diff --git a/gen/grafonnet-v11.0.0/raw/alerting/notificationPolicy.libsonnet b/gen/grafonnet-v11.0.0/raw/alerting/notificationPolicy.libsonnet deleted file mode 100644 index 99a22b2d..00000000 --- a/gen/grafonnet-v11.0.0/raw/alerting/notificationPolicy.libsonnet +++ /dev/null @@ -1,130 +0,0 @@ -// This file is generated, do not manually edit. -{ - '#': { help: 'grafonnet.alerting.notificationPolicy', name: 'notificationPolicy' }, - '#withContinue': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: '' } }, - withContinue(value=true): { - continue: value, - }, - '#withGroupBy': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withGroupBy(value): { - group_by: - (if std.isArray(value) - then value - else [value]), - }, - '#withGroupByMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withGroupByMixin(value): { - group_by+: - (if std.isArray(value) - then value - else [value]), - }, - '#withGroupInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withGroupInterval(value): { - group_interval: value, - }, - '#withGroupWait': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withGroupWait(value): { - group_wait: value, - }, - '#withMatch': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'Deprecated. Remove before v1.0 release.' } }, - withMatch(value): { - match: value, - }, - '#withMatchMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'Deprecated. Remove before v1.0 release.' } }, - withMatchMixin(value): { - match+: value, - }, - '#withMatchRe': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'MatchRegexps represents a map of Regexp.' } }, - withMatchRe(value): { - match_re: value, - }, - '#withMatchReMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'MatchRegexps represents a map of Regexp.' } }, - withMatchReMixin(value): { - match_re+: value, - }, - '#withMatchers': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.' } }, - withMatchers(value): { - matchers: - (if std.isArray(value) - then value - else [value]), - }, - '#withMatchersMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.' } }, - withMatchersMixin(value): { - matchers+: - (if std.isArray(value) - then value - else [value]), - }, - matchers+: - { - '#': { help: '', name: 'matchers' }, - '#withName': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withName(value): { - Name: value, - }, - '#withType': { 'function': { args: [{ default: null, enums: ['=', '!=', '=~', '!~'], name: 'value', type: ['string'] }], help: 'MatchType is an enum for label matching types.' } }, - withType(value): { - Type: value, - }, - '#withValue': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withValue(value): { - Value: value, - }, - }, - '#withMuteTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withMuteTimeIntervals(value): { - mute_time_intervals: - (if std.isArray(value) - then value - else [value]), - }, - '#withMuteTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withMuteTimeIntervalsMixin(value): { - mute_time_intervals+: - (if std.isArray(value) - then value - else [value]), - }, - '#withObjectMatchers': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'ObjectMatchers is a list of matchers that can be used to filter alerts.' } }, - withObjectMatchers(value): { - object_matchers: - (if std.isArray(value) - then value - else [value]), - }, - '#withObjectMatchersMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'ObjectMatchers is a list of matchers that can be used to filter alerts.' } }, - withObjectMatchersMixin(value): { - object_matchers+: - (if std.isArray(value) - then value - else [value]), - }, - '#withProvenance': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withProvenance(value): { - provenance: value, - }, - '#withReceiver': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withReceiver(value): { - receiver: value, - }, - '#withRepeatInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withRepeatInterval(value): { - repeat_interval: value, - }, - '#withRoutes': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withRoutes(value): { - routes: - (if std.isArray(value) - then value - else [value]), - }, - '#withRoutesMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withRoutesMixin(value): { - routes+: - (if std.isArray(value) - then value - else [value]), - }, -} diff --git a/gen/grafonnet-v11.0.0/raw/alerting/ruleGroup.libsonnet b/gen/grafonnet-v11.0.0/raw/alerting/ruleGroup.libsonnet deleted file mode 100644 index 2e64d5b6..00000000 --- a/gen/grafonnet-v11.0.0/raw/alerting/ruleGroup.libsonnet +++ /dev/null @@ -1,234 +0,0 @@ -// This file is generated, do not manually edit. -{ - '#': { help: 'grafonnet.alerting.ruleGroup', name: 'ruleGroup' }, - '#withFolderUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withFolderUid(value): { - folderUid: value, - }, - '#withInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: '' } }, - withInterval(value): { - interval: value, - }, - '#withRules': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withRules(value): { - rules: - (if std.isArray(value) - then value - else [value]), - }, - '#withRulesMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withRulesMixin(value): { - rules+: - (if std.isArray(value) - then value - else [value]), - }, - rules+: - { - '#': { help: '', name: 'rules' }, - '#withAnnotations': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withAnnotations(value): { - annotations: value, - }, - '#withAnnotationsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withAnnotationsMixin(value): { - annotations+: value, - }, - '#withCondition': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withCondition(value): { - condition: value, - }, - '#withData': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withData(value): { - data: - (if std.isArray(value) - then value - else [value]), - }, - '#withDataMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: '' } }, - withDataMixin(value): { - data+: - (if std.isArray(value) - then value - else [value]), - }, - data+: - { - '#': { help: '', name: 'data' }, - '#withDatasourceUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: "Grafana data source unique identifier; it should be '__expr__' for a Server Side Expression operation." } }, - withDatasourceUid(value): { - datasourceUid: value, - }, - '#withModel': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'JSON is the raw JSON query and includes the above properties as well as custom properties.' } }, - withModel(value): { - model: value, - }, - '#withModelMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'JSON is the raw JSON query and includes the above properties as well as custom properties.' } }, - withModelMixin(value): { - model+: value, - }, - '#withQueryType': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'QueryType is an optional identifier for the type of query.\nIt can be used to distinguish different types of queries.' } }, - withQueryType(value): { - queryType: value, - }, - '#withRefId': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'RefID is the unique identifier of the query, set by the frontend call.' } }, - withRefId(value): { - refId: value, - }, - '#withRelativeTimeRange': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'RelativeTimeRange is the per query start and end time\nfor requests.' } }, - withRelativeTimeRange(value): { - relativeTimeRange: value, - }, - '#withRelativeTimeRangeMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: 'RelativeTimeRange is the per query start and end time\nfor requests.' } }, - withRelativeTimeRangeMixin(value): { - relativeTimeRange+: value, - }, - relativeTimeRange+: - { - '#withFrom': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, - withFrom(value): { - relativeTimeRange+: { - from: value, - }, - }, - '#withTo': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, - withTo(value): { - relativeTimeRange+: { - to: value, - }, - }, - }, - }, - '#withExecErrState': { 'function': { args: [{ default: null, enums: ['OK', 'Alerting', 'Error'], name: 'value', type: ['string'] }], help: '' } }, - withExecErrState(value): { - execErrState: value, - }, - '#withFolderUID': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withFolderUID(value): { - folderUID: value, - }, - '#withFor': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: 'A Duration represents the elapsed time between two instants\nas an int64 nanosecond count. The representation limits the\nlargest representable duration to approximately 290 years.' } }, - withFor(value): { - 'for': value, - }, - '#withId': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: '' } }, - withId(value): { - id: value, - }, - '#withIsPaused': { 'function': { args: [{ default: true, enums: null, name: 'value', type: ['boolean'] }], help: '' } }, - withIsPaused(value=true): { - isPaused: value, - }, - '#withLabels': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withLabels(value): { - labels: value, - }, - '#withLabelsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withLabelsMixin(value): { - labels+: value, - }, - '#withNoDataState': { 'function': { args: [{ default: null, enums: ['Alerting', 'NoData', 'OK'], name: 'value', type: ['string'] }], help: '' } }, - withNoDataState(value): { - noDataState: value, - }, - '#withNotificationSettings': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withNotificationSettings(value): { - notification_settings: value, - }, - '#withNotificationSettingsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['object'] }], help: '' } }, - withNotificationSettingsMixin(value): { - notification_settings+: value, - }, - notification_settings+: - { - '#withGroupBy': { 'function': { args: [{ default: ['alertname', 'grafana_folder'], enums: null, name: 'value', type: ['array'] }], help: "Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for\ncluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels\nuse the special value '...' as the sole label name.\nThis effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what\nyou want, unless you have a very low alert volume or your upstream notification system performs its own grouping.\nMust include 'alertname' and 'grafana_folder' if not using '...'." } }, - withGroupBy(value): { - notification_settings+: { - group_by: - (if std.isArray(value) - then value - else [value]), - }, - }, - '#withGroupByMixin': { 'function': { args: [{ default: ['alertname', 'grafana_folder'], enums: null, name: 'value', type: ['array'] }], help: "Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for\ncluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels\nuse the special value '...' as the sole label name.\nThis effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what\nyou want, unless you have a very low alert volume or your upstream notification system performs its own grouping.\nMust include 'alertname' and 'grafana_folder' if not using '...'." } }, - withGroupByMixin(value): { - notification_settings+: { - group_by+: - (if std.isArray(value) - then value - else [value]), - }, - }, - '#withGroupInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'Override how long to wait before sending a notification about new alerts that are added to a group of alerts for\nwhich an initial notification has already been sent. (Usually ~5m or more.)' } }, - withGroupInterval(value): { - notification_settings+: { - group_interval: value, - }, - }, - '#withGroupWait': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an\ninhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)' } }, - withGroupWait(value): { - notification_settings+: { - group_wait: value, - }, - }, - '#withMuteTimeIntervals': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'Override the times when notifications should be muted. These must match the name of a mute time interval defined\nin the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but\notherwise acts normally.' } }, - withMuteTimeIntervals(value): { - notification_settings+: { - mute_time_intervals: - (if std.isArray(value) - then value - else [value]), - }, - }, - '#withMuteTimeIntervalsMixin': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['array'] }], help: 'Override the times when notifications should be muted. These must match the name of a mute time interval defined\nin the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but\notherwise acts normally.' } }, - withMuteTimeIntervalsMixin(value): { - notification_settings+: { - mute_time_intervals+: - (if std.isArray(value) - then value - else [value]), - }, - }, - '#withReceiver': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: 'Name of the receiver to send notifications to.' } }, - withReceiver(value): { - notification_settings+: { - receiver: value, - }, - }, - '#withRepeatInterval': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: "Override how long to wait before sending a notification again if it has already been sent successfully for an\nalert. (Usually ~3h or more).\nNote that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag.\nNotifications will be resent after either repeat_interval or the data retention period have passed, whichever\noccurs first. `repeat_interval` should not be less than `group_interval`." } }, - withRepeatInterval(value): { - notification_settings+: { - repeat_interval: value, - }, - }, - }, - '#withOrgID': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['integer'] }], help: '' } }, - withOrgID(value): { - orgID: value, - }, - '#withProvenance': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withProvenance(value): { - provenance: value, - }, - '#withRuleGroup': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withRuleGroup(value): { - ruleGroup: value, - }, - '#withTitle': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withTitle(value): { - title: value, - }, - '#withUid': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withUid(value): { - uid: value, - }, - '#withUpdated': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withUpdated(value): { - updated: value, - }, - }, - '#withTitle': { 'function': { args: [{ default: null, enums: null, name: 'value', type: ['string'] }], help: '' } }, - withTitle(value): { - title: value, - }, -} diff --git a/generator/alerting.libsonnet b/generator/alerting.libsonnet index 8eccc3dc..acbfb49a 100644 --- a/generator/alerting.libsonnet +++ b/generator/alerting.libsonnet @@ -9,98 +9,53 @@ local utils = import './utils.libsonnet'; local root = self, render(schemas): - local files = self.getFilesForSpec(schemas); - { 'alerting.libsonnet': root.alertingIndex(files.clean) } + local files = self.getFilesForSchema(schemas[0]); + { 'alerting.libsonnet': root.alertingIndex(files) } + { [file.path]: file.content - for type in std.objectFields(files) - for file in files[type] + for file in files }, - // `name` matches the schema name - // `displayName` is how we want to show it in Grafonnet, matches GUI schemas: [ - { - name: 'EmbeddedContactPoint', - displayName: 'contactPoint', - }, - { - name: 'Route', - displayName: 'notificationPolicy', - }, - { - name: 'MuteTimeInterval', - displayName: 'muteTiming', - }, - { - name: 'AlertRuleGroup', - displayName: 'ruleGroup', - }, - { - name: 'NotificationTemplate', - displayName: 'messageTemplate', - }, + 'ContactPoint', + 'NotificationPolicy', + 'MuteTiming', + 'RuleGroup', + 'NotificationTemplate', ], - getFilesForSpec(spec): + local displayName(name) = + std.asciiLower(name[0]) + name[1:], + + getFilesForSchema(schemas): std.foldl( - function(acc, schema) - local raw = { - title: schema.displayName, - path: 'raw/alerting/' + schema.displayName + '.libsonnet', - content: root.generateRawLib(schema.name, schema.displayName, spec), - }; - acc + { - raw+: - (if schema.displayName in root.structure - then [raw] - else []), - clean+: - (if schema.displayName in root.structure - then [{ - title: schema.displayName, - path: 'clean/alerting/' + schema.displayName + '.libsonnet', - content: root.generateCleanLib(schema.name, schema.displayName, spec), - }] - else [raw]), - }, + function(acc, name) + acc + [ + { + title: displayName(name), + path: 'clean/alerting/' + displayName(name) + '.libsonnet', + content: root.generateLib(schemas, name), + }, + ], root.schemas, - {} + [] ), - generateRawLib(name, displayName, spec): - local ast = - utils.unwrapFromCRDsonnet( - crdsonnet.openapi.render( - name, - spec.components.schemas[name], - spec, - refactor.ASTProcessor, - addNewFunction=false, - ), - name - ); - - utils.addDoc( - ast, - displayName, - 'alerting.' - ).toString(), - - generateCleanLib(name, displayName, spec): + generateLib(schema, name): + assert std.trace(name, true); local ast = utils.unwrapFromCRDsonnet( crdsonnet.openapi.render( name, - spec.components.schemas[name], - spec, + schema.components.schemas[name], + schema, refactor.ASTProcessor, addNewFunction=false, ), name ); - local structure = std.get(root.structure, displayName, default={}); + local structure = std.get(root.structure, name, default={}); local newAST = if 'groupings' in structure @@ -115,7 +70,7 @@ local utils = import './utils.libsonnet'; utils.addDoc( newAST, - displayName, + displayName(name), 'alerting.' ).toString() + (if 'custom' in structure @@ -149,10 +104,10 @@ local utils = import './utils.libsonnet'; ).toString(), structure: { - contactPoint: { + ContactPoint: { custom: 'alerting/contactPoint.libsonnet', }, - notificationPolicy: { + NotificationPolicy: { custom: 'alerting/notificationPolicy.libsonnet', groupings: { '.': [ @@ -178,7 +133,7 @@ local utils = import './utils.libsonnet'; { from: 'matchers', to: 'matcher' }, ], }, - muteTiming: { + MuteTiming: { custom: 'alerting/muteTiming.libsonnet', groupings: { '.': [ @@ -191,7 +146,7 @@ local utils = import './utils.libsonnet'; { from: 'time_intervals', to: 'interval' }, ], }, - ruleGroup: { + RuleGroup: { custom: 'alerting/ruleGroup.libsonnet', groupings: { '.': [ @@ -231,7 +186,7 @@ local utils = import './utils.libsonnet'; { from: 'rules.data', to: 'rule.data' }, ], }, - messageTemplate: { + MessageTemplate: { groupings: { '.': [ 'withName', diff --git a/generator/jsonnetfile.json b/generator/jsonnetfile.json index b198f6fb..2b0aec20 100644 --- a/generator/jsonnetfile.json +++ b/generator/jsonnetfile.json @@ -18,6 +18,16 @@ } }, "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/grafana-foundation-sdk.git", + "subdir": "openapi" + } + }, + "version": "v11.0.x+cog-v0.0.x", + "name": "grafana-foundation-sdk-v11.0.0" } ], "legacyImports": true diff --git a/generator/jsonnetfile.lock.json b/generator/jsonnetfile.lock.json index bd4809ff..b4232746 100644 --- a/generator/jsonnetfile.lock.json +++ b/generator/jsonnetfile.lock.json @@ -18,8 +18,8 @@ "subdir": "crdsonnet" } }, - "version": "c2662f7949525ec7d4a6a68083d2d6c9f90434d4", - "sum": "oPdtP9B3pW1DH7/WNek/Qw1i3OfWFImfNgJugQbYqbk=" + "version": "c352197a5ba95b2e28f5b75d60faeb0cd1c64592", + "sum": "za+MrbUYBEqaYX/wPHpGxvCGV1q8/jtH6qhxd8ODb+U=" }, { "source": { @@ -31,6 +31,17 @@ "version": "a78ca15fbfece3110c4807d1f059132ece01d97b", "sum": "qYLH56MqvmgxE4YMNeTbuJ1XSsCpl1sumHN5x8IQv2I=" }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/grafana-foundation-sdk.git", + "subdir": "openapi" + } + }, + "version": "a4c73587770f1a44b3afc3c12a514d49a1d74632", + "sum": "9ndfNQnSlr9DI/VZGDosPxXLsdb7M3erxrBOIpiAfhw=", + "name": "grafana-foundation-sdk-v11.0.0" + }, { "source": { "git": { diff --git a/generator/main.libsonnet b/generator/main.libsonnet index e03688bf..14f7f15b 100644 --- a/generator/main.libsonnet +++ b/generator/main.libsonnet @@ -6,15 +6,14 @@ local row = import './row.libsonnet'; local patches = import './patches/main.libsonnet'; -function(version, schemas, openapiSpec) - local patchedSchemas = patches.schemas.patch(version, schemas); - local patchedSpec = patches.spec.patch(openapiSpec); +function(version, schemas) + local patchedSchemas = patches.patch(version, schemas); local files = core.render(version, patchedSchemas.core) + panel.render(patchedSchemas.panel) + query.render(patchedSchemas.query) + row.render(patchedSchemas.row) - + alerting.render(patchedSpec); + + alerting.render(patchedSchemas.alerting); { ['grafonnet-' + version + '/' + file]: '// This file is generated, do not manually edit.\n' diff --git a/generator/patches/custom_schemas/table_FieldConfig.json b/generator/patches/custom_schemas/table_FieldConfig.json deleted file mode 100644 index 546e8588..00000000 --- a/generator/patches/custom_schemas/table_FieldConfig.json +++ /dev/null @@ -1,523 +0,0 @@ -{ - "$ref": "#/definitions/TableFieldOptions", - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "AxisColorMode": { - "description": "TODO docs", - "enum": [ - "series", - "text" - ], - "type": "string" - }, - "AxisPlacement": { - "description": "TODO docs", - "enum": [ - "auto", - "bottom", - "hidden", - "left", - "right", - "top" - ], - "type": "string" - }, - "BarAlignment": { - "description": "TODO docs", - "enum": [ - 1, - -1, - 0 - ], - "type": "number" - }, - "BarGaugeDisplayMode": { - "description": "Enum expressing the possible display modes for the bar gauge component of Grafana UI", - "enum": [ - "basic", - "gradient", - "lcd" - ], - "type": "string" - }, - "BarGaugeValueMode": { - "description": "Allows for the table cell gauge display type to set the gauge mode.", - "enum": [ - "color", - "hidden", - "text" - ], - "type": "string" - }, - "FieldTextAlignment": { - "description": "TODO -- should not be table specific! TODO docs", - "enum": [ - "auto", - "left", - "right", - "center" - ], - "type": "string" - }, - "GraphDrawStyle": { - "description": "TODO docs", - "enum": [ - "bars", - "line", - "points" - ], - "type": "string" - }, - "GraphGradientMode": { - "description": "TODO docs", - "enum": [ - "hue", - "none", - "opacity", - "scheme" - ], - "type": "string" - }, - "GraphThresholdsStyleConfig": { - "additionalProperties": false, - "description": "TODO docs", - "properties": { - "mode": { - "$ref": "#/definitions/GraphTresholdsStyleMode" - } - }, - "required": [ - "mode" - ], - "type": "object" - }, - "GraphTransform": { - "description": "TODO docs", - "enum": [ - "constant", - "negative-Y" - ], - "type": "string" - }, - "GraphTresholdsStyleMode": { - "description": "TODO docs", - "enum": [ - "area", - "dashed", - "dashed+area", - "line", - "line+area", - "off", - "series" - ], - "type": "string" - }, - "HideSeriesConfig": { - "additionalProperties": false, - "description": "TODO docs", - "properties": { - "legend": { - "type": "boolean" - }, - "tooltip": { - "type": "boolean" - }, - "viz": { - "type": "boolean" - } - }, - "required": [ - "legend", - "tooltip", - "viz" - ], - "type": "object" - }, - "LineInterpolation": { - "description": "TODO docs", - "enum": [ - "linear", - "smooth", - "stepAfter", - "stepBefore" - ], - "type": "string" - }, - "LineStyle": { - "additionalProperties": false, - "description": "TODO docs", - "properties": { - "dash": { - "items": { - "type": "number" - }, - "type": "array" - }, - "fill": { - "enum": [ - "solid", - "dash", - "dot", - "square" - ], - "type": "string" - } - }, - "type": "object" - }, - "ScaleDistribution": { - "description": "TODO docs", - "enum": [ - "linear", - "log", - "ordinal", - "symlog" - ], - "type": "string" - }, - "ScaleDistributionConfig": { - "additionalProperties": false, - "description": "TODO docs", - "properties": { - "linearThreshold": { - "type": "number" - }, - "log": { - "type": "number" - }, - "type": { - "$ref": "#/definitions/ScaleDistribution" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "StackingConfig": { - "additionalProperties": false, - "description": "TODO docs", - "properties": { - "group": { - "type": "string" - }, - "mode": { - "$ref": "#/definitions/StackingMode" - } - }, - "type": "object" - }, - "StackingMode": { - "description": "TODO docs", - "enum": [ - "none", - "normal", - "percent" - ], - "type": "string" - }, - "TableAutoCellOptions": { - "additionalProperties": false, - "description": "Auto mode table cell options", - "properties": { - "type": { - "const": "auto", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableBarGaugeCellOptions": { - "additionalProperties": false, - "description": "Gauge cell options", - "properties": { - "mode": { - "$ref": "#/definitions/BarGaugeDisplayMode" - }, - "type": { - "const": "gauge", - "type": "string" - }, - "valueDisplayMode": { - "$ref": "#/definitions/BarGaugeValueMode" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableCellBackgroundDisplayMode": { - "description": "Display mode to the \"Colored Background\" display mode for table cells. Either displays a solid color (basic mode) or a gradient.", - "enum": [ - "basic", - "gradient" - ], - "type": "string" - }, - "TableCellDisplayMode": { - "description": "Internally, this is the \"type\" of cell that's being displayed in the table such as colored text, JSON, gauge, etc. The color-background-solid, gradient-gauge, and lcd-gauge modes are deprecated in favor of new cell subOptions", - "enum": [ - "auto", - "basic", - "color-background", - "color-background-solid", - "color-text", - "custom", - "gauge", - "gradient-gauge", - "image", - "json-view", - "lcd-gauge", - "sparkline" - ], - "type": "string" - }, - "TableCellOptions": { - "anyOf": [ - { - "$ref": "#/definitions/TableAutoCellOptions" - }, - { - "$ref": "#/definitions/TableSparklineCellOptions" - }, - { - "$ref": "#/definitions/TableBarGaugeCellOptions" - }, - { - "$ref": "#/definitions/TableColoredBackgroundCellOptions" - }, - { - "$ref": "#/definitions/TableColorTextCellOptions" - }, - { - "$ref": "#/definitions/TableImageCellOptions" - }, - { - "$ref": "#/definitions/TableJsonViewCellOptions" - } - ], - "description": "Table cell options. Each cell has a display mode and other potential options for that display." - }, - "TableColorTextCellOptions": { - "additionalProperties": false, - "description": "Colored text cell options", - "properties": { - "type": { - "const": "color-text", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableColoredBackgroundCellOptions": { - "additionalProperties": false, - "description": "Colored background cell options", - "properties": { - "mode": { - "$ref": "#/definitions/TableCellBackgroundDisplayMode" - }, - "type": { - "const": "color-background", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableFieldOptions": { - "additionalProperties": false, - "description": "Field options for each field within a table (e.g 10, \"The String\", 64.20, etc.) Generally defines alignment, filtering capabilties, display options, etc.", - "properties": { - "align": { - "$ref": "#/definitions/FieldTextAlignment" - }, - "cellOptions": { - "$ref": "#/definitions/TableCellOptions" - }, - "displayMode": { - "$ref": "#/definitions/TableCellDisplayMode", - "description": "This field is deprecated in favor of using cellOptions" - }, - "filterable": { - "type": "boolean" - }, - "hidden": { - "type": "boolean" - }, - "hideHeader": { - "description": "Hides any header for a column, usefull for columns that show some static content or buttons.", - "type": "boolean" - }, - "inspect": { - "type": "boolean" - }, - "minWidth": { - "type": "number" - }, - "width": { - "type": "number" - } - }, - "required": [ - "align", - "cellOptions", - "inspect" - ], - "type": "object" - }, - "TableImageCellOptions": { - "additionalProperties": false, - "description": "Json view cell options", - "properties": { - "type": { - "const": "image", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableJsonViewCellOptions": { - "additionalProperties": false, - "description": "Json view cell options", - "properties": { - "type": { - "const": "json-view", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "TableSparklineCellOptions": { - "additionalProperties": false, - "description": "Sparkline cell options", - "properties": { - "axisCenteredZero": { - "type": "boolean" - }, - "axisColorMode": { - "$ref": "#/definitions/AxisColorMode" - }, - "axisGridShow": { - "type": "boolean" - }, - "axisLabel": { - "type": "string" - }, - "axisPlacement": { - "$ref": "#/definitions/AxisPlacement" - }, - "axisSoftMax": { - "type": "number" - }, - "axisSoftMin": { - "type": "number" - }, - "axisWidth": { - "type": "number" - }, - "barAlignment": { - "$ref": "#/definitions/BarAlignment" - }, - "barMaxWidth": { - "type": "number" - }, - "barWidthFactor": { - "type": "number" - }, - "drawStyle": { - "$ref": "#/definitions/GraphDrawStyle" - }, - "fillBelowTo": { - "type": "string" - }, - "fillColor": { - "type": "string" - }, - "fillOpacity": { - "type": "number" - }, - "gradientMode": { - "$ref": "#/definitions/GraphGradientMode" - }, - "hideFrom": { - "$ref": "#/definitions/HideSeriesConfig" - }, - "lineColor": { - "type": "string" - }, - "lineInterpolation": { - "$ref": "#/definitions/LineInterpolation" - }, - "lineStyle": { - "$ref": "#/definitions/LineStyle" - }, - "lineWidth": { - "type": "number" - }, - "pointColor": { - "type": "string" - }, - "pointSize": { - "type": "number" - }, - "pointSymbol": { - "type": "string" - }, - "scaleDistribution": { - "$ref": "#/definitions/ScaleDistributionConfig" - }, - "showPoints": { - "$ref": "#/definitions/VisibilityMode" - }, - "spanNulls": { - "description": "Indicate if null values should be treated as gaps or connected. When the value is a number, it represents the maximum delta in the X axis that should be considered connected. For timeseries, this is milliseconds", - "type": [ - "boolean", - "number" - ] - }, - "stacking": { - "$ref": "#/definitions/StackingConfig" - }, - "thresholdsStyle": { - "$ref": "#/definitions/GraphThresholdsStyleConfig" - }, - "transform": { - "$ref": "#/definitions/GraphTransform" - }, - "type": { - "const": "sparkline", - "type": "string" - } - }, - "required": [ - "type" - ], - "type": "object" - }, - "VisibilityMode": { - "description": "TODO docs", - "enum": [ - "always", - "auto", - "never" - ], - "type": "string" - } - } -} \ No newline at end of file diff --git a/generator/patches/main.libsonnet b/generator/patches/main.libsonnet index 4180d0d6..0044f4ac 100644 --- a/generator/patches/main.libsonnet +++ b/generator/patches/main.libsonnet @@ -1,4 +1,181 @@ +local utils = import '../utils.libsonnet'; + { - schemas: import './schemas.libsonnet', - spec: import './spec.libsonnet', + local root = self, + + // Patch the JSON Schemas and put them into categories. + // This function also restructures the schemas for processing by CRDsonnet. + patch(version, schemas): { + core: + std.filterMap( + function(schema) + std.get(schema.info, 'x-schema-kind', '') == 'core', + root.sanitizeDashboardSchema, + schemas + ) + + [ + root.getPanelSchema(version, schemas), + root.getFolderSchema(version, schemas), + ], + + panel: + root.getMissingAlertListPanel(schemas) + + std.filter( + function(schema) + std.get(schema.info, 'x-schema-variant', '') == 'panelcfg', + schemas + ), + + query: + std.filter( + function(schema) + std.get(schema.info, 'x-schema-variant', '') == 'dataquery', + schemas, + ), + + row: + [root.getRowSchema(schemas)], + + alerting: + [root.getAlertingSchema(schemas)], + }, + + sanitizeDashboardSchema(schema): + schema + + ( + if schema.info.title == 'dashboard' + then { + components+: { + schemas+: { + Snapshot+: { + properties+: { + // Remove recursive $ref on route to prevent infinite recursion. + dashboard: { + type: 'object', + }, + }, + }, + Dashboard+: { + properties+: { + panels: { type: 'array' }, + }, + }, + }, + }, + } + else {} + ), + + getPanelSchema(version, schemas): + root.getDashboardSchema(schemas) + + { + info+: { + title: 'panel', + version: '0.0.0', + 'x-schema-identifier': 'Panel', + }, + components+: { + schemas+: { + local v = super.ValueMapping, + ValueMapping: { + type: 'object', + description: v.description, + oneOf: v.anyOf, // This used to be a oneOf, by changing to an anyOf it gets rendered differently. + }, + Panel+: { + properties+: { + pluginVersion: { + // HACK: Grafana uses the pluginVersion to decide which migrations to execute + // however the pluginVersion is currently not part of the plugin schema's. + // This hack ensures that the pluginVersion matches the Grafana version. + const: version, + }, + }, + }, + }, + }, + }, + + // Folder schema got removed from CUE in https://github.com/grafana/grafana/pull/79413 + // This adds it back as it is a really simple object. + getFolderSchema(version, schemas): + local allSchemaTitles = std.map(function(x) x.info.title, schemas); + local ignoreOnVersions = ['v10.0.0', 'v9.5.0', 'v9.4.0']; + if !std.member(allSchemaTitles, 'folder') + && !std.member(ignoreOnVersions, version) + then (import './custom_schemas/folder.json') + else {}, + + // ref: https://github.com/grafana/grafonnet/issues/137 + getMissingAlertListPanel(schemas): + local title = 'alertlist'; + local allSchemaTitles = std.map(function(x) x.info.title, schemas); + if !std.member(allSchemaTitles, title) + then + [ + { + info: { + title: title, + 'x-schema-identifier': 'alertlist', + 'x-schema-kind': 'composable', + 'x-schema-variant': 'panelcfg', + }, + definitions: (import './custom_schemas/alertList.json').definitions, + components: { + schemas: { + Options: { + oneOf: [ + { '$ref': '#/definitions/AlertListOptions' }, + { '$ref': '#/definitions/UnifiedAlertListOptions' }, + ], + }, + }, + }, + }, + ] + else [], + + getRowSchema(schemas): + root.getDashboardSchema(schemas) + + { + info+: { + title: 'row', + 'x-schema-identifier': 'RowPanel', + }, + components+: { + schemas+: { + RowPanel+: { + properties+: { + type: { const: 'row' }, + panels: { type: 'array' }, + }, + }, + }, + }, + }, + + getDashboardSchema(schemas): + std.filter( + function(s) s.info.title == 'dashboard', + schemas + )[0], + + getAlertingSchema(schemas): + std.filter( + function(s) s.info.title == 'alerting', + schemas + )[0] + + { + components+: { + schemas+: { + NotificationPolicy+: { + properties+: { + routes+: + // Remove recursive $ref on route to prevent infinite recursion. + { items: { type: 'object' } }, + }, + }, + }, + }, + }, } diff --git a/generator/patches/schemas.libsonnet b/generator/patches/schemas.libsonnet deleted file mode 100644 index 3e58b2ec..00000000 --- a/generator/patches/schemas.libsonnet +++ /dev/null @@ -1,172 +0,0 @@ -local utils = import '../utils.libsonnet'; - -{ - local root = self, - - // Patch the JSON Schemas and put them into categories. - // This function also restructures the schemas for processing by CRDsonnet. - patch(version, schemas): { - core: - std.filterMap( - function(schema) - std.get(schema.info, 'x-schema-kind', '') == 'core', - root.removePanelsFromDashboardSchema, - schemas - ) - + [ - root.getPanelSchema(version, schemas), - root.getFolderSchema(version, schemas), - ], - - panel: - root.getMissingAlertListPanel(schemas) - + std.filter( - function(schema) - std.get(schema.info, 'x-schema-variant', '') == 'panelcfg', - schemas - ), - - query: - std.filter( - function(schema) - std.get(schema.info, 'x-schema-variant', '') == 'dataquery', - schemas, - ), - - row: - [root.getRowSchema(schemas)], - }, - - removePanelsFromDashboardSchema(schema): - schema - + ( - if schema.info.title == 'dashboard' - then { - components+: { - schemas+: { - Dashboard+: { - properties+: { - panels: { type: 'array' }, - }, - }, - }, - }, - } - else {} - ), - - getPanelSchema(version, schemas): - root.getDashboardSchema(schemas) - + { - info+: { - title: 'panel', - version: '0.0.0', - 'x-schema-identifier': 'Panel', - }, - components+: { - schemas+: { - local v = super.ValueMapping, - ValueMapping: { - type: 'object', - description: v.description, - oneOf: v.anyOf, // This used to be a oneOf, by changing to an anyOf it gets rendered differently. - }, - Panel+: { - properties+: { - pluginVersion: { - // HACK: Grafana uses the pluginVersion to decide which migrations to execute - // however the pluginVersion is currently not part of the plugin schema's. - // This hack ensures that the pluginVersion matches the Grafana version. - const: version, - }, - }, - }, - }, - }, - }, - - // Folder schema got removed from CUE in https://github.com/grafana/grafana/pull/79413 - // This adds it back as it is a really simple object. - getFolderSchema(version, schemas): - local allSchemaTitles = std.map(function(x) x.info.title, schemas); - local ignoreOnVersions = ['v10.0.0', 'v9.5.0', 'v9.4.0']; - if !std.member(allSchemaTitles, 'folder') - && !std.member(ignoreOnVersions, version) - then (import './custom_schemas/folder.json') - else {}, - - // ref: https://github.com/grafana/grafonnet/issues/137 - getMissingAlertListPanel(schemas): - local title = 'alertlist'; - local allSchemaTitles = std.map(function(x) x.info.title, schemas); - if !std.member(allSchemaTitles, title) - then - [ - { - info: { - title: title, - 'x-schema-identifier': 'alertlist', - 'x-schema-kind': 'composable', - 'x-schema-variant': 'panelcfg', - }, - definitions: (import './custom_schemas/alertList.json').definitions, - components: { - schemas: { - Options: { - oneOf: [ - { '$ref': '#/definitions/AlertListOptions' }, - { '$ref': '#/definitions/UnifiedAlertListOptions' }, - ], - }, - }, - }, - }, - ] - else [], - - getRowSchema(schemas): - root.getDashboardSchema(schemas) - + { - info+: { - title: 'row', - 'x-schema-identifier': 'RowPanel', - }, - components+: { - schemas+: { - RowPanel+: { - properties+: { - type: { const: 'row' }, - panels: { type: 'array' }, - }, - }, - }, - }, - }, - - // ref: https://github.com/grafana/grafana/issues/75610 - addTableFieldConfig(schema): - if schema.info.title == 'TablePanelCfg' - && !('FieldConfig' in schema.components.schemas.TablePanelCfg.properties) - && !('PanelFieldConfig' in schema.components.schemas.TablePanelCfg.properties) - then { - definitions: (import './custom_schemas/table_FieldConfig.json').definitions, - components+: { - schemas+: { - TablePanelCfg+: { - properties+: { - PanelFieldConfig: { - '$ref': '#/definitions/TableFieldOptions', - }, - }, - }, - }, - }, - } - else {}, - - getDashboardSchema(schemas): - std.filter( - function(s) s.info.title == 'dashboard', - schemas - )[0], -} diff --git a/generator/patches/spec.libsonnet b/generator/patches/spec.libsonnet deleted file mode 100644 index e3e61673..00000000 --- a/generator/patches/spec.libsonnet +++ /dev/null @@ -1,101 +0,0 @@ -{ - // Patch a few issues in the openapi spec so it renders properly, see individual function descriptions for more details. - patch(spec): - self.renameTitleToDescription(spec) - + self.addIsPausedToProvisionedAlertRule() - + self.removeRecursiveRefOnRoute() - + self.fixMatchType() - + self.fixRefOnTimeInterval(), - - // the OpenAPI schema currently holds a number of `title` fields that contain a description of a parameter, this is used for godoc comments. This lacks standardisation upstream but should dissapear over time. In mean time we'll merge it here with `description` so it shows up in Grafonnet docs. - renameTitleToDescription(spec): - local schemas = spec.components.schemas; - spec + { - components+: { - schemas+: - std.foldl( - function(acc, k) - acc + { - [k]: schemas[k] + { - description: - std.join( - '\n\n', - std.prune([ - std.get(schemas[k], 'title', null), - std.get(schemas[k], 'description', null), - ]) - ), - }, - }, - std.objectFields(schemas), - {} - ), - }, - }, - - // Add isPaused to ProvisionedAlertRule, this is missing in v9.4.0 - addIsPausedToProvisionedAlertRule(): { - components+: { - schemas+: { - ProvisionedAlertRule+: { - properties+: - if !std.objectHas(super.properties, 'isPaused') - then { - isPaused+: - { type: 'boolean' }, - } - else {}, - }, - }, - }, - }, - - // Remove recursive $ref on route to prevent infinite recursion. - removeRecursiveRefOnRoute(): { - components+: { - schemas+: { - Route+: { - properties+: { - routes+: - { items: { type: 'object' } }, - }, - }, - }, - }, - }, - - // Fix matchType if type is wrong. - fixMatchType(): { - components+: { - schemas+: { - MatchType+: - if super.MatchType.type == 'integer' - then { - type: 'string', - enum: [ - '=', - '!=', - '=~', - '!~', - ], - } - else {}, - }, - }, - }, - - // Fix ref on TimeInterval - fixRefOnTimeInterval(): { - components+: { - schemas+: { - TimeInterval+: { - properties+: { - time_intervals+: - { items: { '$ref': '#/components/schemas/TimeIntervalItem' } }, - }, - }, - }, - }, - }, - -} diff --git a/generator/query.libsonnet b/generator/query.libsonnet index 628d3c77..902a969b 100644 --- a/generator/query.libsonnet +++ b/generator/query.libsonnet @@ -40,7 +40,7 @@ local utils = import './utils.libsonnet'; generateLib(schema): local title = std.get(root.titleMapping, std.asciiLower(schema.info.title), schema.info.title); local customSchema = - schema { + schema + { components+: { schemas+: std.get(fixes, title, {}), }, diff --git a/scripts/generate.sh b/scripts/generate.sh index d6a77398..e4fdd5a9 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -3,7 +3,6 @@ set -euo pipefail set -x VERSION="${1}" -COG_VERSION="${VERSION%?}x" DIRNAME0="$(dirname "$0")" SCRIPT_DIR=$(cd "$DIRNAME0" && pwd) @@ -20,13 +19,9 @@ jb init cp -r "${REPO_DIR}/generator" generator cp -r "${REPO_DIR}/generator/jsonnetfile.lock.json" . jb install -jb install "github.com/grafana/grafana-foundation-sdk/openapi@${COG_VERSION}+cog-v0.0.x" -jb install "github.com/grafana/grafana/public@${VERSION}-preview" jb install ./generator -echo '[' > imports.libsonnet -find vendor/github.com/grafana/grafana-foundation-sdk/openapi -type f | awk '{print "import \""$1"\","}' >> imports.libsonnet -echo ']' >> imports.libsonnet +SCHEMAS='['$(find vendor/grafana-foundation-sdk-${VERSION}/ -type f | awk '{print "import \""$1"\","}')']' OUT_DIR="${REPO_DIR}/gen" GEN_DIR="${OUT_DIR}/grafonnet-${VERSION}" @@ -37,11 +32,10 @@ mkdir -p "${GEN_DIR}" cp -r "${REPO_DIR}/custom" "${GEN_DIR}" mapfile -t FILES < <( - jsonnet -J vendor \ + jrsonnet -J vendor \ -S -c -m "${OUT_DIR}" \ --tla-str version="${VERSION}" \ - --tla-code-file schemas="./imports.libsonnet" \ - --tla-code-file openapiSpec="github.com/grafana/grafana/public/openapi3.json" \ + --tla-code schemas="${SCHEMAS}" \ -e "(import 'generator/main.libsonnet')" ) @@ -49,7 +43,7 @@ for FILE in "${FILES[@]}"; do jsonnetfmt --no-use-implicit-plus -i "${FILE}" done -jsonnet -S -c -m "${GEN_DIR}" vendor/generator/dependencies.libsonnet +jrsonnet -S -c -m "${GEN_DIR}" vendor/generator/dependencies.libsonnet jrsonnet -J vendor \ -S -c -m "${GEN_DIR}/docs/" \ diff --git a/scripts/generate_latest.sh b/scripts/generate_latest.sh index 96653bef..130208cc 100755 --- a/scripts/generate_latest.sh +++ b/scripts/generate_latest.sh @@ -28,7 +28,7 @@ LATEST_DIR="${OUT_DIR}/grafonnet-${VERSION}" rm -rf "${GEN_DIR}" mkdir -p "${GEN_DIR}" -jsonnet -S -c -m "${OUT_DIR}" \ +jrsonnet -S -c -m "${OUT_DIR}" \ --tla-str version="${VERSION}" \ generator/latest.libsonnet jsonnetfmt --no-use-implicit-plus -i "${GEN_DIR}/main.libsonnet"