Migrate Alerting Notifications API to app installer (#109309)
* migrate to new manifest format * rename app to alerting.notifications to not conflict with rules * disable custom field selectors as they are not supported in appinstaller
This commit is contained in:
@@ -5,5 +5,4 @@ generate: do-generate ## Run Grafana App SDK code generation
|
||||
|
||||
.PHONY: do-generate
|
||||
do-generate: install-app-sdk update-app-sdk
|
||||
## --defencoding=none and noschemasinmanifest are needed to avoid infinite loop while generating recursive models (see routingtree.cue)
|
||||
@$(APP_SDK_BIN) generate --grouping=group --gogenpath=./pkg/apis --defencoding=none --postprocess --noschemasinmanifest --useoldmanifestkinds
|
||||
@$(APP_SDK_BIN) generate --grouping=group --gogenpath=./pkg/apis --defencoding=yaml --postprocess
|
||||
|
||||
@@ -0,0 +1,432 @@
|
||||
apiVersion: apps.grafana.com/v1alpha2
|
||||
kind: AppManifest
|
||||
metadata:
|
||||
name: alerting-notifications
|
||||
spec:
|
||||
appName: alerting-notifications
|
||||
group: notifications.alerting.grafana.app
|
||||
versions:
|
||||
- kinds:
|
||||
- conversion: false
|
||||
kind: Receiver
|
||||
plural: Receivers
|
||||
schemas:
|
||||
Integration:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
disableResolveMessage:
|
||||
type: boolean
|
||||
secureFields:
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
type: object
|
||||
settings:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
type: object
|
||||
type:
|
||||
type: string
|
||||
uid:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
required:
|
||||
- type
|
||||
- version
|
||||
- settings
|
||||
type: object
|
||||
OperatorState:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive state
|
||||
field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: details contains any extra information that is operator-specific
|
||||
type: object
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
Receiver:
|
||||
properties:
|
||||
spec:
|
||||
$ref: '#/components/schemas/spec'
|
||||
status:
|
||||
$ref: '#/components/schemas/status'
|
||||
required:
|
||||
- spec
|
||||
spec:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
integrations:
|
||||
items:
|
||||
$ref: '#/components/schemas/Integration'
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
- title
|
||||
- integrations
|
||||
type: object
|
||||
status:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
additionalFields:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
$ref: '#/components/schemas/OperatorState'
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
scope: Namespaced
|
||||
- conversion: false
|
||||
kind: RoutingTree
|
||||
plural: RoutingTrees
|
||||
schemas:
|
||||
Matcher:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
type:
|
||||
enum:
|
||||
- =
|
||||
- '!='
|
||||
- =~
|
||||
- '!~'
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
required:
|
||||
- type
|
||||
- label
|
||||
- value
|
||||
type: object
|
||||
OperatorState:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive state
|
||||
field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: details contains any extra information that is operator-specific
|
||||
type: object
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
Route:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
active_time_intervals:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
continue:
|
||||
type: boolean
|
||||
group_by:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
group_interval:
|
||||
type: string
|
||||
group_wait:
|
||||
type: string
|
||||
matchers:
|
||||
items:
|
||||
$ref: '#/components/schemas/Matcher'
|
||||
type: array
|
||||
mute_time_intervals:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
receiver:
|
||||
type: string
|
||||
repeat_interval:
|
||||
type: string
|
||||
routes:
|
||||
items:
|
||||
$ref: '#/components/schemas/Route'
|
||||
type: array
|
||||
required:
|
||||
- continue
|
||||
type: object
|
||||
RouteDefaults:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
group_by:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
group_interval:
|
||||
type: string
|
||||
group_wait:
|
||||
type: string
|
||||
receiver:
|
||||
type: string
|
||||
repeat_interval:
|
||||
type: string
|
||||
required:
|
||||
- receiver
|
||||
type: object
|
||||
RoutingTree:
|
||||
properties:
|
||||
spec:
|
||||
$ref: '#/components/schemas/spec'
|
||||
status:
|
||||
$ref: '#/components/schemas/status'
|
||||
required:
|
||||
- spec
|
||||
spec:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
defaults:
|
||||
$ref: '#/components/schemas/RouteDefaults'
|
||||
routes:
|
||||
items:
|
||||
$ref: '#/components/schemas/Route'
|
||||
type: array
|
||||
required:
|
||||
- defaults
|
||||
- routes
|
||||
type: object
|
||||
status:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
additionalFields:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
$ref: '#/components/schemas/OperatorState'
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
scope: Namespaced
|
||||
- conversion: false
|
||||
kind: TemplateGroup
|
||||
plural: TemplateGroups
|
||||
schemas:
|
||||
OperatorState:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive state
|
||||
field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: details contains any extra information that is operator-specific
|
||||
type: object
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
TemplateGroup:
|
||||
properties:
|
||||
spec:
|
||||
$ref: '#/components/schemas/spec'
|
||||
status:
|
||||
$ref: '#/components/schemas/status'
|
||||
required:
|
||||
- spec
|
||||
spec:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
- title
|
||||
- content
|
||||
type: object
|
||||
status:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
additionalFields:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
$ref: '#/components/schemas/OperatorState'
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
scope: Namespaced
|
||||
- conversion: false
|
||||
kind: TimeInterval
|
||||
plural: TimeIntervals
|
||||
schemas:
|
||||
Interval:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
days_of_month:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
location:
|
||||
type: string
|
||||
months:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
times:
|
||||
items:
|
||||
$ref: '#/components/schemas/TimeRange'
|
||||
type: array
|
||||
weekdays:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
years:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
OperatorState:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive state
|
||||
field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: details contains any extra information that is operator-specific
|
||||
type: object
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
TimeInterval:
|
||||
properties:
|
||||
spec:
|
||||
$ref: '#/components/schemas/spec'
|
||||
status:
|
||||
$ref: '#/components/schemas/status'
|
||||
required:
|
||||
- spec
|
||||
TimeRange:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
end_time:
|
||||
type: string
|
||||
start_time:
|
||||
type: string
|
||||
required:
|
||||
- start_time
|
||||
- end_time
|
||||
type: object
|
||||
spec:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
time_intervals:
|
||||
items:
|
||||
$ref: '#/components/schemas/Interval'
|
||||
type: array
|
||||
required:
|
||||
- name
|
||||
- time_intervals
|
||||
type: object
|
||||
status:
|
||||
additionalProperties: false
|
||||
properties:
|
||||
additionalFields:
|
||||
additionalProperties:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
$ref: '#/components/schemas/OperatorState'
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
scope: Namespaced
|
||||
name: v0alpha1
|
||||
served: true
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: receivers.notifications.alerting.grafana.app
|
||||
spec:
|
||||
group: notifications.alerting.grafana.app
|
||||
names:
|
||||
kind: Receiver
|
||||
plural: receivers
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v0alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
spec:
|
||||
properties:
|
||||
integrations:
|
||||
items:
|
||||
properties:
|
||||
disableResolveMessage:
|
||||
type: boolean
|
||||
secureFields:
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
type: object
|
||||
settings:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type:
|
||||
type: string
|
||||
uid:
|
||||
type: string
|
||||
version:
|
||||
type: string
|
||||
required:
|
||||
- type
|
||||
- version
|
||||
- settings
|
||||
type: object
|
||||
type: array
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
- title
|
||||
- integrations
|
||||
type: object
|
||||
status:
|
||||
properties:
|
||||
additionalFields:
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive
|
||||
state field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
description: details contains any extra information that is
|
||||
operator-specific
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: routingtrees.notifications.alerting.grafana.app
|
||||
spec:
|
||||
group: notifications.alerting.grafana.app
|
||||
names:
|
||||
kind: RoutingTree
|
||||
plural: routingtrees
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v0alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
spec:
|
||||
properties:
|
||||
defaults:
|
||||
properties:
|
||||
group_by:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
group_interval:
|
||||
type: string
|
||||
group_wait:
|
||||
type: string
|
||||
receiver:
|
||||
type: string
|
||||
repeat_interval:
|
||||
type: string
|
||||
required:
|
||||
- receiver
|
||||
type: object
|
||||
routes:
|
||||
items:
|
||||
properties:
|
||||
active_time_intervals:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
continue:
|
||||
type: boolean
|
||||
group_by:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
group_interval:
|
||||
type: string
|
||||
group_wait:
|
||||
type: string
|
||||
matchers:
|
||||
items:
|
||||
properties:
|
||||
label:
|
||||
type: string
|
||||
type:
|
||||
enum:
|
||||
- =
|
||||
- '!='
|
||||
- =~
|
||||
- '!~'
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
required:
|
||||
- type
|
||||
- label
|
||||
- value
|
||||
type: object
|
||||
type: array
|
||||
mute_time_intervals:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
receiver:
|
||||
type: string
|
||||
repeat_interval:
|
||||
type: string
|
||||
routes:
|
||||
items:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: array
|
||||
required:
|
||||
- continue
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- defaults
|
||||
- routes
|
||||
type: object
|
||||
status:
|
||||
properties:
|
||||
additionalFields:
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive
|
||||
state field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
description: details contains any extra information that is
|
||||
operator-specific
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: templategroups.notifications.alerting.grafana.app
|
||||
spec:
|
||||
group: notifications.alerting.grafana.app
|
||||
names:
|
||||
kind: TemplateGroup
|
||||
plural: templategroups
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v0alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
spec:
|
||||
properties:
|
||||
content:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
required:
|
||||
- title
|
||||
- content
|
||||
type: object
|
||||
status:
|
||||
properties:
|
||||
additionalFields:
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive
|
||||
state field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
description: details contains any extra information that is
|
||||
operator-specific
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: timeintervals.notifications.alerting.grafana.app
|
||||
spec:
|
||||
group: notifications.alerting.grafana.app
|
||||
names:
|
||||
kind: TimeInterval
|
||||
plural: timeintervals
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v0alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
spec:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
time_intervals:
|
||||
items:
|
||||
properties:
|
||||
days_of_month:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
location:
|
||||
type: string
|
||||
months:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
times:
|
||||
items:
|
||||
properties:
|
||||
end_time:
|
||||
type: string
|
||||
start_time:
|
||||
type: string
|
||||
required:
|
||||
- start_time
|
||||
- end_time
|
||||
type: object
|
||||
type: array
|
||||
weekdays:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
years:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
type: array
|
||||
required:
|
||||
- name
|
||||
- time_intervals
|
||||
type: object
|
||||
status:
|
||||
properties:
|
||||
additionalFields:
|
||||
description: additionalFields is reserved for future use
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operatorStates:
|
||||
additionalProperties:
|
||||
properties:
|
||||
descriptiveState:
|
||||
description: descriptiveState is an optional more descriptive
|
||||
state field which has no requirements on format
|
||||
type: string
|
||||
details:
|
||||
description: details contains any extra information that is
|
||||
operator-specific
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
lastEvaluation:
|
||||
description: lastEvaluation is the ResourceVersion last evaluated
|
||||
type: string
|
||||
state:
|
||||
description: |-
|
||||
state describes the state of the lastEvaluation.
|
||||
It is limited to three possible states for machine evaluation.
|
||||
enum:
|
||||
- success
|
||||
- in_progress
|
||||
- failed
|
||||
type: string
|
||||
required:
|
||||
- lastEvaluation
|
||||
- state
|
||||
type: object
|
||||
description: |-
|
||||
operatorStates is a map of operator ID to operator state evaluations.
|
||||
Any operator which consumes this kind SHOULD add its state evaluation information to this field.
|
||||
type: object
|
||||
type: object
|
||||
required:
|
||||
- spec
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
@@ -1,12 +1,20 @@
|
||||
package kinds
|
||||
|
||||
manifest: {
|
||||
appName: "alerting"
|
||||
appName: "alerting-notifications"
|
||||
groupOverride: "notifications.alerting.grafana.app"
|
||||
kinds: [
|
||||
receiver,
|
||||
routeTree,
|
||||
templateGroup,
|
||||
timeInterval,
|
||||
]
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
ts: {enabled: false}
|
||||
go: {enabled: true}
|
||||
}
|
||||
kinds: [
|
||||
receiverv0alpha1,
|
||||
routeTreev0alpha1,
|
||||
templatev0alpha1,
|
||||
timeIntervalv0alpha1,
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,25 +4,16 @@ import (
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/kinds/v0alpha1"
|
||||
)
|
||||
|
||||
receiver: {
|
||||
receiverKind: {
|
||||
kind: "Receiver"
|
||||
apiResource: {
|
||||
groupOverride: "notifications.alerting.grafana.app"
|
||||
}
|
||||
pluralName: "Receivers"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
ts: {enabled: false}
|
||||
go: {enabled: true}
|
||||
}
|
||||
schema: {
|
||||
spec: v0alpha1.ReceiverSpec
|
||||
}
|
||||
selectableFields: [
|
||||
"spec.title",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
receiverv0alpha1: receiverKind & {
|
||||
schema: {
|
||||
spec: v0alpha1.ReceiverSpec
|
||||
}
|
||||
// selectableFields: [ // TODO revisit when custom field selectors are supported
|
||||
// "spec.title",
|
||||
// ]
|
||||
}
|
||||
@@ -3,23 +3,13 @@ package kinds
|
||||
import (
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/kinds/v0alpha1"
|
||||
)
|
||||
|
||||
routeTree: {
|
||||
routingTreeKind: {
|
||||
kind: "RoutingTree"
|
||||
apiResource: {
|
||||
groupOverride: "notifications.alerting.grafana.app"
|
||||
}
|
||||
pluralName: "RoutingTrees"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
ts: {enabled: false}
|
||||
go: {enabled: true}
|
||||
}
|
||||
schema: {
|
||||
spec: v0alpha1.RouteTreeSpec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
routeTreev0alpha1: routingTreeKind & {
|
||||
schema: {
|
||||
spec: v0alpha1.RouteTreeSpec
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,25 +4,16 @@ import (
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/kinds/v0alpha1"
|
||||
)
|
||||
|
||||
templateGroup: {
|
||||
templateKind: {
|
||||
kind: "TemplateGroup"
|
||||
apiResource: {
|
||||
groupOverride: "notifications.alerting.grafana.app"
|
||||
}
|
||||
pluralName: "TemplateGroups"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
ts: {enabled: false}
|
||||
go: {enabled: true}
|
||||
}
|
||||
schema: {
|
||||
spec: v0alpha1.TemplateGroupSpec
|
||||
}
|
||||
selectableFields: [
|
||||
"spec.title",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templatev0alpha1: templateKind & {
|
||||
schema: {
|
||||
spec: v0alpha1.TemplateGroupSpec
|
||||
}
|
||||
// selectableFields: [ // TODO revisit when custom field selectors are supported
|
||||
// "spec.title",
|
||||
// ]
|
||||
}
|
||||
@@ -3,26 +3,16 @@ package kinds
|
||||
import (
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/kinds/v0alpha1"
|
||||
)
|
||||
|
||||
timeInterval: {
|
||||
timeIntervalKind: {
|
||||
kind: "TimeInterval"
|
||||
apiResource: {
|
||||
groupOverride: "notifications.alerting.grafana.app"
|
||||
}
|
||||
pluralName: "TimeIntervals"
|
||||
current: "v0alpha1"
|
||||
versions: {
|
||||
"v0alpha1": {
|
||||
codegen: {
|
||||
ts: {enabled: false}
|
||||
go: {enabled: true}
|
||||
}
|
||||
schema: {
|
||||
spec: v0alpha1.TimeIntervalSpec
|
||||
}
|
||||
selectableFields: [
|
||||
"spec.name",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timeIntervalv0alpha1: timeIntervalKind & {
|
||||
schema: {
|
||||
spec: v0alpha1.TimeIntervalSpec
|
||||
}
|
||||
// selectableFields: [ // TODO revisit when custom field selectors are supported
|
||||
// "spec.name",
|
||||
// ]
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
|
||||
v0alpha1 "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
)
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
AppName: "alerting",
|
||||
Group: "notifications.alerting.grafana.app",
|
||||
Versions: []app.ManifestVersion{
|
||||
{
|
||||
Name: "v0alpha1",
|
||||
Served: true,
|
||||
Kinds: []app.ManifestVersionKind{
|
||||
{
|
||||
Kind: "Receiver",
|
||||
Plural: "Receivers",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
SelectableFields: []string{
|
||||
"spec.title",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "RoutingTree",
|
||||
Plural: "RoutingTrees",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "TemplateGroup",
|
||||
Plural: "TemplateGroups",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
SelectableFields: []string{
|
||||
"spec.title",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "TimeInterval",
|
||||
Plural: "TimeIntervals",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
SelectableFields: []string{
|
||||
"spec.name",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func LocalManifest() app.Manifest {
|
||||
return app.NewEmbeddedManifest(appManifestData)
|
||||
}
|
||||
|
||||
func RemoteManifest() app.Manifest {
|
||||
return app.NewAPIServerManifest("alerting")
|
||||
}
|
||||
|
||||
var kindVersionToGoType = map[string]resource.Kind{
|
||||
"Receiver/v0alpha1": v0alpha1.ReceiverKind(),
|
||||
"RoutingTree/v0alpha1": v0alpha1.RoutingTreeKind(),
|
||||
"TemplateGroup/v0alpha1": v0alpha1.TemplateGroupKind(),
|
||||
"TimeInterval/v0alpha1": v0alpha1.TimeIntervalKind(),
|
||||
}
|
||||
|
||||
// ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists.
|
||||
// If there is no association for the provided Kind and Version, exists will return false.
|
||||
func ManifestGoTypeAssociator(kind, version string) (goType resource.Kind, exists bool) {
|
||||
goType, exists = kindVersionToGoType[fmt.Sprintf("%s/%s", kind, version)]
|
||||
return goType, exists
|
||||
}
|
||||
|
||||
var customRouteToGoResponseType = map[string]any{}
|
||||
|
||||
// ManifestCustomRouteResponsesAssociator returns the associated response go type for a given kind, version, custom route path, and method, if one exists.
|
||||
// kind may be empty for custom routes which are not kind subroutes. Leading slashes are removed from subroute paths.
|
||||
// If there is no association for the provided kind, version, custom route path, and method, exists will return false.
|
||||
func ManifestCustomRouteResponsesAssociator(kind, version, path, verb string) (goType any, exists bool) {
|
||||
if len(path) > 0 && path[0] == '/' {
|
||||
path = path[1:]
|
||||
}
|
||||
goType, exists = customRouteToGoResponseType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
|
||||
return goType, exists
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
)
|
||||
|
||||
var UTCLocation = "UTC"
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type ReceiverClient struct {
|
||||
client *resource.TypedClient[*Receiver, *ReceiverList]
|
||||
}
|
||||
|
||||
func NewReceiverClient(client resource.Client) *ReceiverClient {
|
||||
return &ReceiverClient{
|
||||
client: resource.NewTypedClient[*Receiver, *ReceiverList](client, ReceiverKind()),
|
||||
}
|
||||
}
|
||||
|
||||
func NewReceiverClientFromGenerator(generator resource.ClientGenerator) (*ReceiverClient, error) {
|
||||
c, err := generator.ClientFor(ReceiverKind())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewReceiverClient(c), nil
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) Get(ctx context.Context, identifier resource.Identifier) (*Receiver, error) {
|
||||
return c.client.Get(ctx, identifier)
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*ReceiverList, error) {
|
||||
return c.client.List(ctx, namespace, opts)
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*ReceiverList, error) {
|
||||
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for resp.GetContinue() != "" {
|
||||
page, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
Continue: resp.GetContinue(),
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.SetContinue(page.GetContinue())
|
||||
resp.SetResourceVersion(page.GetResourceVersion())
|
||||
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) Create(ctx context.Context, obj *Receiver, opts resource.CreateOptions) (*Receiver, error) {
|
||||
// Make sure apiVersion and kind are set
|
||||
obj.APIVersion = GroupVersion.Identifier()
|
||||
obj.Kind = ReceiverKind().Kind()
|
||||
return c.client.Create(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) Update(ctx context.Context, obj *Receiver, opts resource.UpdateOptions) (*Receiver, error) {
|
||||
return c.client.Update(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*Receiver, error) {
|
||||
return c.client.Patch(ctx, identifier, req, opts)
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus ReceiverStatus, opts resource.UpdateOptions) (*Receiver, error) {
|
||||
return c.client.Update(ctx, &Receiver{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: ReceiverKind().Kind(),
|
||||
APIVersion: GroupVersion.Identifier(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Namespace: identifier.Namespace,
|
||||
Name: identifier.Name,
|
||||
},
|
||||
Status: newStatus,
|
||||
}, resource.UpdateOptions{
|
||||
Subresource: "status",
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *ReceiverClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
|
||||
return c.client.Delete(ctx, identifier, opts)
|
||||
}
|
||||
+1
-13
@@ -5,25 +5,13 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaReceiver = resource.NewSimpleSchema("notifications.alerting.grafana.app", "v0alpha1", &Receiver{}, &ReceiverList{}, resource.WithKind("Receiver"),
|
||||
resource.WithPlural("receivers"), resource.WithScope(resource.NamespacedScope), resource.WithSelectableFields([]resource.SelectableField{{
|
||||
FieldSelector: "spec.title",
|
||||
FieldValueFunc: func(o resource.Object) (string, error) {
|
||||
cast, ok := o.(*Receiver)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("provided object must be of type *Receiver")
|
||||
}
|
||||
return cast.Spec.Title, nil
|
||||
},
|
||||
},
|
||||
}))
|
||||
resource.WithPlural("receivers"), resource.WithScope(resource.NamespacedScope))
|
||||
kindReceiver = resource.Kind{
|
||||
Schema: schemaReceiver,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type RoutingTreeClient struct {
|
||||
client *resource.TypedClient[*RoutingTree, *RoutingTreeList]
|
||||
}
|
||||
|
||||
func NewRoutingTreeClient(client resource.Client) *RoutingTreeClient {
|
||||
return &RoutingTreeClient{
|
||||
client: resource.NewTypedClient[*RoutingTree, *RoutingTreeList](client, RoutingTreeKind()),
|
||||
}
|
||||
}
|
||||
|
||||
func NewRoutingTreeClientFromGenerator(generator resource.ClientGenerator) (*RoutingTreeClient, error) {
|
||||
c, err := generator.ClientFor(RoutingTreeKind())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewRoutingTreeClient(c), nil
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) Get(ctx context.Context, identifier resource.Identifier) (*RoutingTree, error) {
|
||||
return c.client.Get(ctx, identifier)
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*RoutingTreeList, error) {
|
||||
return c.client.List(ctx, namespace, opts)
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*RoutingTreeList, error) {
|
||||
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for resp.GetContinue() != "" {
|
||||
page, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
Continue: resp.GetContinue(),
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.SetContinue(page.GetContinue())
|
||||
resp.SetResourceVersion(page.GetResourceVersion())
|
||||
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) Create(ctx context.Context, obj *RoutingTree, opts resource.CreateOptions) (*RoutingTree, error) {
|
||||
// Make sure apiVersion and kind are set
|
||||
obj.APIVersion = GroupVersion.Identifier()
|
||||
obj.Kind = RoutingTreeKind().Kind()
|
||||
return c.client.Create(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) Update(ctx context.Context, obj *RoutingTree, opts resource.UpdateOptions) (*RoutingTree, error) {
|
||||
return c.client.Update(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*RoutingTree, error) {
|
||||
return c.client.Patch(ctx, identifier, req, opts)
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus RoutingTreeStatus, opts resource.UpdateOptions) (*RoutingTree, error) {
|
||||
return c.client.Update(ctx, &RoutingTree{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: RoutingTreeKind().Kind(),
|
||||
APIVersion: GroupVersion.Identifier(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Namespace: identifier.Namespace,
|
||||
Name: identifier.Name,
|
||||
},
|
||||
Status: newStatus,
|
||||
}, resource.UpdateOptions{
|
||||
Subresource: "status",
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *RoutingTreeClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
|
||||
return c.client.Delete(ctx, identifier, opts)
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type TemplateGroupClient struct {
|
||||
client *resource.TypedClient[*TemplateGroup, *TemplateGroupList]
|
||||
}
|
||||
|
||||
func NewTemplateGroupClient(client resource.Client) *TemplateGroupClient {
|
||||
return &TemplateGroupClient{
|
||||
client: resource.NewTypedClient[*TemplateGroup, *TemplateGroupList](client, TemplateGroupKind()),
|
||||
}
|
||||
}
|
||||
|
||||
func NewTemplateGroupClientFromGenerator(generator resource.ClientGenerator) (*TemplateGroupClient, error) {
|
||||
c, err := generator.ClientFor(TemplateGroupKind())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewTemplateGroupClient(c), nil
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) Get(ctx context.Context, identifier resource.Identifier) (*TemplateGroup, error) {
|
||||
return c.client.Get(ctx, identifier)
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*TemplateGroupList, error) {
|
||||
return c.client.List(ctx, namespace, opts)
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*TemplateGroupList, error) {
|
||||
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for resp.GetContinue() != "" {
|
||||
page, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
Continue: resp.GetContinue(),
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.SetContinue(page.GetContinue())
|
||||
resp.SetResourceVersion(page.GetResourceVersion())
|
||||
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) Create(ctx context.Context, obj *TemplateGroup, opts resource.CreateOptions) (*TemplateGroup, error) {
|
||||
// Make sure apiVersion and kind are set
|
||||
obj.APIVersion = GroupVersion.Identifier()
|
||||
obj.Kind = TemplateGroupKind().Kind()
|
||||
return c.client.Create(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) Update(ctx context.Context, obj *TemplateGroup, opts resource.UpdateOptions) (*TemplateGroup, error) {
|
||||
return c.client.Update(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*TemplateGroup, error) {
|
||||
return c.client.Patch(ctx, identifier, req, opts)
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus TemplateGroupStatus, opts resource.UpdateOptions) (*TemplateGroup, error) {
|
||||
return c.client.Update(ctx, &TemplateGroup{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: TemplateGroupKind().Kind(),
|
||||
APIVersion: GroupVersion.Identifier(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Namespace: identifier.Namespace,
|
||||
Name: identifier.Name,
|
||||
},
|
||||
Status: newStatus,
|
||||
}, resource.UpdateOptions{
|
||||
Subresource: "status",
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *TemplateGroupClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
|
||||
return c.client.Delete(ctx, identifier, opts)
|
||||
}
|
||||
+1
-13
@@ -5,25 +5,13 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaTemplateGroup = resource.NewSimpleSchema("notifications.alerting.grafana.app", "v0alpha1", &TemplateGroup{}, &TemplateGroupList{}, resource.WithKind("TemplateGroup"),
|
||||
resource.WithPlural("templategroups"), resource.WithScope(resource.NamespacedScope), resource.WithSelectableFields([]resource.SelectableField{{
|
||||
FieldSelector: "spec.title",
|
||||
FieldValueFunc: func(o resource.Object) (string, error) {
|
||||
cast, ok := o.(*TemplateGroup)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("provided object must be of type *TemplateGroup")
|
||||
}
|
||||
return cast.Spec.Title, nil
|
||||
},
|
||||
},
|
||||
}))
|
||||
resource.WithPlural("templategroups"), resource.WithScope(resource.NamespacedScope))
|
||||
kindTemplateGroup = resource.Kind{
|
||||
Schema: schemaTemplateGroup,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type TimeIntervalClient struct {
|
||||
client *resource.TypedClient[*TimeInterval, *TimeIntervalList]
|
||||
}
|
||||
|
||||
func NewTimeIntervalClient(client resource.Client) *TimeIntervalClient {
|
||||
return &TimeIntervalClient{
|
||||
client: resource.NewTypedClient[*TimeInterval, *TimeIntervalList](client, TimeIntervalKind()),
|
||||
}
|
||||
}
|
||||
|
||||
func NewTimeIntervalClientFromGenerator(generator resource.ClientGenerator) (*TimeIntervalClient, error) {
|
||||
c, err := generator.ClientFor(TimeIntervalKind())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return NewTimeIntervalClient(c), nil
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) Get(ctx context.Context, identifier resource.Identifier) (*TimeInterval, error) {
|
||||
return c.client.Get(ctx, identifier)
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) List(ctx context.Context, namespace string, opts resource.ListOptions) (*TimeIntervalList, error) {
|
||||
return c.client.List(ctx, namespace, opts)
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) ListAll(ctx context.Context, namespace string, opts resource.ListOptions) (*TimeIntervalList, error) {
|
||||
resp, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for resp.GetContinue() != "" {
|
||||
page, err := c.client.List(ctx, namespace, resource.ListOptions{
|
||||
Continue: resp.GetContinue(),
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Limit: opts.Limit,
|
||||
LabelFilters: opts.LabelFilters,
|
||||
FieldSelectors: opts.FieldSelectors,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.SetContinue(page.GetContinue())
|
||||
resp.SetResourceVersion(page.GetResourceVersion())
|
||||
resp.SetItems(append(resp.GetItems(), page.GetItems()...))
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) Create(ctx context.Context, obj *TimeInterval, opts resource.CreateOptions) (*TimeInterval, error) {
|
||||
// Make sure apiVersion and kind are set
|
||||
obj.APIVersion = GroupVersion.Identifier()
|
||||
obj.Kind = TimeIntervalKind().Kind()
|
||||
return c.client.Create(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) Update(ctx context.Context, obj *TimeInterval, opts resource.UpdateOptions) (*TimeInterval, error) {
|
||||
return c.client.Update(ctx, obj, opts)
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) Patch(ctx context.Context, identifier resource.Identifier, req resource.PatchRequest, opts resource.PatchOptions) (*TimeInterval, error) {
|
||||
return c.client.Patch(ctx, identifier, req, opts)
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) UpdateStatus(ctx context.Context, identifier resource.Identifier, newStatus TimeIntervalStatus, opts resource.UpdateOptions) (*TimeInterval, error) {
|
||||
return c.client.Update(ctx, &TimeInterval{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: TimeIntervalKind().Kind(),
|
||||
APIVersion: GroupVersion.Identifier(),
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
Namespace: identifier.Namespace,
|
||||
Name: identifier.Name,
|
||||
},
|
||||
Status: newStatus,
|
||||
}, resource.UpdateOptions{
|
||||
Subresource: "status",
|
||||
ResourceVersion: opts.ResourceVersion,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *TimeIntervalClient) Delete(ctx context.Context, identifier resource.Identifier, opts resource.DeleteOptions) error {
|
||||
return c.client.Delete(ctx, identifier, opts)
|
||||
}
|
||||
+1
-13
@@ -5,25 +5,13 @@
|
||||
package v0alpha1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
)
|
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var (
|
||||
schemaTimeInterval = resource.NewSimpleSchema("notifications.alerting.grafana.app", "v0alpha1", &TimeInterval{}, &TimeIntervalList{}, resource.WithKind("TimeInterval"),
|
||||
resource.WithPlural("timeintervals"), resource.WithScope(resource.NamespacedScope), resource.WithSelectableFields([]resource.SelectableField{{
|
||||
FieldSelector: "spec.name",
|
||||
FieldValueFunc: func(o resource.Object) (string, error) {
|
||||
cast, ok := o.(*TimeInterval)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("provided object must be of type *TimeInterval")
|
||||
}
|
||||
return cast.Spec.Name, nil
|
||||
},
|
||||
},
|
||||
}))
|
||||
resource.WithPlural("timeintervals"), resource.WithScope(resource.NamespacedScope))
|
||||
kindTimeInterval = resource.Kind{
|
||||
Schema: schemaTimeInterval,
|
||||
Codecs: map[resource.KindEncoding]resource.Codec{
|
||||
+92
-92
@@ -12,36 +12,36 @@ import (
|
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
|
||||
return map[string]common.OpenAPIDefinition{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.Receiver": schema_pkg_apis_alerting_v0alpha1_Receiver(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverIntegration": schema_pkg_apis_alerting_v0alpha1_ReceiverIntegration(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverList": schema_pkg_apis_alerting_v0alpha1_ReceiverList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverSpec": schema_pkg_apis_alerting_v0alpha1_ReceiverSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverStatus": schema_pkg_apis_alerting_v0alpha1_ReceiverStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverstatusOperatorState": schema_pkg_apis_alerting_v0alpha1_ReceiverstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTree": schema_pkg_apis_alerting_v0alpha1_RoutingTree(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeList": schema_pkg_apis_alerting_v0alpha1_RoutingTreeList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeMatcher": schema_pkg_apis_alerting_v0alpha1_RoutingTreeMatcher(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRoute": schema_pkg_apis_alerting_v0alpha1_RoutingTreeRoute(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRouteDefaults": schema_pkg_apis_alerting_v0alpha1_RoutingTreeRouteDefaults(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeSpec": schema_pkg_apis_alerting_v0alpha1_RoutingTreeSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeStatus": schema_pkg_apis_alerting_v0alpha1_RoutingTreeStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreestatusOperatorState": schema_pkg_apis_alerting_v0alpha1_RoutingTreestatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroup": schema_pkg_apis_alerting_v0alpha1_TemplateGroup(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupList": schema_pkg_apis_alerting_v0alpha1_TemplateGroupList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupSpec": schema_pkg_apis_alerting_v0alpha1_TemplateGroupSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupStatus": schema_pkg_apis_alerting_v0alpha1_TemplateGroupStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupstatusOperatorState": schema_pkg_apis_alerting_v0alpha1_TemplateGroupstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeInterval": schema_pkg_apis_alerting_v0alpha1_TimeInterval(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalInterval": schema_pkg_apis_alerting_v0alpha1_TimeIntervalInterval(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalList": schema_pkg_apis_alerting_v0alpha1_TimeIntervalList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalSpec": schema_pkg_apis_alerting_v0alpha1_TimeIntervalSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalStatus": schema_pkg_apis_alerting_v0alpha1_TimeIntervalStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalTimeRange": schema_pkg_apis_alerting_v0alpha1_TimeIntervalTimeRange(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalstatusOperatorState": schema_pkg_apis_alerting_v0alpha1_TimeIntervalstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.Receiver": schema_pkg_apis_alertingnotifications_v0alpha1_Receiver(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverIntegration": schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverIntegration(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverList": schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverSpec": schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverStatus": schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverstatusOperatorState": schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTree": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTree(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeList": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeMatcher": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeMatcher(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRoute": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeRoute(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRouteDefaults": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeRouteDefaults(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeSpec": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeStatus": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreestatusOperatorState": schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreestatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroup": schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroup(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupList": schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupSpec": schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupStatus": schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupstatusOperatorState": schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupstatusOperatorState(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeInterval": schema_pkg_apis_alertingnotifications_v0alpha1_TimeInterval(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalInterval": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalInterval(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalList": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalList(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalSpec": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalSpec(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalStatus": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalStatus(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalTimeRange": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalTimeRange(ref),
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalstatusOperatorState": schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalstatusOperatorState(ref),
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_Receiver(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_Receiver(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -71,13 +71,13 @@ func schema_pkg_apis_alerting_v0alpha1_Receiver(ref common.ReferenceCallback) co
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec is the spec of the Receiver",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverSpec"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverStatus"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -85,11 +85,11 @@ func schema_pkg_apis_alerting_v0alpha1_Receiver(ref common.ReferenceCallback) co
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_ReceiverIntegration(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverIntegration(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -157,7 +157,7 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverIntegration(ref common.ReferenceC
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_ReceiverList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -190,7 +190,7 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverList(ref common.ReferenceCallback
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.Receiver"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.Receiver"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -201,11 +201,11 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverList(ref common.ReferenceCallback
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.Receiver", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.Receiver", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_ReceiverSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -225,7 +225,7 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverSpec(ref common.ReferenceCallback
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverIntegration"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverIntegration"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -236,11 +236,11 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverSpec(ref common.ReferenceCallback
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverIntegration"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverIntegration"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_ReceiverStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -255,7 +255,7 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverStatus(ref common.ReferenceCallba
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverstatusOperatorState"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverstatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -280,11 +280,11 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverStatus(ref common.ReferenceCallba
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.ReceiverstatusOperatorState"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.ReceiverstatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_ReceiverstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_ReceiverstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -335,7 +335,7 @@ func schema_pkg_apis_alerting_v0alpha1_ReceiverstatusOperatorState(ref common.Re
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTree(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTree(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -365,13 +365,13 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTree(ref common.ReferenceCallback)
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec is the spec of the RoutingTree",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeSpec"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeStatus"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -379,11 +379,11 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTree(ref common.ReferenceCallback)
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -416,7 +416,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeList(ref common.ReferenceCallb
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTree"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTree"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -427,11 +427,11 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeList(ref common.ReferenceCallb
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTree", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTree", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeMatcher(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeMatcher(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -465,7 +465,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeMatcher(ref common.ReferenceCa
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRoute(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeRoute(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -484,7 +484,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRoute(ref common.ReferenceCall
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeMatcher"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeMatcher"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -546,7 +546,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRoute(ref common.ReferenceCall
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRoute"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRoute"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -575,11 +575,11 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRoute(ref common.ReferenceCall
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeMatcher", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRoute"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeMatcher", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRoute"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRouteDefaults(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeRouteDefaults(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -631,7 +631,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeRouteDefaults(ref common.Refer
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -640,7 +640,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeSpec(ref common.ReferenceCallb
|
||||
"defaults": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRouteDefaults"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRouteDefaults"),
|
||||
},
|
||||
},
|
||||
"routes": {
|
||||
@@ -650,7 +650,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeSpec(ref common.ReferenceCallb
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRoute"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRoute"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -661,11 +661,11 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeSpec(ref common.ReferenceCallb
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRoute", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreeRouteDefaults"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRoute", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreeRouteDefaults"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreeStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -680,7 +680,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeStatus(ref common.ReferenceCal
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreestatusOperatorState"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreestatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -705,11 +705,11 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreeStatus(ref common.ReferenceCal
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.RoutingTreestatusOperatorState"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.RoutingTreestatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_RoutingTreestatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_RoutingTreestatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -760,7 +760,7 @@ func schema_pkg_apis_alerting_v0alpha1_RoutingTreestatusOperatorState(ref common
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TemplateGroup(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroup(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -790,13 +790,13 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroup(ref common.ReferenceCallbac
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec is the spec of the TemplateGroup",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupSpec"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupStatus"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -804,11 +804,11 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroup(ref common.ReferenceCallbac
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TemplateGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -841,7 +841,7 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupList(ref common.ReferenceCal
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroup"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroup"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -852,11 +852,11 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupList(ref common.ReferenceCal
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroup", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroup", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TemplateGroupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -883,7 +883,7 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupSpec(ref common.ReferenceCal
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TemplateGroupStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -898,7 +898,7 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupStatus(ref common.ReferenceC
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupstatusOperatorState"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupstatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -923,11 +923,11 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupStatus(ref common.ReferenceC
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TemplateGroupstatusOperatorState"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TemplateGroupstatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TemplateGroupstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TemplateGroupstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -978,7 +978,7 @@ func schema_pkg_apis_alerting_v0alpha1_TemplateGroupstatusOperatorState(ref comm
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeInterval(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeInterval(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1008,13 +1008,13 @@ func schema_pkg_apis_alerting_v0alpha1_TimeInterval(ref common.ReferenceCallback
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec is the spec of the TimeInterval",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalSpec"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalSpec"),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalStatus"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalStatus"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1022,11 +1022,11 @@ func schema_pkg_apis_alerting_v0alpha1_TimeInterval(ref common.ReferenceCallback
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalSpec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalInterval(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalInterval(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1039,7 +1039,7 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalInterval(ref common.Reference
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalTimeRange"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalTimeRange"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1111,11 +1111,11 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalInterval(ref common.Reference
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalTimeRange"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalTimeRange"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1148,7 +1148,7 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalList(ref common.ReferenceCall
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeInterval"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeInterval"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1159,11 +1159,11 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalList(ref common.ReferenceCall
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeInterval", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeInterval", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1183,7 +1183,7 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalSpec(ref common.ReferenceCall
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalInterval"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalInterval"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1194,11 +1194,11 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalSpec(ref common.ReferenceCall
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalInterval"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalInterval"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1213,7 +1213,7 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalStatus(ref common.ReferenceCa
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalstatusOperatorState"),
|
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalstatusOperatorState"),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -1238,11 +1238,11 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalStatus(ref common.ReferenceCa
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1.TimeIntervalstatusOperatorState"},
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1.TimeIntervalstatusOperatorState"},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalTimeRange(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalTimeRange(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -1269,7 +1269,7 @@ func schema_pkg_apis_alerting_v0alpha1_TimeIntervalTimeRange(ref common.Referenc
|
||||
}
|
||||
}
|
||||
|
||||
func schema_pkg_apis_alerting_v0alpha1_TimeIntervalstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
func schema_pkg_apis_alertingnotifications_v0alpha1_TimeIntervalstatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@@ -0,0 +1,157 @@
|
||||
//
|
||||
// This file is generated by grafana-app-sdk
|
||||
// DO NOT EDIT
|
||||
//
|
||||
|
||||
package apis
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
"github.com/grafana/grafana-app-sdk/resource"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kube-openapi/pkg/spec3"
|
||||
|
||||
v0alpha1 "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
)
|
||||
|
||||
var (
|
||||
rawSchemaReceiverv0alpha1 = []byte(`{"Integration":{"additionalProperties":false,"properties":{"disableResolveMessage":{"type":"boolean"},"secureFields":{"additionalProperties":{"type":"boolean"},"type":"object"},"settings":{"additionalProperties":{"additionalProperties":{},"type":"object"},"type":"object"},"type":{"type":"string"},"uid":{"type":"string"},"version":{"type":"string"}},"required":["type","version","settings"],"type":"object"},"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"Receiver":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"spec":{"additionalProperties":false,"properties":{"integrations":{"items":{"$ref":"#/components/schemas/Integration"},"type":"array"},"title":{"type":"string"}},"required":["title","integrations"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`)
|
||||
versionSchemaReceiverv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaReceiverv0alpha1, &versionSchemaReceiverv0alpha1)
|
||||
rawSchemaRoutingTreev0alpha1 = []byte(`{"Matcher":{"additionalProperties":false,"properties":{"label":{"type":"string"},"type":{"enum":["=","!=","=~","!~"],"type":"string"},"value":{"type":"string"}},"required":["type","label","value"],"type":"object"},"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"Route":{"additionalProperties":false,"properties":{"active_time_intervals":{"items":{"type":"string"},"type":"array"},"continue":{"type":"boolean"},"group_by":{"items":{"type":"string"},"type":"array"},"group_interval":{"type":"string"},"group_wait":{"type":"string"},"matchers":{"items":{"$ref":"#/components/schemas/Matcher"},"type":"array"},"mute_time_intervals":{"items":{"type":"string"},"type":"array"},"receiver":{"type":"string"},"repeat_interval":{"type":"string"},"routes":{"items":{"$ref":"#/components/schemas/Route"},"type":"array"}},"required":["continue"],"type":"object"},"RouteDefaults":{"additionalProperties":false,"properties":{"group_by":{"items":{"type":"string"},"type":"array"},"group_interval":{"type":"string"},"group_wait":{"type":"string"},"receiver":{"type":"string"},"repeat_interval":{"type":"string"}},"required":["receiver"],"type":"object"},"RoutingTree":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"spec":{"additionalProperties":false,"properties":{"defaults":{"$ref":"#/components/schemas/RouteDefaults"},"routes":{"items":{"$ref":"#/components/schemas/Route"},"type":"array"}},"required":["defaults","routes"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`)
|
||||
versionSchemaRoutingTreev0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaRoutingTreev0alpha1, &versionSchemaRoutingTreev0alpha1)
|
||||
rawSchemaTemplateGroupv0alpha1 = []byte(`{"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"TemplateGroup":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"spec":{"additionalProperties":false,"properties":{"content":{"type":"string"},"title":{"type":"string"}},"required":["title","content"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`)
|
||||
versionSchemaTemplateGroupv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaTemplateGroupv0alpha1, &versionSchemaTemplateGroupv0alpha1)
|
||||
rawSchemaTimeIntervalv0alpha1 = []byte(`{"Interval":{"additionalProperties":false,"properties":{"days_of_month":{"items":{"type":"string"},"type":"array"},"location":{"type":"string"},"months":{"items":{"type":"string"},"type":"array"},"times":{"items":{"$ref":"#/components/schemas/TimeRange"},"type":"array"},"weekdays":{"items":{"type":"string"},"type":"array"},"years":{"items":{"type":"string"},"type":"array"}},"type":"object"},"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"TimeInterval":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"TimeRange":{"additionalProperties":false,"properties":{"end_time":{"type":"string"},"start_time":{"type":"string"}},"required":["start_time","end_time"],"type":"object"},"spec":{"additionalProperties":false,"properties":{"name":{"type":"string"},"time_intervals":{"items":{"$ref":"#/components/schemas/Interval"},"type":"array"}},"required":["name","time_intervals"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`)
|
||||
versionSchemaTimeIntervalv0alpha1 app.VersionSchema
|
||||
_ = json.Unmarshal(rawSchemaTimeIntervalv0alpha1, &versionSchemaTimeIntervalv0alpha1)
|
||||
)
|
||||
|
||||
var appManifestData = app.ManifestData{
|
||||
AppName: "alerting-notifications",
|
||||
Group: "notifications.alerting.grafana.app",
|
||||
Versions: []app.ManifestVersion{
|
||||
{
|
||||
Name: "v0alpha1",
|
||||
Served: true,
|
||||
Kinds: []app.ManifestVersionKind{
|
||||
{
|
||||
Kind: "Receiver",
|
||||
Plural: "Receivers",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Schema: &versionSchemaReceiverv0alpha1,
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "RoutingTree",
|
||||
Plural: "RoutingTrees",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Schema: &versionSchemaRoutingTreev0alpha1,
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "TemplateGroup",
|
||||
Plural: "TemplateGroups",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Schema: &versionSchemaTemplateGroupv0alpha1,
|
||||
},
|
||||
|
||||
{
|
||||
Kind: "TimeInterval",
|
||||
Plural: "TimeIntervals",
|
||||
Scope: "Namespaced",
|
||||
Conversion: false,
|
||||
Schema: &versionSchemaTimeIntervalv0alpha1,
|
||||
},
|
||||
},
|
||||
Routes: app.ManifestVersionRoutes{
|
||||
Namespaced: map[string]spec3.PathProps{},
|
||||
Cluster: map[string]spec3.PathProps{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func LocalManifest() app.Manifest {
|
||||
return app.NewEmbeddedManifest(appManifestData)
|
||||
}
|
||||
|
||||
func RemoteManifest() app.Manifest {
|
||||
return app.NewAPIServerManifest("alerting-notifications")
|
||||
}
|
||||
|
||||
var kindVersionToGoType = map[string]resource.Kind{
|
||||
"Receiver/v0alpha1": v0alpha1.ReceiverKind(),
|
||||
"RoutingTree/v0alpha1": v0alpha1.RoutingTreeKind(),
|
||||
"TemplateGroup/v0alpha1": v0alpha1.TemplateGroupKind(),
|
||||
"TimeInterval/v0alpha1": v0alpha1.TimeIntervalKind(),
|
||||
}
|
||||
|
||||
// ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists.
|
||||
// If there is no association for the provided Kind and Version, exists will return false.
|
||||
func ManifestGoTypeAssociator(kind, version string) (goType resource.Kind, exists bool) {
|
||||
goType, exists = kindVersionToGoType[fmt.Sprintf("%s/%s", kind, version)]
|
||||
return goType, exists
|
||||
}
|
||||
|
||||
var customRouteToGoResponseType = map[string]any{}
|
||||
|
||||
// ManifestCustomRouteResponsesAssociator returns the associated response go type for a given kind, version, custom route path, and method, if one exists.
|
||||
// kind may be empty for custom routes which are not kind subroutes. Leading slashes are removed from subroute paths.
|
||||
// If there is no association for the provided kind, version, custom route path, and method, exists will return false.
|
||||
// Resource routes (those without a kind) should prefix their route with "<namespace>/" if the route is namespaced (otherwise the route is assumed to be cluster-scope)
|
||||
func ManifestCustomRouteResponsesAssociator(kind, version, path, verb string) (goType any, exists bool) {
|
||||
if len(path) > 0 && path[0] == '/' {
|
||||
path = path[1:]
|
||||
}
|
||||
goType, exists = customRouteToGoResponseType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
|
||||
return goType, exists
|
||||
}
|
||||
|
||||
var customRouteToGoParamsType = map[string]runtime.Object{}
|
||||
|
||||
func ManifestCustomRouteQueryAssociator(kind, version, path, verb string) (goType runtime.Object, exists bool) {
|
||||
if len(path) > 0 && path[0] == '/' {
|
||||
path = path[1:]
|
||||
}
|
||||
goType, exists = customRouteToGoParamsType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
|
||||
return goType, exists
|
||||
}
|
||||
|
||||
var customRouteToGoRequestBodyType = map[string]any{}
|
||||
|
||||
func ManifestCustomRouteRequestBodyAssociator(kind, version, path, verb string) (goType any, exists bool) {
|
||||
if len(path) > 0 && path[0] == '/' {
|
||||
path = path[1:]
|
||||
}
|
||||
goType, exists = customRouteToGoRequestBodyType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
|
||||
return goType, exists
|
||||
}
|
||||
|
||||
type GoTypeAssociator struct{}
|
||||
|
||||
func NewGoTypeAssociator() *GoTypeAssociator {
|
||||
return &GoTypeAssociator{}
|
||||
}
|
||||
|
||||
func (g *GoTypeAssociator) KindToGoType(kind, version string) (goType resource.Kind, exists bool) {
|
||||
return ManifestGoTypeAssociator(kind, version)
|
||||
}
|
||||
func (g *GoTypeAssociator) CustomRouteReturnGoType(kind, version, path, verb string) (goType any, exists bool) {
|
||||
return ManifestCustomRouteResponsesAssociator(kind, version, path, verb)
|
||||
}
|
||||
func (g *GoTypeAssociator) CustomRouteQueryGoType(kind, version, path, verb string) (goType runtime.Object, exists bool) {
|
||||
return ManifestCustomRouteQueryAssociator(kind, version, path, verb)
|
||||
}
|
||||
func (g *GoTypeAssociator) CustomRouteRequestBodyGoType(kind, version, path, verb string) (goType any, exists bool) {
|
||||
return ManifestCustomRouteRequestBodyAssociator(kind, version, path, verb)
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
sdkResource "github.com/grafana/grafana-app-sdk/resource"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
)
|
||||
|
||||
func GetKinds() map[schema.GroupVersion][]sdkResource.Kind {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
gapiutil "github.com/grafana/grafana/pkg/services/apiserver/utils"
|
||||
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity"
|
||||
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,21 +4,21 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana-app-sdk/app"
|
||||
appsdkapiserver "github.com/grafana/grafana-app-sdk/k8s/apiserver"
|
||||
"github.com/grafana/grafana-app-sdk/simple"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apiserver/pkg/authorization/authorizer"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
|
||||
notificationsResource "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis"
|
||||
notificationsApp "github.com/grafana/grafana/apps/alerting/notifications/pkg/app"
|
||||
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/receiver"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/routingtree"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/templategroup"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/timeinterval"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/builder/runner"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/appinstaller"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert"
|
||||
ac "github.com/grafana/grafana/pkg/services/ngalert/accesscontrol"
|
||||
@@ -26,31 +26,53 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type AlertingNotificationsAppProvider struct {
|
||||
app.Provider
|
||||
var (
|
||||
_ appsdkapiserver.AppInstaller = (*AlertingNotificationsAppInstaller)(nil)
|
||||
_ appinstaller.LegacyStorageProvider = (*AlertingNotificationsAppInstaller)(nil)
|
||||
_ appinstaller.AuthorizerProvider = (*AlertingNotificationsAppInstaller)(nil)
|
||||
)
|
||||
|
||||
type AlertingNotificationsAppInstaller struct {
|
||||
appsdkapiserver.AppInstaller
|
||||
cfg *setting.Cfg
|
||||
ng *ngalert.AlertNG
|
||||
}
|
||||
|
||||
func RegisterApp(
|
||||
func RegisterAppInstaller(
|
||||
cfg *setting.Cfg,
|
||||
ng *ngalert.AlertNG,
|
||||
) *AlertingNotificationsAppProvider {
|
||||
) (*AlertingNotificationsAppInstaller, error) {
|
||||
if ng.IsDisabled() {
|
||||
return nil
|
||||
}
|
||||
appCfg := &runner.AppBuilderConfig{
|
||||
Authorizer: getAuthorizer(ng.Api.AccessControl),
|
||||
LegacyStorageGetter: getLegacyStorage(request.GetNamespaceMapper(cfg), ng),
|
||||
OpenAPIDefGetter: v0alpha1.GetOpenAPIDefinitions,
|
||||
ManagedKinds: notificationsResource.GetKinds(),
|
||||
AllowedV0Alpha1Resources: []string{builder.AllResourcesAllowed},
|
||||
log.New("app-registry").Info("Skipping Kubernetes Alerting Notifications API server (notifications.alerting.grafana.app): Unified Alerting is disabled")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return &AlertingNotificationsAppProvider{
|
||||
Provider: simple.NewAppProvider(notificationsResource.LocalManifest(), appCfg, notificationsApp.New),
|
||||
installer := &AlertingNotificationsAppInstaller{
|
||||
cfg: cfg,
|
||||
ng: ng,
|
||||
}
|
||||
|
||||
localManifest := apis.LocalManifest()
|
||||
|
||||
provider := simple.NewAppProvider(localManifest, nil, notificationsApp.New)
|
||||
|
||||
appConfig := app.Config{
|
||||
KubeConfig: restclient.Config{}, // this will be overridden by the installer's InitializeApp method
|
||||
ManifestData: *localManifest.ManifestData,
|
||||
SpecificConfig: nil,
|
||||
}
|
||||
|
||||
i, err := appsdkapiserver.NewDefaultAppInstaller(provider, appConfig, &apis.GoTypeAssociator{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
installer.AppInstaller = i
|
||||
|
||||
return installer, nil
|
||||
}
|
||||
|
||||
func getAuthorizer(authz accesscontrol.AccessControl) authorizer.Authorizer {
|
||||
func (a AlertingNotificationsAppInstaller) GetAuthorizer() authorizer.Authorizer {
|
||||
authz := a.ng.Api.AccessControl
|
||||
return authorizer.AuthorizerFunc(
|
||||
func(ctx context.Context, a authorizer.Attributes) (authorizer.Decision, string, error) {
|
||||
switch a.GetResource() {
|
||||
@@ -67,17 +89,17 @@ func getAuthorizer(authz accesscontrol.AccessControl) authorizer.Authorizer {
|
||||
})
|
||||
}
|
||||
|
||||
func getLegacyStorage(namespacer request.NamespaceMapper, ng *ngalert.AlertNG) runner.LegacyStorageGetter {
|
||||
return func(gvr schema.GroupVersionResource) grafanarest.Storage {
|
||||
if gvr == receiver.ResourceInfo.GroupVersionResource() {
|
||||
return receiver.NewStorage(ng.Api.ReceiverService, namespacer, ng.Api.ReceiverService)
|
||||
} else if gvr == timeinterval.ResourceInfo.GroupVersionResource() {
|
||||
return timeinterval.NewStorage(ng.Api.MuteTimings, namespacer)
|
||||
} else if gvr == templategroup.ResourceInfo.GroupVersionResource() {
|
||||
return templategroup.NewStorage(ng.Api.Templates, namespacer)
|
||||
} else if gvr == routingtree.ResourceInfo.GroupVersionResource() {
|
||||
return routingtree.NewStorage(ng.Api.Policies, namespacer)
|
||||
}
|
||||
panic("unknown legacy storage requested: " + gvr.String())
|
||||
func (a AlertingNotificationsAppInstaller) GetLegacyStorage(gvr schema.GroupVersionResource) grafanarest.Storage {
|
||||
namespacer := request.GetNamespaceMapper(a.cfg)
|
||||
api := a.ng.Api
|
||||
if gvr == receiver.ResourceInfo.GroupVersionResource() {
|
||||
return receiver.NewStorage(api.ReceiverService, namespacer, api.ReceiverService)
|
||||
} else if gvr == timeinterval.ResourceInfo.GroupVersionResource() {
|
||||
return timeinterval.NewStorage(api.MuteTimings, namespacer)
|
||||
} else if gvr == templategroup.ResourceInfo.GroupVersionResource() {
|
||||
return templategroup.NewStorage(api.Templates, namespacer)
|
||||
} else if gvr == routingtree.ResourceInfo.GroupVersionResource() {
|
||||
return routingtree.NewStorage(api.Policies, namespacer)
|
||||
}
|
||||
panic("unknown legacy storage requested: " + gvr.String())
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
promModel "github.com/prometheus/common/model"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
gapiutil "github.com/grafana/grafana/pkg/services/apiserver/utils"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
gapiutil "github.com/grafana/grafana/pkg/services/apiserver/utils"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/grafana/alerting/templates"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/fields"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
gapiutil "github.com/grafana/grafana/pkg/services/apiserver/utils"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
grafanarest "github.com/grafana/grafana/pkg/apiserver/rest"
|
||||
"github.com/grafana/grafana/pkg/services/apiserver/endpoints/request"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
model "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/apimachinery/utils"
|
||||
)
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ func ProvideAppInstallers(
|
||||
shorturlAppInstaller *shorturl.ShortURLAppInstaller,
|
||||
rulesAppInstaller *rules.AlertingRulesAppInstaller,
|
||||
correlationsAppInstaller *correlations.CorrelationsAppInstaller,
|
||||
alertingNotificationAppInstaller *notifications.AlertingNotificationsAppInstaller,
|
||||
) []appsdkapiserver.AppInstaller {
|
||||
installers := []appsdkapiserver.AppInstaller{
|
||||
playlistAppInstaller,
|
||||
@@ -49,6 +50,9 @@ func ProvideAppInstallers(
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagKubernetesCorrelations) {
|
||||
installers = append(installers, correlationsAppInstaller)
|
||||
}
|
||||
if alertingNotificationAppInstaller != nil {
|
||||
installers = append(installers, alertingNotificationAppInstaller)
|
||||
}
|
||||
return installers
|
||||
}
|
||||
|
||||
@@ -69,7 +73,6 @@ func ProvideBuilderRunners(
|
||||
features featuremgmt.FeatureToggles,
|
||||
investigationAppProvider *investigations.InvestigationsAppProvider,
|
||||
advisorAppProvider *advisor.AdvisorAppProvider,
|
||||
alertingNotificationsAppProvider *notifications.AlertingNotificationsAppProvider,
|
||||
grafanaCfg *setting.Cfg,
|
||||
) (*Service, error) {
|
||||
cfgWrapper := func(ctx context.Context) (*rest.Config, error) {
|
||||
@@ -97,9 +100,6 @@ func ProvideBuilderRunners(
|
||||
!slices.Contains(grafanaCfg.DisablePlugins, "grafana-advisor-app") {
|
||||
providers = append(providers, advisorAppProvider)
|
||||
}
|
||||
if alertingNotificationsAppProvider != nil {
|
||||
providers = append(providers, alertingNotificationsAppProvider)
|
||||
}
|
||||
apiGroupRunner, err = runner.NewAPIGroupRunner(cfg, providers...)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/rules"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/correlations"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/playlist"
|
||||
@@ -17,6 +18,7 @@ func TestProvideAppInstallers_Table(t *testing.T) {
|
||||
pluginsInstaller := &plugins.PluginsAppInstaller{}
|
||||
rulesInstaller := &rules.AlertingRulesAppInstaller{}
|
||||
correlationsAppInstaller := &correlations.CorrelationsAppInstaller{}
|
||||
notificationsAppInstaller := ¬ifications.AlertingNotificationsAppInstaller{}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -33,7 +35,7 @@ func TestProvideAppInstallers_Table(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
features := featuremgmt.WithFeatures(tt.flags...)
|
||||
got := ProvideAppInstallers(features, playlistInstaller, pluginsInstaller, nil, tt.rulesInst, correlationsAppInstaller)
|
||||
got := ProvideAppInstallers(features, playlistInstaller, pluginsInstaller, nil, tt.rulesInst, correlationsAppInstaller, notificationsAppInstaller)
|
||||
if tt.expectRulesApp {
|
||||
require.Contains(t, got, tt.rulesInst)
|
||||
} else {
|
||||
|
||||
@@ -19,9 +19,9 @@ var WireSet = wire.NewSet(
|
||||
playlist.RegisterAppInstaller,
|
||||
investigations.RegisterApp,
|
||||
advisor.RegisterApp,
|
||||
notifications.RegisterApp,
|
||||
plugins.RegisterAppInstaller,
|
||||
shorturl.RegisterAppInstaller,
|
||||
correlations.RegisterAppInstaller,
|
||||
rules.RegisterAppInstaller,
|
||||
notifications.RegisterAppInstaller,
|
||||
)
|
||||
|
||||
+12
-6
@@ -768,7 +768,11 @@ func Initialize(ctx context.Context, cfg *setting.Cfg, opts Options, apiOpts api
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v2 := appregistry.ProvideAppInstallers(featureToggles, playlistAppInstaller, pluginsAppInstaller, shortURLAppInstaller, alertingRulesAppInstaller, correlationsAppInstaller)
|
||||
alertingNotificationsAppInstaller, err := notifications2.RegisterAppInstaller(cfg, alertNG)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v2 := appregistry.ProvideAppInstallers(featureToggles, playlistAppInstaller, pluginsAppInstaller, shortURLAppInstaller, alertingRulesAppInstaller, correlationsAppInstaller, alertingNotificationsAppInstaller)
|
||||
builderMetrics := builder.ProvideBuilderMetrics(registerer)
|
||||
apiserverService, err := apiserver.ProvideService(cfg, featureToggles, routeRegisterImpl, tracingService, serverLockService, sqlStore, kvStore, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, pluginstoreService, dualwriteService, resourceClient, inlineSecureValueSupport, eventualRestConfigProvider, v, eventualRestConfigProvider, registerer, aggregatorRunner, v2, builderMetrics)
|
||||
if err != nil {
|
||||
@@ -786,8 +790,7 @@ func Initialize(ctx context.Context, cfg *setting.Cfg, opts Options, apiOpts api
|
||||
investigationsAppProvider := investigations.RegisterApp(cfg)
|
||||
checkregistryService := checkregistry.ProvideService(service15, pluginstoreService, plugincontextProvider, middlewareHandler, plugincheckerService, repoManager, preinstallImpl, managedpluginsNoop, noop, ssosettingsimplService, cfg, pluginerrsStore)
|
||||
advisorAppProvider := advisor2.RegisterApp(checkregistryService, cfg)
|
||||
alertingNotificationsAppProvider := notifications2.RegisterApp(cfg, alertNG)
|
||||
appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, investigationsAppProvider, advisorAppProvider, alertingNotificationsAppProvider, cfg)
|
||||
appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, investigationsAppProvider, advisorAppProvider, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1373,7 +1376,11 @@ func InitializeForTest(ctx context.Context, t sqlutil.ITestDB, testingT interfac
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v2 := appregistry.ProvideAppInstallers(featureToggles, playlistAppInstaller, pluginsAppInstaller, shortURLAppInstaller, alertingRulesAppInstaller, correlationsAppInstaller)
|
||||
alertingNotificationsAppInstaller, err := notifications2.RegisterAppInstaller(cfg, alertNG)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v2 := appregistry.ProvideAppInstallers(featureToggles, playlistAppInstaller, pluginsAppInstaller, shortURLAppInstaller, alertingRulesAppInstaller, correlationsAppInstaller, alertingNotificationsAppInstaller)
|
||||
builderMetrics := builder.ProvideBuilderMetrics(registerer)
|
||||
apiserverService, err := apiserver.ProvideService(cfg, featureToggles, routeRegisterImpl, tracingService, serverLockService, sqlStore, kvStore, middlewareHandler, scopedPluginDatasourceProvider, plugincontextProvider, pluginstoreService, dualwriteService, resourceClient, inlineSecureValueSupport, eventualRestConfigProvider, v, eventualRestConfigProvider, registerer, aggregatorRunner, v2, builderMetrics)
|
||||
if err != nil {
|
||||
@@ -1391,8 +1398,7 @@ func InitializeForTest(ctx context.Context, t sqlutil.ITestDB, testingT interfac
|
||||
investigationsAppProvider := investigations.RegisterApp(cfg)
|
||||
checkregistryService := checkregistry.ProvideService(service15, pluginstoreService, plugincontextProvider, middlewareHandler, plugincheckerService, repoManager, preinstallImpl, managedpluginsNoop, noop, ssosettingsimplService, cfg, pluginerrsStore)
|
||||
advisorAppProvider := advisor2.RegisterApp(checkregistryService, cfg)
|
||||
alertingNotificationsAppProvider := notifications2.RegisterApp(cfg, alertNG)
|
||||
appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, investigationsAppProvider, advisorAppProvider, alertingNotificationsAppProvider, cfg)
|
||||
appregistryService, err := appregistry.ProvideBuilderRunners(apiserverService, eventualRestConfigProvider, featureToggles, investigationsAppProvider, advisorAppProvider, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/client-go/dynamic"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
)
|
||||
|
||||
func NewReceiverClient(t *testing.T, user apis.User) *apis.TypedClient[v0alpha1.Receiver, v0alpha1.ReceiverList] {
|
||||
|
||||
@@ -21,7 +21,8 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/grafana/alerting/notify"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
common "github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
@@ -1413,6 +1414,7 @@ func TestIntegrationReceiverListSelector(t *testing.T) {
|
||||
require.Len(t, receivers.Items, 3) // Includes default.
|
||||
|
||||
t.Run("should filter by receiver name", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: "spec.title=" + recv1.Spec.Title,
|
||||
})
|
||||
@@ -1431,6 +1433,7 @@ func TestIntegrationReceiverListSelector(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should filter by multiple filters", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: fmt.Sprintf("metadata.name=%s,spec.title=%s", recv2.Name, recv2.Spec.Title),
|
||||
})
|
||||
|
||||
@@ -16,10 +16,10 @@ import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/routingtree"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1/fakes"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1/fakes"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
@@ -600,6 +600,7 @@ func TestIntegrationListSelector(t *testing.T) {
|
||||
require.Len(t, tmpls.Items, 3) // Includes default template.
|
||||
|
||||
t.Run("should filter by template name", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: "spec.title=" + template1.Spec.Title,
|
||||
})
|
||||
@@ -618,6 +619,7 @@ func TestIntegrationListSelector(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should filter by multiple filters", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: fmt.Sprintf("metadata.name=%s,spec.title=%s", template2.Name, template2.Spec.Title),
|
||||
})
|
||||
@@ -635,6 +637,7 @@ func TestIntegrationListSelector(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should filter by default template name", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: "spec.title=" + v0alpha1.DefaultTemplateTitle,
|
||||
})
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alerting/v0alpha1/fakes"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1"
|
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/alertingnotifications/v0alpha1/fakes"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/registry/apps/alerting/notifications/routingtree"
|
||||
@@ -583,6 +583,7 @@ func TestIntegrationTimeIntervalListSelector(t *testing.T) {
|
||||
require.Len(t, intervals.Items, 2)
|
||||
|
||||
t.Run("should filter by interval name", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it") // TODO revisit when custom field selectors are supported
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: "spec.name=" + interval1.Spec.Name,
|
||||
})
|
||||
@@ -601,6 +602,7 @@ func TestIntegrationTimeIntervalListSelector(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should filter by multiple filters", func(t *testing.T) {
|
||||
t.Skip("disabled until app installer supports it")
|
||||
list, err := adminClient.List(ctx, v1.ListOptions{
|
||||
FieldSelector: fmt.Sprintf("metadata.name=%s,spec.name=%s", interval2.Name, interval2.Spec.Name),
|
||||
})
|
||||
|
||||
+1643
-579
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user