mirror of https://github.com/grafana/grafana
commit
8760324e83
@ -1,3 +1,13 @@ |
||||
<!-- 8.5.27 START --> |
||||
|
||||
# 8.5.27 (2023-06-22) |
||||
|
||||
### Bug fixes |
||||
|
||||
- **Auth:** Fixed CVE-2023-3128. [#70576](https://github.com/grafana/grafana/issues/70576), [@zerok](https://github.com/zerok) |
||||
|
||||
<!-- 8.5.27 END --> |
||||
|
||||
<!-- 8.5.22 START --> |
||||
|
||||
# 8.5.22 (2023-03-22) |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@ |
||||
package common |
||||
|
||||
const InternalPrefix = "grafana.com/" |
||||
const ProvenanceStatusAnnotationKey = InternalPrefix + "provenance" |
||||
const ProvenanceStatusNone = "none" |
@ -1,4 +1,4 @@ |
||||
.PHONY: generate |
||||
generate: |
||||
## --crdencoding none is needed to avoid infinite loop while generating recursive models'
|
||||
grafana-app-sdk generate -c . -g ./apis --crdencoding none
|
||||
## --crdencoding none is needed to avoid infinite loop while generating recursive models (see routingtree.cue)
|
||||
grafana-app-sdk generate -g ./pkg/apis --crdencoding none --nomanifest --postprocess
|
||||
|
@ -1 +0,0 @@ |
||||
module:"notifications" |
@ -0,0 +1,95 @@ |
||||
module github.com/grafana/grafana/apps/alerting/notifications |
||||
|
||||
go 1.23.1 |
||||
|
||||
require ( |
||||
github.com/grafana/grafana-app-sdk v0.23.1 |
||||
k8s.io/apimachinery v0.31.1 |
||||
k8s.io/apiserver v0.31.1 |
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 |
||||
) |
||||
|
||||
require ( |
||||
github.com/beorn7/perks v1.0.1 // indirect |
||||
github.com/blang/semver/v4 v4.0.0 // indirect |
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect |
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect |
||||
github.com/coreos/go-semver v0.3.1 // indirect |
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect |
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect |
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect |
||||
github.com/felixge/httpsnoop v1.0.4 // indirect |
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect |
||||
github.com/go-logr/logr v1.4.2 // indirect |
||||
github.com/go-logr/stdr v1.2.2 // indirect |
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect |
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect |
||||
github.com/go-openapi/swag v0.23.0 // indirect |
||||
github.com/gogo/protobuf v1.3.2 // indirect |
||||
github.com/golang/protobuf v1.5.4 // indirect |
||||
github.com/google/btree v1.1.2 // indirect |
||||
github.com/google/gnostic-models v0.6.8 // indirect |
||||
github.com/google/go-cmp v0.6.0 // indirect |
||||
github.com/google/gofuzz v1.2.0 // indirect |
||||
github.com/google/pprof v0.0.0-20240711041743-f6c9dda6c6da // indirect |
||||
github.com/google/uuid v1.6.0 // indirect |
||||
github.com/gorilla/websocket v1.5.3 // indirect |
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect |
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 // indirect |
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect |
||||
github.com/jonboulle/clockwork v0.4.0 // indirect |
||||
github.com/josharian/intern v1.0.0 // indirect |
||||
github.com/json-iterator/go v1.1.12 // indirect |
||||
github.com/klauspost/compress v1.17.9 // indirect |
||||
github.com/kylelemons/godebug v1.1.0 // indirect |
||||
github.com/mailru/easyjson v0.7.7 // indirect |
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect |
||||
github.com/modern-go/reflect2 v1.0.2 // indirect |
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect |
||||
github.com/onsi/gomega v1.34.1 // indirect |
||||
github.com/prometheus/client_golang v1.20.5 // indirect |
||||
github.com/prometheus/client_model v0.6.1 // indirect |
||||
github.com/prometheus/common v0.60.0 // indirect |
||||
github.com/prometheus/procfs v0.15.1 // indirect |
||||
github.com/spf13/pflag v1.0.5 // indirect |
||||
github.com/x448/float16 v0.8.4 // indirect |
||||
go.etcd.io/bbolt v1.3.10 // indirect |
||||
go.etcd.io/etcd/api/v3 v3.5.14 // indirect |
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect |
||||
go.etcd.io/etcd/client/v3 v3.5.14 // indirect |
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect |
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect |
||||
go.opentelemetry.io/otel v1.31.0 // indirect |
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 // indirect |
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 // indirect |
||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect |
||||
go.opentelemetry.io/otel/sdk v1.31.0 // indirect |
||||
go.opentelemetry.io/otel/trace v1.31.0 // indirect |
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect |
||||
go.uber.org/multierr v1.11.0 // indirect |
||||
go.uber.org/zap v1.27.0 // indirect |
||||
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e // indirect |
||||
golang.org/x/net v0.30.0 // indirect |
||||
golang.org/x/oauth2 v0.23.0 // indirect |
||||
golang.org/x/sys v0.26.0 // indirect |
||||
golang.org/x/term v0.25.0 // indirect |
||||
golang.org/x/text v0.19.0 // indirect |
||||
golang.org/x/time v0.6.0 // indirect |
||||
google.golang.org/genproto v0.0.0-20240820151423-278611b39280 // indirect |
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect |
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect |
||||
google.golang.org/grpc v1.67.1 // indirect |
||||
google.golang.org/protobuf v1.35.1 // indirect |
||||
gopkg.in/inf.v0 v0.9.1 // indirect |
||||
gopkg.in/yaml.v2 v2.4.0 // indirect |
||||
gopkg.in/yaml.v3 v3.0.1 // indirect |
||||
k8s.io/api v0.31.1 // indirect |
||||
k8s.io/client-go v0.31.1 // indirect |
||||
k8s.io/component-base v0.31.1 // indirect |
||||
k8s.io/klog/v2 v2.130.1 // indirect |
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect |
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect |
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect |
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect |
||||
sigs.k8s.io/yaml v1.4.0 // indirect |
||||
) |
@ -0,0 +1,203 @@ |
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= |
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= |
||||
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= |
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= |
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= |
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= |
||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= |
||||
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= |
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= |
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= |
||||
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= |
||||
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= |
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= |
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= |
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= |
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= |
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= |
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= |
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= |
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= |
||||
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= |
||||
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= |
||||
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= |
||||
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= |
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= |
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= |
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= |
||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= |
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= |
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= |
||||
github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= |
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= |
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= |
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= |
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= |
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= |
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= |
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= |
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= |
||||
github.com/google/pprof v0.0.0-20240711041743-f6c9dda6c6da h1:xRmpO92tb8y+Z85iUOMOicpCfaYcv7o3Cg3wKrIpg8g= |
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= |
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= |
||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= |
||||
github.com/grafana/grafana-app-sdk v0.23.1 h1:BRpUG0bA0oVxjthkmO2thuJBo3nbjaRSSmZJHw+mA8I= |
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= |
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 h1:uGoIog/wiQHI9GAxXO5TJbT0wWKH3O9HhOJW1F9c3fY= |
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= |
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= |
||||
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= |
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= |
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= |
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= |
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= |
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= |
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= |
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= |
||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= |
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= |
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= |
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= |
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= |
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= |
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= |
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= |
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= |
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= |
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= |
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= |
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= |
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= |
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= |
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= |
||||
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= |
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= |
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= |
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= |
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= |
||||
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= |
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= |
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= |
||||
github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= |
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= |
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= |
||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= |
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= |
||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= |
||||
github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= |
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= |
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= |
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= |
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= |
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= |
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= |
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20220101234140-673ab2c3ae75 h1:6fotK7otjonDflCTK0BCfls4SPy3NcCVb5dqqmbRknE= |
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= |
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= |
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= |
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= |
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= |
||||
go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= |
||||
go.etcd.io/etcd/api/v3 v3.5.14 h1:vHObSCxyB9zlF60w7qzAdTcGaglbJOpSj1Xj9+WGxq0= |
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.14 h1:SaNH6Y+rVEdxfpA2Jr5wkEvN6Zykme5+YnbCkxvuWxQ= |
||||
go.etcd.io/etcd/client/v2 v2.305.13 h1:RWfV1SX5jTU0lbCvpVQe3iPQeAHETWdOTb6pxhd77C8= |
||||
go.etcd.io/etcd/client/v3 v3.5.14 h1:CWfRs4FDaDoSz81giL7zPpZH2Z35tbOrAJkkjMqOupg= |
||||
go.etcd.io/etcd/pkg/v3 v3.5.13 h1:st9bDWNsKkBNpP4PR1MvM/9NqUPfvYZx/YXegsYEH8M= |
||||
go.etcd.io/etcd/raft/v3 v3.5.13 h1:7r/NKAOups1YnKcfro2RvGGo2PTuizF/xh26Z2CTAzA= |
||||
go.etcd.io/etcd/server/v3 v3.5.13 h1:V6KG+yMfMSqWt+lGnhFpP5z5dRUj1BDRJ5k1fQ9DFok= |
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 h1:yMkBS9yViCc7U7yeLzJPM2XizlfdVvBRSmsQDWu6qc0= |
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= |
||||
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= |
||||
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= |
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.31.0 h1:K0XaT3DwHAcV4nKLzcQvwAgSyisUghWoY20I7huthMk= |
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.31.0 h1:FFeLy03iVTXP6ffeN2iXrxfGsZGCjVx0/4KlizjyBwU= |
||||
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= |
||||
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= |
||||
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= |
||||
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= |
||||
go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= |
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= |
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= |
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= |
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= |
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= |
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= |
||||
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= |
||||
golang.org/x/exp v0.0.0-20240904232852-e7e105dedf7e h1:I88y4caeGeuDQxgdoFPUq097j7kNfw6uvuiNxUBfcBk= |
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= |
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= |
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= |
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= |
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= |
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= |
||||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= |
||||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= |
||||
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= |
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= |
||||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= |
||||
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= |
||||
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= |
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= |
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= |
||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= |
||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= |
||||
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= |
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= |
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= |
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= |
||||
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= |
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||
google.golang.org/genproto v0.0.0-20240820151423-278611b39280 h1:oKt8r1ZvaPqBe3oeGTdyx1iNjuBS+VJcc9QdU1CD3d8= |
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= |
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= |
||||
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= |
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= |
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= |
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= |
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= |
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= |
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= |
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= |
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= |
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= |
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= |
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
||||
k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= |
||||
k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= |
||||
k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= |
||||
k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= |
||||
k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c= |
||||
k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= |
||||
k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= |
||||
k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8= |
||||
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= |
||||
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= |
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= |
||||
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= |
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A= |
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= |
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 h1:2770sDpzrjjsAtVhSeUFseziht227YAWYHLGNM8QPwY= |
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= |
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= |
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= |
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= |
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= |
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= |
@ -0,0 +1 @@ |
||||
module: "github.com/grafana/grafana/apps/alerting/notifications/kinds" |
@ -0,0 +1,74 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
|
||||
"k8s.io/apimachinery/pkg/fields" |
||||
"k8s.io/apiserver/pkg/registry/generic" |
||||
|
||||
"github.com/grafana/grafana/apps/alerting/common" |
||||
) |
||||
|
||||
func (o *Receiver) GetProvenanceStatus() string { |
||||
if o == nil || o.Annotations == nil { |
||||
return "" |
||||
} |
||||
s, ok := o.Annotations[common.ProvenanceStatusAnnotationKey] |
||||
if !ok || s == "" { |
||||
return common.ProvenanceStatusNone |
||||
} |
||||
return s |
||||
} |
||||
|
||||
func (o *Receiver) SetProvenanceStatus(status string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 1) |
||||
} |
||||
if status == "" { |
||||
status = common.ProvenanceStatusNone |
||||
} |
||||
o.Annotations[common.ProvenanceStatusAnnotationKey] = status |
||||
} |
||||
|
||||
func (o *Receiver) SetAccessControl(action string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 1) |
||||
} |
||||
o.Annotations[AccessControlAnnotation(action)] = "true" |
||||
} |
||||
|
||||
// AccessControlAnnotation returns the key for the access control annotation for the given action.
|
||||
// Ex. grafana.com/access/canDelete.
|
||||
func AccessControlAnnotation(action string) string { |
||||
return fmt.Sprintf("%s%s/%s", common.InternalPrefix, "access", action) |
||||
} |
||||
|
||||
func (o *Receiver) SetInUse(routesCnt int, rules []string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 2) |
||||
} |
||||
o.Annotations[InUseAnnotation("routes")] = fmt.Sprintf("%d", routesCnt) |
||||
o.Annotations[InUseAnnotation("rules")] = fmt.Sprintf("%d", len(rules)) |
||||
} |
||||
|
||||
// InUseAnnotation returns the key for the in-use annotation for the given resource.
|
||||
// Ex. grafana.com/inUse/routes, grafana.com/inUse/rules.
|
||||
func InUseAnnotation(resource string) string { |
||||
return fmt.Sprintf("%s%s/%s", common.InternalPrefix, "inUse", resource) |
||||
} |
||||
|
||||
func SelectableFields(obj *Receiver) fields.Set { |
||||
if obj == nil { |
||||
return nil |
||||
} |
||||
selectable := Schema().SelectableFields() |
||||
set := make(fields.Set, len(selectable)) |
||||
for _, field := range selectable { |
||||
f, err := field.FieldValueFunc(obj) |
||||
if err != nil { |
||||
continue |
||||
} |
||||
set[field.FieldSelector] = f |
||||
} |
||||
return generic.MergeFieldsSets(generic.ObjectMetaFieldsSet(&obj.ObjectMeta, false), set) |
||||
} |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// JSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type JSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*JSONCodec) Read(reader io.Reader, into resource.Object) error { |
||||
return json.NewDecoder(reader).Decode(into) |
||||
} |
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*JSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &JSONCodec{} |
@ -0,0 +1,32 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"time" |
||||
) |
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct { |
||||
CreatedBy string `json:"createdBy"` |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
UpdateTimestamp time.Time `json:"updateTimestamp"` |
||||
UpdatedBy string `json:"updatedBy"` |
||||
} |
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct { |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
} |
@ -0,0 +1,266 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
||||
"k8s.io/apimachinery/pkg/runtime" |
||||
"k8s.io/apimachinery/pkg/runtime/schema" |
||||
"k8s.io/apimachinery/pkg/types" |
||||
"time" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type Receiver struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ObjectMeta `json:"metadata"` |
||||
Spec Spec `json:"spec"` |
||||
Status Status `json:"status"` |
||||
} |
||||
|
||||
func (o *Receiver) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *Receiver) SetSpec(spec any) error { |
||||
cast, ok := spec.(Spec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *Receiver) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.Status, |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.Status, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(Status) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type Status", value) |
||||
} |
||||
o.Status = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) GetStaticMetadata() resource.StaticMetadata { |
||||
gvk := o.GroupVersionKind() |
||||
return resource.StaticMetadata{ |
||||
Name: o.ObjectMeta.Name, |
||||
Namespace: o.ObjectMeta.Namespace, |
||||
Group: gvk.Group, |
||||
Version: gvk.Version, |
||||
Kind: gvk.Kind, |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) SetStaticMetadata(metadata resource.StaticMetadata) { |
||||
o.Name = metadata.Name |
||||
o.Namespace = metadata.Namespace |
||||
o.SetGroupVersionKind(schema.GroupVersionKind{ |
||||
Group: metadata.Group, |
||||
Version: metadata.Version, |
||||
Kind: metadata.Kind, |
||||
}) |
||||
} |
||||
|
||||
func (o *Receiver) GetCommonMetadata() resource.CommonMetadata { |
||||
dt := o.DeletionTimestamp |
||||
var deletionTimestamp *time.Time |
||||
if dt != nil { |
||||
deletionTimestamp = &dt.Time |
||||
} |
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any) |
||||
if o.Annotations != nil { |
||||
extraFields["annotations"] = o.Annotations |
||||
} |
||||
if o.ManagedFields != nil { |
||||
extraFields["managedFields"] = o.ManagedFields |
||||
} |
||||
if o.OwnerReferences != nil { |
||||
extraFields["ownerReferences"] = o.OwnerReferences |
||||
} |
||||
return resource.CommonMetadata{ |
||||
UID: string(o.UID), |
||||
ResourceVersion: o.ResourceVersion, |
||||
Generation: o.Generation, |
||||
Labels: o.Labels, |
||||
CreationTimestamp: o.CreationTimestamp.Time, |
||||
DeletionTimestamp: deletionTimestamp, |
||||
Finalizers: o.Finalizers, |
||||
UpdateTimestamp: o.GetUpdateTimestamp(), |
||||
CreatedBy: o.GetCreatedBy(), |
||||
UpdatedBy: o.GetUpdatedBy(), |
||||
ExtraFields: extraFields, |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) SetCommonMetadata(metadata resource.CommonMetadata) { |
||||
o.UID = types.UID(metadata.UID) |
||||
o.ResourceVersion = metadata.ResourceVersion |
||||
o.Generation = metadata.Generation |
||||
o.Labels = metadata.Labels |
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) |
||||
if metadata.DeletionTimestamp != nil { |
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp) |
||||
o.DeletionTimestamp = &dt |
||||
} else { |
||||
o.DeletionTimestamp = nil |
||||
} |
||||
o.Finalizers = metadata.Finalizers |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string) |
||||
} |
||||
if !metadata.UpdateTimestamp.IsZero() { |
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp) |
||||
} |
||||
if metadata.CreatedBy != "" { |
||||
o.SetCreatedBy(metadata.CreatedBy) |
||||
} |
||||
if metadata.UpdatedBy != "" { |
||||
o.SetUpdatedBy(metadata.UpdatedBy) |
||||
} |
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil { |
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok { |
||||
if cast, ok := annotations.(map[string]string); ok { |
||||
o.Annotations = cast |
||||
} |
||||
} |
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok { |
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok { |
||||
o.ManagedFields = cast |
||||
} |
||||
} |
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok { |
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok { |
||||
o.OwnerReferences = cast |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func (o *Receiver) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *Receiver) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *Receiver) GetUpdateTimestamp() time.Time { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"]) |
||||
return parsed |
||||
} |
||||
|
||||
func (o *Receiver) SetUpdateTimestamp(updateTimestamp time.Time) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) |
||||
} |
||||
|
||||
func (o *Receiver) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *Receiver) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *Receiver) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *Receiver) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &Receiver{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type ReceiverList struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ListMeta `json:"metadata"` |
||||
Items []Receiver `json:"items"` |
||||
} |
||||
|
||||
func (o *ReceiverList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *ReceiverList) Copy() resource.ListObject { |
||||
cpy := &ReceiverList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]Receiver, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*Receiver); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *ReceiverList) GetItems() []resource.Object { |
||||
items := make([]resource.Object, len(o.Items)) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
items[i] = &o.Items[i] |
||||
} |
||||
return items |
||||
} |
||||
|
||||
func (o *ReceiverList) SetItems(items []resource.Object) { |
||||
o.Items = make([]Receiver, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*Receiver) |
||||
} |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &ReceiverList{} |
@ -0,0 +1,46 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
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{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 |
||||
}, |
||||
}, |
||||
})) |
||||
kindReceiver = resource.Kind{ |
||||
Schema: schemaReceiver, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &JSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func Kind() resource.Kind { |
||||
return kindReceiver |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of Receiver
|
||||
func Schema() *resource.SimpleSchema { |
||||
return schemaReceiver |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindReceiver |
@ -0,0 +1,18 @@ |
||||
package v0alpha1 |
||||
|
||||
// Integration defines model for Integration.
|
||||
// +k8s:openapi-gen=true
|
||||
type Integration struct { |
||||
DisableResolveMessage *bool `json:"disableResolveMessage,omitempty"` |
||||
SecureFields map[string]bool `json:"secureFields,omitempty"` |
||||
Settings map[string]interface{} `json:"settings"` |
||||
Type string `json:"type"` |
||||
Uid *string `json:"uid,omitempty"` |
||||
} |
||||
|
||||
// Spec defines model for Spec.
|
||||
// +k8s:openapi-gen=true
|
||||
type Spec struct { |
||||
Integrations []Integration `json:"integrations"` |
||||
Title string `json:"title"` |
||||
} |
@ -0,0 +1,70 @@ |
||||
package v0alpha1 |
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const ( |
||||
OperatorStateStateFailed OperatorStateState = "failed" |
||||
OperatorStateStateInProgress OperatorStateState = "in_progress" |
||||
OperatorStateStateSuccess OperatorStateState = "success" |
||||
) |
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const ( |
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed" |
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress" |
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success" |
||||
) |
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorStateState string |
||||
|
||||
// Status defines model for Status.
|
||||
// +k8s:openapi-gen=true
|
||||
type Status struct { |
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"` |
||||
|
||||
// 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.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"` |
||||
} |
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorStateState string |
@ -0,0 +1,365 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
common "k8s.io/kube-openapi/pkg/common" |
||||
spec "k8s.io/kube-openapi/pkg/validation/spec" |
||||
) |
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { |
||||
return map[string]common.OpenAPIDefinition{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Integration": schema_apis_resource_receiver_v0alpha1_Integration(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.OperatorState": schema_apis_resource_receiver_v0alpha1_OperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Receiver": schema_apis_resource_receiver_v0alpha1_Receiver(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.ReceiverList": schema_apis_resource_receiver_v0alpha1_ReceiverList(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Spec": schema_apis_resource_receiver_v0alpha1_Spec(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Status": schema_apis_resource_receiver_v0alpha1_Status(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.StatusOperatorState": schema_apis_resource_receiver_v0alpha1_StatusOperatorState(ref), |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_Integration(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Integration defines model for Integration.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"disableResolveMessage": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"boolean"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"secureFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: false, |
||||
Type: []string{"boolean"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"settings": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"type": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"uid": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"settings", "type"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_OperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "OperatorState defines model for OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_Receiver(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), |
||||
}, |
||||
}, |
||||
"spec": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Spec"), |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Status"), |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "spec", "status"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Spec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Status", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_ReceiverList(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Receiver"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Receiver", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Spec defines model for Spec.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"integrations": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Integration"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"title": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"integrations", "title"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.Integration"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Status defines model for Status.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"additionalFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "additionalFields is reserved for future use", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"operatorStates": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
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: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.StatusOperatorState"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/receiver/v0alpha1.StatusOperatorState"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_receiver_v0alpha1_StatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "StatusOperatorState defines model for status.#OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana/apps/alerting/common" |
||||
) |
||||
|
||||
// Re-define some enum values with confusing names
|
||||
// TODO figure out how we can control name of enum
|
||||
const ( |
||||
MatcherTypeNotEqual MatcherType = "!=" |
||||
MatcherTypeEqualRegex MatcherType = "=~" |
||||
MatcherTypeNotEqualRegex MatcherType = "!~" |
||||
) |
||||
|
||||
const UserDefinedRoutingTreeName = "user-defined" |
||||
|
||||
func (o *RoutingTree) GetProvenanceStatus() string { |
||||
if o == nil || o.Annotations == nil { |
||||
return "" |
||||
} |
||||
s, ok := o.Annotations[common.ProvenanceStatusAnnotationKey] |
||||
if !ok || s == "" { |
||||
return common.ProvenanceStatusNone |
||||
} |
||||
return s |
||||
} |
||||
|
||||
func (o *RoutingTree) SetProvenanceStatus(status string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 1) |
||||
} |
||||
if status == "" { |
||||
status = common.ProvenanceStatusNone |
||||
} |
||||
o.Annotations[common.ProvenanceStatusAnnotationKey] = status |
||||
} |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// JSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type JSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*JSONCodec) Read(reader io.Reader, into resource.Object) error { |
||||
return json.NewDecoder(reader).Decode(into) |
||||
} |
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*JSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &JSONCodec{} |
@ -0,0 +1,32 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"time" |
||||
) |
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct { |
||||
CreatedBy string `json:"createdBy"` |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
UpdateTimestamp time.Time `json:"updateTimestamp"` |
||||
UpdatedBy string `json:"updatedBy"` |
||||
} |
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct { |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
} |
@ -0,0 +1,266 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
||||
"k8s.io/apimachinery/pkg/runtime" |
||||
"k8s.io/apimachinery/pkg/runtime/schema" |
||||
"k8s.io/apimachinery/pkg/types" |
||||
"time" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type RoutingTree struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ObjectMeta `json:"metadata"` |
||||
Spec Spec `json:"spec"` |
||||
Status Status `json:"status"` |
||||
} |
||||
|
||||
func (o *RoutingTree) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *RoutingTree) SetSpec(spec any) error { |
||||
cast, ok := spec.(Spec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *RoutingTree) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.Status, |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.Status, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(Status) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type Status", value) |
||||
} |
||||
o.Status = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) GetStaticMetadata() resource.StaticMetadata { |
||||
gvk := o.GroupVersionKind() |
||||
return resource.StaticMetadata{ |
||||
Name: o.ObjectMeta.Name, |
||||
Namespace: o.ObjectMeta.Namespace, |
||||
Group: gvk.Group, |
||||
Version: gvk.Version, |
||||
Kind: gvk.Kind, |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) SetStaticMetadata(metadata resource.StaticMetadata) { |
||||
o.Name = metadata.Name |
||||
o.Namespace = metadata.Namespace |
||||
o.SetGroupVersionKind(schema.GroupVersionKind{ |
||||
Group: metadata.Group, |
||||
Version: metadata.Version, |
||||
Kind: metadata.Kind, |
||||
}) |
||||
} |
||||
|
||||
func (o *RoutingTree) GetCommonMetadata() resource.CommonMetadata { |
||||
dt := o.DeletionTimestamp |
||||
var deletionTimestamp *time.Time |
||||
if dt != nil { |
||||
deletionTimestamp = &dt.Time |
||||
} |
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any) |
||||
if o.Annotations != nil { |
||||
extraFields["annotations"] = o.Annotations |
||||
} |
||||
if o.ManagedFields != nil { |
||||
extraFields["managedFields"] = o.ManagedFields |
||||
} |
||||
if o.OwnerReferences != nil { |
||||
extraFields["ownerReferences"] = o.OwnerReferences |
||||
} |
||||
return resource.CommonMetadata{ |
||||
UID: string(o.UID), |
||||
ResourceVersion: o.ResourceVersion, |
||||
Generation: o.Generation, |
||||
Labels: o.Labels, |
||||
CreationTimestamp: o.CreationTimestamp.Time, |
||||
DeletionTimestamp: deletionTimestamp, |
||||
Finalizers: o.Finalizers, |
||||
UpdateTimestamp: o.GetUpdateTimestamp(), |
||||
CreatedBy: o.GetCreatedBy(), |
||||
UpdatedBy: o.GetUpdatedBy(), |
||||
ExtraFields: extraFields, |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) SetCommonMetadata(metadata resource.CommonMetadata) { |
||||
o.UID = types.UID(metadata.UID) |
||||
o.ResourceVersion = metadata.ResourceVersion |
||||
o.Generation = metadata.Generation |
||||
o.Labels = metadata.Labels |
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) |
||||
if metadata.DeletionTimestamp != nil { |
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp) |
||||
o.DeletionTimestamp = &dt |
||||
} else { |
||||
o.DeletionTimestamp = nil |
||||
} |
||||
o.Finalizers = metadata.Finalizers |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string) |
||||
} |
||||
if !metadata.UpdateTimestamp.IsZero() { |
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp) |
||||
} |
||||
if metadata.CreatedBy != "" { |
||||
o.SetCreatedBy(metadata.CreatedBy) |
||||
} |
||||
if metadata.UpdatedBy != "" { |
||||
o.SetUpdatedBy(metadata.UpdatedBy) |
||||
} |
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil { |
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok { |
||||
if cast, ok := annotations.(map[string]string); ok { |
||||
o.Annotations = cast |
||||
} |
||||
} |
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok { |
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok { |
||||
o.ManagedFields = cast |
||||
} |
||||
} |
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok { |
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok { |
||||
o.OwnerReferences = cast |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func (o *RoutingTree) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *RoutingTree) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *RoutingTree) GetUpdateTimestamp() time.Time { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"]) |
||||
return parsed |
||||
} |
||||
|
||||
func (o *RoutingTree) SetUpdateTimestamp(updateTimestamp time.Time) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) |
||||
} |
||||
|
||||
func (o *RoutingTree) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *RoutingTree) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *RoutingTree) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *RoutingTree) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &RoutingTree{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type RoutingTreeList struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ListMeta `json:"metadata"` |
||||
Items []RoutingTree `json:"items"` |
||||
} |
||||
|
||||
func (o *RoutingTreeList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *RoutingTreeList) Copy() resource.ListObject { |
||||
cpy := &RoutingTreeList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]RoutingTree, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*RoutingTree); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *RoutingTreeList) GetItems() []resource.Object { |
||||
items := make([]resource.Object, len(o.Items)) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
items[i] = &o.Items[i] |
||||
} |
||||
return items |
||||
} |
||||
|
||||
func (o *RoutingTreeList) SetItems(items []resource.Object) { |
||||
o.Items = make([]RoutingTree, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*RoutingTree) |
||||
} |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &RoutingTreeList{} |
@ -0,0 +1,34 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// schema is unexported to prevent accidental overwrites
|
||||
var ( |
||||
schemaRoutingTree = resource.NewSimpleSchema("notifications.alerting.grafana.app", "v0alpha1", &RoutingTree{}, &RoutingTreeList{}, resource.WithKind("RoutingTree"), |
||||
resource.WithPlural("routingtrees"), resource.WithScope(resource.NamespacedScope)) |
||||
kindRoutingTree = resource.Kind{ |
||||
Schema: schemaRoutingTree, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &JSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func Kind() resource.Kind { |
||||
return kindRoutingTree |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of RoutingTree
|
||||
func Schema() *resource.SimpleSchema { |
||||
return schemaRoutingTree |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindRoutingTree |
@ -0,0 +1,70 @@ |
||||
package v0alpha1 |
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const ( |
||||
OperatorStateStateFailed OperatorStateState = "failed" |
||||
OperatorStateStateInProgress OperatorStateState = "in_progress" |
||||
OperatorStateStateSuccess OperatorStateState = "success" |
||||
) |
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const ( |
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed" |
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress" |
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success" |
||||
) |
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorStateState string |
||||
|
||||
// Status defines model for Status.
|
||||
// +k8s:openapi-gen=true
|
||||
type Status struct { |
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"` |
||||
|
||||
// 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.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"` |
||||
} |
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorStateState string |
@ -0,0 +1,493 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
common "k8s.io/kube-openapi/pkg/common" |
||||
spec "k8s.io/kube-openapi/pkg/validation/spec" |
||||
) |
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { |
||||
return map[string]common.OpenAPIDefinition{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Matcher": schema_apis_resource_routingtree_v0alpha1_Matcher(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.OperatorState": schema_apis_resource_routingtree_v0alpha1_OperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Route": schema_apis_resource_routingtree_v0alpha1_Route(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RouteDefaults": schema_apis_resource_routingtree_v0alpha1_RouteDefaults(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RoutingTree": schema_apis_resource_routingtree_v0alpha1_RoutingTree(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RoutingTreeList": schema_apis_resource_routingtree_v0alpha1_RoutingTreeList(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Spec": schema_apis_resource_routingtree_v0alpha1_Spec(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Status": schema_apis_resource_routingtree_v0alpha1_Status(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.StatusOperatorState": schema_apis_resource_routingtree_v0alpha1_StatusOperatorState(ref), |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_Matcher(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Matcher defines model for Matcher.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"label": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"type": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"value": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"label", "type", "value"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_OperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "OperatorState defines model for OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_Route(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Route defines model for Route.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"continue": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: false, |
||||
Type: []string{"boolean"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"group_by": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"group_interval": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"group_wait": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"matchers": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Matcher"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"mute_time_intervals": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"receiver": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"repeat_interval": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"routes": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Route"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"continue"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Matcher", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Route"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_RouteDefaults(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "RouteDefaults defines model for RouteDefaults.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"group_by": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"group_interval": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"group_wait": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"receiver": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"repeat_interval": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"receiver"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_RoutingTree(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), |
||||
}, |
||||
}, |
||||
"spec": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Spec"), |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Status"), |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "spec", "status"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Spec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Status", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_RoutingTreeList(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RoutingTree"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RoutingTree", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Spec defines model for Spec.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"defaults": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RouteDefaults"), |
||||
}, |
||||
}, |
||||
"routes": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Route"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"defaults", "routes"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.Route", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.RouteDefaults"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Status defines model for Status.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"additionalFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "additionalFields is reserved for future use", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"operatorStates": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
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: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.StatusOperatorState"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/routingtree/v0alpha1.StatusOperatorState"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_routingtree_v0alpha1_StatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "StatusOperatorState defines model for status.#OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"k8s.io/apimachinery/pkg/fields" |
||||
"k8s.io/apiserver/pkg/registry/generic" |
||||
|
||||
"github.com/grafana/grafana/apps/alerting/common" |
||||
) |
||||
|
||||
func (o *TemplateGroup) GetProvenanceStatus() string { |
||||
if o == nil || o.Annotations == nil { |
||||
return "" |
||||
} |
||||
s, ok := o.Annotations[common.ProvenanceStatusAnnotationKey] |
||||
if !ok || s == "" { |
||||
return common.ProvenanceStatusNone |
||||
} |
||||
return s |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetProvenanceStatus(status string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 1) |
||||
} |
||||
if status == "" { |
||||
status = common.ProvenanceStatusNone |
||||
} |
||||
o.Annotations[common.ProvenanceStatusAnnotationKey] = status |
||||
} |
||||
|
||||
func SelectableFields(obj *TemplateGroup) fields.Set { |
||||
if obj == nil { |
||||
return nil |
||||
} |
||||
selectable := Schema().SelectableFields() |
||||
set := make(fields.Set, len(selectable)) |
||||
for _, field := range selectable { |
||||
f, err := field.FieldValueFunc(obj) |
||||
if err != nil { |
||||
continue |
||||
} |
||||
set[field.FieldSelector] = f |
||||
} |
||||
return generic.MergeFieldsSets(generic.ObjectMetaFieldsSet(&obj.ObjectMeta, false), set) |
||||
} |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// JSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type JSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*JSONCodec) Read(reader io.Reader, into resource.Object) error { |
||||
return json.NewDecoder(reader).Decode(into) |
||||
} |
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*JSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &JSONCodec{} |
@ -0,0 +1,32 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"time" |
||||
) |
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct { |
||||
CreatedBy string `json:"createdBy"` |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
UpdateTimestamp time.Time `json:"updateTimestamp"` |
||||
UpdatedBy string `json:"updatedBy"` |
||||
} |
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct { |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
} |
@ -0,0 +1,266 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
||||
"k8s.io/apimachinery/pkg/runtime" |
||||
"k8s.io/apimachinery/pkg/runtime/schema" |
||||
"k8s.io/apimachinery/pkg/types" |
||||
"time" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type TemplateGroup struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ObjectMeta `json:"metadata"` |
||||
Spec Spec `json:"spec"` |
||||
Status Status `json:"status"` |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetSpec(spec any) error { |
||||
cast, ok := spec.(Spec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.Status, |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.Status, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(Status) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type Status", value) |
||||
} |
||||
o.Status = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetStaticMetadata() resource.StaticMetadata { |
||||
gvk := o.GroupVersionKind() |
||||
return resource.StaticMetadata{ |
||||
Name: o.ObjectMeta.Name, |
||||
Namespace: o.ObjectMeta.Namespace, |
||||
Group: gvk.Group, |
||||
Version: gvk.Version, |
||||
Kind: gvk.Kind, |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetStaticMetadata(metadata resource.StaticMetadata) { |
||||
o.Name = metadata.Name |
||||
o.Namespace = metadata.Namespace |
||||
o.SetGroupVersionKind(schema.GroupVersionKind{ |
||||
Group: metadata.Group, |
||||
Version: metadata.Version, |
||||
Kind: metadata.Kind, |
||||
}) |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetCommonMetadata() resource.CommonMetadata { |
||||
dt := o.DeletionTimestamp |
||||
var deletionTimestamp *time.Time |
||||
if dt != nil { |
||||
deletionTimestamp = &dt.Time |
||||
} |
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any) |
||||
if o.Annotations != nil { |
||||
extraFields["annotations"] = o.Annotations |
||||
} |
||||
if o.ManagedFields != nil { |
||||
extraFields["managedFields"] = o.ManagedFields |
||||
} |
||||
if o.OwnerReferences != nil { |
||||
extraFields["ownerReferences"] = o.OwnerReferences |
||||
} |
||||
return resource.CommonMetadata{ |
||||
UID: string(o.UID), |
||||
ResourceVersion: o.ResourceVersion, |
||||
Generation: o.Generation, |
||||
Labels: o.Labels, |
||||
CreationTimestamp: o.CreationTimestamp.Time, |
||||
DeletionTimestamp: deletionTimestamp, |
||||
Finalizers: o.Finalizers, |
||||
UpdateTimestamp: o.GetUpdateTimestamp(), |
||||
CreatedBy: o.GetCreatedBy(), |
||||
UpdatedBy: o.GetUpdatedBy(), |
||||
ExtraFields: extraFields, |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetCommonMetadata(metadata resource.CommonMetadata) { |
||||
o.UID = types.UID(metadata.UID) |
||||
o.ResourceVersion = metadata.ResourceVersion |
||||
o.Generation = metadata.Generation |
||||
o.Labels = metadata.Labels |
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) |
||||
if metadata.DeletionTimestamp != nil { |
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp) |
||||
o.DeletionTimestamp = &dt |
||||
} else { |
||||
o.DeletionTimestamp = nil |
||||
} |
||||
o.Finalizers = metadata.Finalizers |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string) |
||||
} |
||||
if !metadata.UpdateTimestamp.IsZero() { |
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp) |
||||
} |
||||
if metadata.CreatedBy != "" { |
||||
o.SetCreatedBy(metadata.CreatedBy) |
||||
} |
||||
if metadata.UpdatedBy != "" { |
||||
o.SetUpdatedBy(metadata.UpdatedBy) |
||||
} |
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil { |
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok { |
||||
if cast, ok := annotations.(map[string]string); ok { |
||||
o.Annotations = cast |
||||
} |
||||
} |
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok { |
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok { |
||||
o.ManagedFields = cast |
||||
} |
||||
} |
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok { |
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok { |
||||
o.OwnerReferences = cast |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetUpdateTimestamp() time.Time { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"]) |
||||
return parsed |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetUpdateTimestamp(updateTimestamp time.Time) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) |
||||
} |
||||
|
||||
func (o *TemplateGroup) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *TemplateGroup) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *TemplateGroup) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *TemplateGroup) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &TemplateGroup{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type TemplateGroupList struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ListMeta `json:"metadata"` |
||||
Items []TemplateGroup `json:"items"` |
||||
} |
||||
|
||||
func (o *TemplateGroupList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *TemplateGroupList) Copy() resource.ListObject { |
||||
cpy := &TemplateGroupList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]TemplateGroup, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*TemplateGroup); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *TemplateGroupList) GetItems() []resource.Object { |
||||
items := make([]resource.Object, len(o.Items)) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
items[i] = &o.Items[i] |
||||
} |
||||
return items |
||||
} |
||||
|
||||
func (o *TemplateGroupList) SetItems(items []resource.Object) { |
||||
o.Items = make([]TemplateGroup, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*TemplateGroup) |
||||
} |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &TemplateGroupList{} |
@ -0,0 +1,46 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
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{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 |
||||
}, |
||||
}, |
||||
})) |
||||
kindTemplateGroup = resource.Kind{ |
||||
Schema: schemaTemplateGroup, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &JSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func Kind() resource.Kind { |
||||
return kindTemplateGroup |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of TemplateGroup
|
||||
func Schema() *resource.SimpleSchema { |
||||
return schemaTemplateGroup |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindTemplateGroup |
@ -1,8 +1,8 @@ |
||||
package v0alpha1 |
||||
|
||||
// TemplateGroupSpec defines model for TemplateGroupSpec.
|
||||
// Spec defines model for Spec.
|
||||
// +k8s:openapi-gen=true
|
||||
type TemplateGroupSpec struct { |
||||
Title string `json:"title"` |
||||
type Spec struct { |
||||
Content string `json:"content"` |
||||
Title string `json:"title"` |
||||
} |
@ -0,0 +1,70 @@ |
||||
package v0alpha1 |
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const ( |
||||
OperatorStateStateFailed OperatorStateState = "failed" |
||||
OperatorStateStateInProgress OperatorStateState = "in_progress" |
||||
OperatorStateStateSuccess OperatorStateState = "success" |
||||
) |
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const ( |
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed" |
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress" |
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success" |
||||
) |
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorStateState string |
||||
|
||||
// Status defines model for Status.
|
||||
// +k8s:openapi-gen=true
|
||||
type Status struct { |
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"` |
||||
|
||||
// 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.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"` |
||||
} |
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorStateState string |
@ -0,0 +1,294 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
common "k8s.io/kube-openapi/pkg/common" |
||||
spec "k8s.io/kube-openapi/pkg/validation/spec" |
||||
) |
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { |
||||
return map[string]common.OpenAPIDefinition{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.OperatorState": schema_apis_resource_templategroup_v0alpha1_OperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Spec": schema_apis_resource_templategroup_v0alpha1_Spec(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Status": schema_apis_resource_templategroup_v0alpha1_Status(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.StatusOperatorState": schema_apis_resource_templategroup_v0alpha1_StatusOperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.TemplateGroup": schema_apis_resource_templategroup_v0alpha1_TemplateGroup(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.TemplateGroupList": schema_apis_resource_templategroup_v0alpha1_TemplateGroupList(ref), |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_OperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "OperatorState defines model for OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Spec defines model for Spec.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"content": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"title": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"content", "title"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Status defines model for Status.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"additionalFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "additionalFields is reserved for future use", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"operatorStates": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
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: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.StatusOperatorState"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.StatusOperatorState"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_StatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "StatusOperatorState defines model for status.#OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_TemplateGroup(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), |
||||
}, |
||||
}, |
||||
"spec": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Spec"), |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Status"), |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "spec", "status"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Spec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.Status", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_templategroup_v0alpha1_TemplateGroupList(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.TemplateGroup"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/templategroup/v0alpha1.TemplateGroup", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"k8s.io/apimachinery/pkg/fields" |
||||
"k8s.io/apiserver/pkg/registry/generic" |
||||
|
||||
"github.com/grafana/grafana/apps/alerting/common" |
||||
) |
||||
|
||||
func (o *TimeInterval) GetProvenanceStatus() string { |
||||
if o == nil || o.Annotations == nil { |
||||
return "" |
||||
} |
||||
s, ok := o.Annotations[common.ProvenanceStatusAnnotationKey] |
||||
if !ok || s == "" { |
||||
return common.ProvenanceStatusNone |
||||
} |
||||
return s |
||||
} |
||||
|
||||
func (o *TimeInterval) SetProvenanceStatus(status string) { |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string, 1) |
||||
} |
||||
if status == "" { |
||||
status = common.ProvenanceStatusNone |
||||
} |
||||
o.Annotations[common.ProvenanceStatusAnnotationKey] = status |
||||
} |
||||
|
||||
func SelectableFields(obj *TimeInterval) fields.Set { |
||||
if obj == nil { |
||||
return nil |
||||
} |
||||
selectable := Schema().SelectableFields() |
||||
set := make(fields.Set, len(selectable)) |
||||
for _, field := range selectable { |
||||
f, err := field.FieldValueFunc(obj) |
||||
if err != nil { |
||||
continue |
||||
} |
||||
set[field.FieldSelector] = f |
||||
} |
||||
return generic.MergeFieldsSets(generic.ObjectMetaFieldsSet(&obj.ObjectMeta, false), set) |
||||
} |
@ -0,0 +1,28 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"io" |
||||
|
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
) |
||||
|
||||
// JSONCodec is an implementation of resource.Codec for kubernetes JSON encoding
|
||||
type JSONCodec struct{} |
||||
|
||||
// Read reads JSON-encoded bytes from `reader` and unmarshals them into `into`
|
||||
func (*JSONCodec) Read(reader io.Reader, into resource.Object) error { |
||||
return json.NewDecoder(reader).Decode(into) |
||||
} |
||||
|
||||
// Write writes JSON-encoded bytes into `writer` marshaled from `from`
|
||||
func (*JSONCodec) Write(writer io.Writer, from resource.Object) error { |
||||
return json.NewEncoder(writer).Encode(from) |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Codec = &JSONCodec{} |
@ -0,0 +1,32 @@ |
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"time" |
||||
) |
||||
|
||||
// Metadata defines model for Metadata.
|
||||
type Metadata struct { |
||||
CreatedBy string `json:"createdBy"` |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
UpdateTimestamp time.Time `json:"updateTimestamp"` |
||||
UpdatedBy string `json:"updatedBy"` |
||||
} |
||||
|
||||
// _kubeObjectMetadata is metadata found in a kubernetes object's metadata field.
|
||||
// It is not exhaustive and only includes fields which may be relevant to a kind's implementation,
|
||||
// As it is also intended to be generic enough to function with any API Server.
|
||||
type KubeObjectMetadata struct { |
||||
CreationTimestamp time.Time `json:"creationTimestamp"` |
||||
DeletionTimestamp *time.Time `json:"deletionTimestamp,omitempty"` |
||||
Finalizers []string `json:"finalizers"` |
||||
Generation int64 `json:"generation"` |
||||
Labels map[string]string `json:"labels"` |
||||
ResourceVersion string `json:"resourceVersion"` |
||||
Uid string `json:"uid"` |
||||
} |
@ -0,0 +1,266 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
"fmt" |
||||
"github.com/grafana/grafana-app-sdk/resource" |
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
||||
"k8s.io/apimachinery/pkg/runtime" |
||||
"k8s.io/apimachinery/pkg/runtime/schema" |
||||
"k8s.io/apimachinery/pkg/types" |
||||
"time" |
||||
) |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type TimeInterval struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ObjectMeta `json:"metadata"` |
||||
Spec Spec `json:"spec"` |
||||
Status Status `json:"status"` |
||||
} |
||||
|
||||
func (o *TimeInterval) GetSpec() any { |
||||
return o.Spec |
||||
} |
||||
|
||||
func (o *TimeInterval) SetSpec(spec any) error { |
||||
cast, ok := spec.(Spec) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set spec type %#v, not of type Spec", spec) |
||||
} |
||||
o.Spec = cast |
||||
return nil |
||||
} |
||||
|
||||
func (o *TimeInterval) GetSubresources() map[string]any { |
||||
return map[string]any{ |
||||
"status": o.Status, |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) GetSubresource(name string) (any, bool) { |
||||
switch name { |
||||
case "status": |
||||
return o.Status, true |
||||
default: |
||||
return nil, false |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) SetSubresource(name string, value any) error { |
||||
switch name { |
||||
case "status": |
||||
cast, ok := value.(Status) |
||||
if !ok { |
||||
return fmt.Errorf("cannot set status type %#v, not of type Status", value) |
||||
} |
||||
o.Status = cast |
||||
return nil |
||||
default: |
||||
return fmt.Errorf("subresource '%s' does not exist", name) |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) GetStaticMetadata() resource.StaticMetadata { |
||||
gvk := o.GroupVersionKind() |
||||
return resource.StaticMetadata{ |
||||
Name: o.ObjectMeta.Name, |
||||
Namespace: o.ObjectMeta.Namespace, |
||||
Group: gvk.Group, |
||||
Version: gvk.Version, |
||||
Kind: gvk.Kind, |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) SetStaticMetadata(metadata resource.StaticMetadata) { |
||||
o.Name = metadata.Name |
||||
o.Namespace = metadata.Namespace |
||||
o.SetGroupVersionKind(schema.GroupVersionKind{ |
||||
Group: metadata.Group, |
||||
Version: metadata.Version, |
||||
Kind: metadata.Kind, |
||||
}) |
||||
} |
||||
|
||||
func (o *TimeInterval) GetCommonMetadata() resource.CommonMetadata { |
||||
dt := o.DeletionTimestamp |
||||
var deletionTimestamp *time.Time |
||||
if dt != nil { |
||||
deletionTimestamp = &dt.Time |
||||
} |
||||
// Legacy ExtraFields support
|
||||
extraFields := make(map[string]any) |
||||
if o.Annotations != nil { |
||||
extraFields["annotations"] = o.Annotations |
||||
} |
||||
if o.ManagedFields != nil { |
||||
extraFields["managedFields"] = o.ManagedFields |
||||
} |
||||
if o.OwnerReferences != nil { |
||||
extraFields["ownerReferences"] = o.OwnerReferences |
||||
} |
||||
return resource.CommonMetadata{ |
||||
UID: string(o.UID), |
||||
ResourceVersion: o.ResourceVersion, |
||||
Generation: o.Generation, |
||||
Labels: o.Labels, |
||||
CreationTimestamp: o.CreationTimestamp.Time, |
||||
DeletionTimestamp: deletionTimestamp, |
||||
Finalizers: o.Finalizers, |
||||
UpdateTimestamp: o.GetUpdateTimestamp(), |
||||
CreatedBy: o.GetCreatedBy(), |
||||
UpdatedBy: o.GetUpdatedBy(), |
||||
ExtraFields: extraFields, |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) SetCommonMetadata(metadata resource.CommonMetadata) { |
||||
o.UID = types.UID(metadata.UID) |
||||
o.ResourceVersion = metadata.ResourceVersion |
||||
o.Generation = metadata.Generation |
||||
o.Labels = metadata.Labels |
||||
o.CreationTimestamp = metav1.NewTime(metadata.CreationTimestamp) |
||||
if metadata.DeletionTimestamp != nil { |
||||
dt := metav1.NewTime(*metadata.DeletionTimestamp) |
||||
o.DeletionTimestamp = &dt |
||||
} else { |
||||
o.DeletionTimestamp = nil |
||||
} |
||||
o.Finalizers = metadata.Finalizers |
||||
if o.Annotations == nil { |
||||
o.Annotations = make(map[string]string) |
||||
} |
||||
if !metadata.UpdateTimestamp.IsZero() { |
||||
o.SetUpdateTimestamp(metadata.UpdateTimestamp) |
||||
} |
||||
if metadata.CreatedBy != "" { |
||||
o.SetCreatedBy(metadata.CreatedBy) |
||||
} |
||||
if metadata.UpdatedBy != "" { |
||||
o.SetUpdatedBy(metadata.UpdatedBy) |
||||
} |
||||
// Legacy support for setting Annotations, ManagedFields, and OwnerReferences via ExtraFields
|
||||
if metadata.ExtraFields != nil { |
||||
if annotations, ok := metadata.ExtraFields["annotations"]; ok { |
||||
if cast, ok := annotations.(map[string]string); ok { |
||||
o.Annotations = cast |
||||
} |
||||
} |
||||
if managedFields, ok := metadata.ExtraFields["managedFields"]; ok { |
||||
if cast, ok := managedFields.([]metav1.ManagedFieldsEntry); ok { |
||||
o.ManagedFields = cast |
||||
} |
||||
} |
||||
if ownerReferences, ok := metadata.ExtraFields["ownerReferences"]; ok { |
||||
if cast, ok := ownerReferences.([]metav1.OwnerReference); ok { |
||||
o.OwnerReferences = cast |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
func (o *TimeInterval) GetCreatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/createdBy"] |
||||
} |
||||
|
||||
func (o *TimeInterval) SetCreatedBy(createdBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/createdBy"] = createdBy |
||||
} |
||||
|
||||
func (o *TimeInterval) GetUpdateTimestamp() time.Time { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
parsed, _ := time.Parse(time.RFC3339, o.ObjectMeta.Annotations["grafana.com/updateTimestamp"]) |
||||
return parsed |
||||
} |
||||
|
||||
func (o *TimeInterval) SetUpdateTimestamp(updateTimestamp time.Time) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updateTimestamp"] = updateTimestamp.Format(time.RFC3339) |
||||
} |
||||
|
||||
func (o *TimeInterval) GetUpdatedBy() string { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
return o.ObjectMeta.Annotations["grafana.com/updatedBy"] |
||||
} |
||||
|
||||
func (o *TimeInterval) SetUpdatedBy(updatedBy string) { |
||||
if o.ObjectMeta.Annotations == nil { |
||||
o.ObjectMeta.Annotations = make(map[string]string) |
||||
} |
||||
|
||||
o.ObjectMeta.Annotations["grafana.com/updatedBy"] = updatedBy |
||||
} |
||||
|
||||
func (o *TimeInterval) Copy() resource.Object { |
||||
return resource.CopyObject(o) |
||||
} |
||||
|
||||
func (o *TimeInterval) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.Object = &TimeInterval{} |
||||
|
||||
// +k8s:openapi-gen=true
|
||||
type TimeIntervalList struct { |
||||
metav1.TypeMeta `json:",inline"` |
||||
metav1.ListMeta `json:"metadata"` |
||||
Items []TimeInterval `json:"items"` |
||||
} |
||||
|
||||
func (o *TimeIntervalList) DeepCopyObject() runtime.Object { |
||||
return o.Copy() |
||||
} |
||||
|
||||
func (o *TimeIntervalList) Copy() resource.ListObject { |
||||
cpy := &TimeIntervalList{ |
||||
TypeMeta: o.TypeMeta, |
||||
Items: make([]TimeInterval, len(o.Items)), |
||||
} |
||||
o.ListMeta.DeepCopyInto(&cpy.ListMeta) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
if item, ok := o.Items[i].Copy().(*TimeInterval); ok { |
||||
cpy.Items[i] = *item |
||||
} |
||||
} |
||||
return cpy |
||||
} |
||||
|
||||
func (o *TimeIntervalList) GetItems() []resource.Object { |
||||
items := make([]resource.Object, len(o.Items)) |
||||
for i := 0; i < len(o.Items); i++ { |
||||
items[i] = &o.Items[i] |
||||
} |
||||
return items |
||||
} |
||||
|
||||
func (o *TimeIntervalList) SetItems(items []resource.Object) { |
||||
o.Items = make([]TimeInterval, len(items)) |
||||
for i := 0; i < len(items); i++ { |
||||
o.Items[i] = *items[i].(*TimeInterval) |
||||
} |
||||
} |
||||
|
||||
// Interface compliance compile-time check
|
||||
var _ resource.ListObject = &TimeIntervalList{} |
@ -0,0 +1,46 @@ |
||||
//
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
//
|
||||
|
||||
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{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 |
||||
}, |
||||
}, |
||||
})) |
||||
kindTimeInterval = resource.Kind{ |
||||
Schema: schemaTimeInterval, |
||||
Codecs: map[resource.KindEncoding]resource.Codec{ |
||||
resource.KindEncodingJSON: &JSONCodec{}, |
||||
}, |
||||
} |
||||
) |
||||
|
||||
// Kind returns a resource.Kind for this Schema with a JSON codec
|
||||
func Kind() resource.Kind { |
||||
return kindTimeInterval |
||||
} |
||||
|
||||
// Schema returns a resource.SimpleSchema representation of TimeInterval
|
||||
func Schema() *resource.SimpleSchema { |
||||
return schemaTimeInterval |
||||
} |
||||
|
||||
// Interface compliance checks
|
||||
var _ resource.Schema = kindTimeInterval |
@ -0,0 +1,26 @@ |
||||
package v0alpha1 |
||||
|
||||
// Interval defines model for Interval.
|
||||
// +k8s:openapi-gen=true
|
||||
type Interval struct { |
||||
DaysOfMonth []string `json:"days_of_month,omitempty"` |
||||
Location *string `json:"location,omitempty"` |
||||
Months []string `json:"months,omitempty"` |
||||
Times []TimeRange `json:"times,omitempty"` |
||||
Weekdays []string `json:"weekdays,omitempty"` |
||||
Years []string `json:"years,omitempty"` |
||||
} |
||||
|
||||
// Spec defines model for Spec.
|
||||
// +k8s:openapi-gen=true
|
||||
type Spec struct { |
||||
Name string `json:"name"` |
||||
TimeIntervals []Interval `json:"time_intervals"` |
||||
} |
||||
|
||||
// TimeRange defines model for TimeRange.
|
||||
// +k8s:openapi-gen=true
|
||||
type TimeRange struct { |
||||
EndTime string `json:"end_time"` |
||||
StartTime string `json:"start_time"` |
||||
} |
@ -0,0 +1,70 @@ |
||||
package v0alpha1 |
||||
|
||||
// Defines values for OperatorStateState.
|
||||
const ( |
||||
OperatorStateStateFailed OperatorStateState = "failed" |
||||
OperatorStateStateInProgress OperatorStateState = "in_progress" |
||||
OperatorStateStateSuccess OperatorStateState = "success" |
||||
) |
||||
|
||||
// Defines values for StatusOperatorStateState.
|
||||
const ( |
||||
StatusOperatorStateStateFailed StatusOperatorStateState = "failed" |
||||
StatusOperatorStateStateInProgress StatusOperatorStateState = "in_progress" |
||||
StatusOperatorStateStateSuccess StatusOperatorStateState = "success" |
||||
) |
||||
|
||||
// OperatorState defines model for OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State OperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// OperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type OperatorStateState string |
||||
|
||||
// Status defines model for Status.
|
||||
// +k8s:openapi-gen=true
|
||||
type Status struct { |
||||
// additionalFields is reserved for future use
|
||||
AdditionalFields map[string]interface{} `json:"additionalFields,omitempty"` |
||||
|
||||
// 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.
|
||||
OperatorStates map[string]StatusOperatorState `json:"operatorStates,omitempty"` |
||||
} |
||||
|
||||
// StatusOperatorState defines model for status.#OperatorState.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorState struct { |
||||
// descriptiveState is an optional more descriptive state field which has no requirements on format
|
||||
DescriptiveState *string `json:"descriptiveState,omitempty"` |
||||
|
||||
// details contains any extra information that is operator-specific
|
||||
Details map[string]interface{} `json:"details,omitempty"` |
||||
|
||||
// lastEvaluation is the ResourceVersion last evaluated
|
||||
LastEvaluation string `json:"lastEvaluation"` |
||||
|
||||
// state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
State StatusOperatorStateState `json:"state"` |
||||
} |
||||
|
||||
// StatusOperatorStateState state describes the state of the lastEvaluation.
|
||||
// It is limited to three possible states for machine evaluation.
|
||||
// +k8s:openapi-gen=true
|
||||
type StatusOperatorStateState string |
@ -0,0 +1,422 @@ |
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Code generated by grafana-app-sdk. DO NOT EDIT.
|
||||
|
||||
package v0alpha1 |
||||
|
||||
import ( |
||||
common "k8s.io/kube-openapi/pkg/common" |
||||
spec "k8s.io/kube-openapi/pkg/validation/spec" |
||||
) |
||||
|
||||
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { |
||||
return map[string]common.OpenAPIDefinition{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Interval": schema_apis_resource_timeinterval_v0alpha1_Interval(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.OperatorState": schema_apis_resource_timeinterval_v0alpha1_OperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Spec": schema_apis_resource_timeinterval_v0alpha1_Spec(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Status": schema_apis_resource_timeinterval_v0alpha1_Status(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.StatusOperatorState": schema_apis_resource_timeinterval_v0alpha1_StatusOperatorState(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeInterval": schema_apis_resource_timeinterval_v0alpha1_TimeInterval(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeIntervalList": schema_apis_resource_timeinterval_v0alpha1_TimeIntervalList(ref), |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeRange": schema_apis_resource_timeinterval_v0alpha1_TimeRange(ref), |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_Interval(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Interval defines model for Interval.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"days_of_month": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"location": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"months": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"times": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeRange"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"weekdays": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"years": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeRange"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_OperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "OperatorState defines model for OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_Spec(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Spec defines model for Spec.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"name": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"time_intervals": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Interval"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"name", "time_intervals"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Interval"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_Status(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Status defines model for Status.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"additionalFields": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "additionalFields is reserved for future use", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"operatorStates": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
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: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.StatusOperatorState"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.StatusOperatorState"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_StatusOperatorState(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "StatusOperatorState defines model for status.#OperatorState.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"descriptiveState": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "descriptiveState is an optional more descriptive state field which has no requirements on format", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"details": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "details contains any extra information that is operator-specific", |
||||
Type: []string{"object"}, |
||||
AdditionalProperties: &spec.SchemaOrBool{ |
||||
Allows: true, |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
"lastEvaluation": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "lastEvaluation is the ResourceVersion last evaluated", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"state": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "state describes the state of the lastEvaluation. It is limited to three possible states for machine evaluation.", |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"lastEvaluation", "state"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_TimeInterval(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), |
||||
}, |
||||
}, |
||||
"spec": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Spec"), |
||||
}, |
||||
}, |
||||
"status": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Status"), |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "spec", "status"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Spec", "github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.Status", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_TimeIntervalList(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"kind": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"apiVersion": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"metadata": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), |
||||
}, |
||||
}, |
||||
"items": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Type: []string{"array"}, |
||||
Items: &spec.SchemaOrArray{ |
||||
Schema: &spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: map[string]interface{}{}, |
||||
Ref: ref("github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeInterval"), |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"metadata", "items"}, |
||||
}, |
||||
}, |
||||
Dependencies: []string{ |
||||
"github.com/grafana/grafana/apps/alerting/notifications/pkg/apis/resource/timeinterval/v0alpha1.TimeInterval", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, |
||||
} |
||||
} |
||||
|
||||
func schema_apis_resource_timeinterval_v0alpha1_TimeRange(ref common.ReferenceCallback) common.OpenAPIDefinition { |
||||
return common.OpenAPIDefinition{ |
||||
Schema: spec.Schema{ |
||||
SchemaProps: spec.SchemaProps{ |
||||
Description: "TimeRange defines model for TimeRange.", |
||||
Type: []string{"object"}, |
||||
Properties: map[string]spec.Schema{ |
||||
"end_time": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
"start_time": { |
||||
SchemaProps: spec.SchemaProps{ |
||||
Default: "", |
||||
Type: []string{"string"}, |
||||
Format: "", |
||||
}, |
||||
}, |
||||
}, |
||||
Required: []string{"end_time", "start_time"}, |
||||
}, |
||||
}, |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
package resource |
||||
|
||||
import "k8s.io/apimachinery/pkg/runtime/schema" |
||||
|
||||
var GroupVersion = schema.GroupVersion{Group: "notifications.alerting.grafana.app", Version: "v0alpha1"} |
@ -0,0 +1,150 @@ |
||||
--- |
||||
aliases: |
||||
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-rule/ |
||||
- ../unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ |
||||
- ../unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ |
||||
- ../alerting-rules/create-mimir-loki-managed-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-mimir-loki-managed-rule/ |
||||
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-data-source-managed-rule/ |
||||
description: Configure data source-managed alert rules alert for an external Grafana Mimir or Loki instance |
||||
keywords: |
||||
- grafana |
||||
- alerting |
||||
- guide |
||||
- rules |
||||
- create |
||||
labels: |
||||
products: |
||||
- cloud |
||||
- enterprise |
||||
- oss |
||||
title: Configure data source-managed alert rules |
||||
weight: 200 |
||||
refs: |
||||
configure-grafana-managed-rules: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/create-grafana-managed-rule/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/create-grafana-managed-rule/notification-policies/ |
||||
notification-policies: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/notifications/notification-policies/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/notifications/notification-policies/ |
||||
pending-period: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rule-evaluation/#pending-period |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rule-evaluation/#pending-period |
||||
alert-rules: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/ |
||||
alert-rule-labels: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#labels |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#labels |
||||
alert-rule-evaluation: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rule-evaluation/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rule-evaluation/ |
||||
shared-provision-alerting-resources: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/set-up/provision-alerting-resources/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/set-up/provision-alerting-resources/ |
||||
shared-alert-rule-template: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/templates/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/templates/ |
||||
shared-annotations: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/#annotations |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/#annotations |
||||
shared-link-alert-rules-to-panels: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ |
||||
--- |
||||
|
||||
# Configure data source-managed alert rules |
||||
|
||||
Data source-managed alert rules can only query Prometheus-based data sources, such as Prometheus, Grafana Mimir, or Grafana Loki. They are one of the two [alert rule types](ref:alert-rules) supported in Grafana. |
||||
|
||||
Data source-managed alert rules are stored within the data source. In a distributed architecture, they can scale horizontally to provide high-availability. |
||||
|
||||
We recommend using [Grafana-managed alert rules](ref:configure-grafana-managed-rules) whenever possible and opting for data source-managed alert rules when scaling your alerting setup is necessary. |
||||
|
||||
To create or edit data source-managed alert rules, follow these instructions. |
||||
|
||||
## Before you begin |
||||
|
||||
Verify that you have write permission to the Prometheus, Mimir, or Loki data source. Otherwise, you cannot create or update data source-managed alert rules. |
||||
|
||||
### Enable the Ruler API |
||||
|
||||
For more information, refer to the [Mimir Ruler API](/docs/mimir/latest/references/http-api/#ruler) or [Loki Ruler API](/docs/loki/latest/api/#ruler). |
||||
|
||||
- **Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API. |
||||
|
||||
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types. |
||||
|
||||
### Permissions |
||||
|
||||
Alert rules for Prometheus, Mimir, or Loki instances can be edited or deleted by users with **Editor** or **Admin** roles. |
||||
|
||||
If you do not want to manage alert rules for a particular data source, go to its settings and clear the **Manage alerts via Alerting UI** checkbox. |
||||
|
||||
{{< docs/shared lookup="alerts/configure-provisioning-before-begin.md" source="grafana" version="<GRAFANA_VERSION>" >}} |
||||
|
||||
{{< docs/shared lookup="alerts/configure-alert-rule-name.md" source="grafana" version="<GRAFANA_VERSION>" >}} |
||||
|
||||
## Define query and condition |
||||
|
||||
Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires. |
||||
|
||||
{{% admonition type="note" %}} |
||||
By default, new alert rules are Grafana-managed. To switch to **Data source-managed**, follow these instructions. |
||||
{{% /admonition %}} |
||||
|
||||
1. Select a Prometheus-based data source from the drop-down list. |
||||
|
||||
You can also click **Open advanced data source picker** to find more options. |
||||
|
||||
1. Enter a PromQL or LogQL query, including the alert condition. |
||||
1. In the **Rule type** option, select **Data source-managed**. |
||||
1. Click **Preview alerts**. |
||||
|
||||
## Set alert evaluation behavior |
||||
|
||||
Use [alert rule evaluation](ref:alert-rule-evaluation) to determine how frequently an alert rule should be evaluated and how quickly it should change its state. |
||||
|
||||
1. Select a namespace or click **+ New namespace**. |
||||
1. Select an evaluation group or click **+ New evaluation group**. |
||||
|
||||
If you are creating a new evaluation group, specify the interval for the group. |
||||
|
||||
All rules within the same group are evaluated sequentially over the same time interval. |
||||
|
||||
1. Enter a pending period. |
||||
|
||||
The [pending period](ref:pending-period) is the period in which an alert rule can be in breach of the condition until it fires. |
||||
|
||||
Once a condition is met, the alert goes into the **Pending** state. If the condition remains active for the duration specified, the alert transitions to the **Firing** state, else it reverts to the **Normal** state. |
||||
|
||||
## Configure labels and notifications |
||||
|
||||
Add [labels](ref:alert-rule-labels) to your alert rules to set which [notification policy](ref:notification-policies) should handle your firing alert instances. |
||||
|
||||
All alert rules and instances, irrespective of their labels, match the default notification policy. If there are no nested policies, or no nested policies match the labels in the alert rule or alert instance, then the default notification policy is the matching policy. |
||||
|
||||
1. Add labels if you want to change the way your notifications are routed. |
||||
|
||||
Add custom labels by selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value. |
||||
|
||||
{{< docs/shared lookup="alerts/configure-notification-message.md" source="grafana" version="<GRAFANA_VERSION>" >}} |
@ -1,144 +0,0 @@ |
||||
--- |
||||
aliases: |
||||
- ../unified-alerting/alerting-rules/create-mimir-loki-managed-rule/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/create-mimir-loki-managed-rule/ |
||||
- ../unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-cortex-loki-namespace-group/ |
||||
- ../unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ # /docs/grafana/<GRAFANA_VERSION>/alerting/unified-alerting/alerting-rules/edit-mimir-loki-namespace-group/ |
||||
canonical: https://grafana.com/docs/grafana/latest/alerting/alerting-rules/create-mimir-loki-managed-rule/ |
||||
description: Configure data source-managed alert rules alert for an external Grafana Mimir or Loki instance |
||||
keywords: |
||||
- grafana |
||||
- alerting |
||||
- guide |
||||
- rules |
||||
- create |
||||
labels: |
||||
products: |
||||
- cloud |
||||
- enterprise |
||||
- oss |
||||
title: Configure data source-managed alert rules |
||||
weight: 200 |
||||
refs: |
||||
alerting: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/ |
||||
annotation-label: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/fundamentals/alert-rules/annotation-label/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/annotation-label/ |
||||
link-alert-rules-to-panels: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/alerting/alerting-rules/link-alert-rules-to-panels/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana-cloud/alerting-and-irm/alerting/alerting-rules/link-alert-rules-to-panels/ |
||||
--- |
||||
|
||||
# Configure data source-managed alert rules |
||||
|
||||
Create data source-managed alert rules for Grafana Mimir or Grafana Loki data sources, which have been configured to support rule creation. |
||||
|
||||
To configure your Grafana Mimir or Loki data source for alert rule creation, enable either the Loki Ruler API or the Mimir Ruler API. |
||||
|
||||
For more information, refer to [Loki Ruler API](/docs/loki/<GRAFANA_VERSION>/api/#ruler) or [Mimir Ruler API](/docs/mimir/<GRAFANA_VERSION>/references/http-api/#ruler). |
||||
|
||||
**Note**: |
||||
|
||||
Alert rules for a Grafana Mimir or Loki instance can be edited or deleted by users with Editor or Admin roles. |
||||
|
||||
If you delete an alerting resource created in the UI, you can no longer retrieve it. |
||||
To make a backup of your configuration and to be able to restore deleted alerting resources, create your alerting resources using file provisioning, Terraform, or the Alerting API. |
||||
|
||||
## Before you begin |
||||
|
||||
- Verify that you have write permission to the Mimir or Loki data source. Otherwise, you cannot create or update Grafana Mimir or Loki-managed alert rules. |
||||
|
||||
- Enable the Mimir or Loki Ruler API. |
||||
|
||||
- **Loki** - The `local` rule storage type, default for the Loki data source, supports only viewing of rules. To edit rules, configure one of the other rule storage types. |
||||
|
||||
- **Grafana Mimir** - use the `/prometheus` prefix. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the [Query API](/docs/mimir/latest/operators-guide/reference-http-api/#querier--query-frontend) and [Ruler API](/docs/mimir/latest/operators-guide/reference-http-api/#ruler) are under the same URL. You cannot provide a separate URL for the Ruler API. |
||||
|
||||
Watch this video to learn more about how to create a Mimir-managed alert rule: {{< vimeo 720001865 >}} |
||||
|
||||
{{% admonition type="note" %}} |
||||
If you do not want to manage alert rules for a particular Loki or Mimir data source, go to its settings and clear the **Manage alerts via Alerting UI** checkbox. |
||||
{{% /admonition %}} |
||||
|
||||
To create a data source-managed alert rule, use the in-product alert creation flow and follow these steps to help you. |
||||
|
||||
## Set alert rule name |
||||
|
||||
1. Click **Alerts & IRM** -> **Alert rules** -> **+ New alert rule**. |
||||
1. Enter a name to identify your alert rule. |
||||
|
||||
This name is displayed in the alert rule list. It is also the `alertname` label for every alert instance that is created from this rule. |
||||
|
||||
## Define query and condition |
||||
|
||||
Define a query to get the data you want to measure and a condition that needs to be met before an alert rule fires. |
||||
|
||||
**Note**: |
||||
|
||||
All alert rules are managed by Grafana by default. To switch to a data source-managed alert rule, click **Switch to data source-managed alert rule**. |
||||
|
||||
1. Select a data source from the drop-down list. |
||||
|
||||
You can also click **Open advanced data source picker** to see more options, including adding a data source (Admins only). |
||||
|
||||
1. Enter a PromQL or LogQL query. |
||||
1. Click **Preview alerts**. |
||||
|
||||
## Set alert evaluation behavior |
||||
|
||||
Use alert rule evaluation to determine how frequently an alert rule should be evaluated and how quickly it should change its state. |
||||
|
||||
1. Select a namespace or click **+ New namespace**. |
||||
1. Select an evaluation group or click **+ New evaluation group**. |
||||
|
||||
If you are creating a new evaluation group, specify the interval for the group. |
||||
|
||||
All rules within the same group are evaluated sequentially over the same time interval. |
||||
|
||||
1. Enter a pending period. |
||||
|
||||
The pending period is the period in which an alert rule can be in breach of the condition until it fires. |
||||
|
||||
Once a condition is met, the alert goes into the **Pending** state. If the condition remains active for the duration specified, the alert transitions to the **Firing** state, else it reverts to the **Normal** state. |
||||
|
||||
## Configure notifications |
||||
|
||||
Add labels to your alert rules to set which notification policy should handle your firing alert instances. |
||||
|
||||
All alert rules and instances, irrespective of their labels, match the default notification policy. If there are no nested policies, or no nested policies match the labels in the alert rule or alert instance, then the default notification policy is the matching policy. |
||||
|
||||
1. Add labels if you want to change the way your notifications are routed. |
||||
|
||||
Add custom labels by selecting existing key-value pairs from the drop down, or add new labels by entering the new key or value. |
||||
|
||||
## Add annotations |
||||
|
||||
Add [annotations](ref:annotation-label). to provide more context on the alert in your alert notifications. |
||||
|
||||
Annotations add metadata to provide more information on the alert in your alert notifications. For example, add a **Summary** annotation to tell you which value caused the alert to fire or which server it happened on. |
||||
|
||||
1. Optional: Add a summary. |
||||
|
||||
Short summary of what happened and why. |
||||
|
||||
1. Optional: Add a description. |
||||
|
||||
Description of what the alert rule does. |
||||
|
||||
1. Optional: Add a Runbook URL. |
||||
|
||||
Webpage where you keep your runbook for the alert |
||||
|
||||
1. Optional: Add a custom annotation |
||||
1. Optional: **Link dashboard and panel**. |
||||
|
||||
[Link the alert rule to a panel](ref:link-alert-rules-to-panels) to facilitate alert investigation. |
||||
|
||||
1. Click **Save rule**. |
@ -0,0 +1,13 @@ |
||||
--- |
||||
labels: |
||||
products: |
||||
- oss |
||||
title: 'Set alert rule name' |
||||
--- |
||||
|
||||
## Set alert rule name |
||||
|
||||
1. Click **Alerts & IRM** -> **Alert rules** -> **+ New alert rule**. |
||||
1. Enter a name to identify your alert rule. |
||||
|
||||
This name is displayed in the alert rule list. It is also the `alertname` label for every alert instance that is created from this rule. |
@ -0,0 +1,36 @@ |
||||
--- |
||||
labels: |
||||
products: |
||||
- oss |
||||
title: 'Configure notification message' |
||||
--- |
||||
|
||||
## Configure notification message |
||||
|
||||
Use [annotations](ref:shared-annotations) to add information to alert messages that can help respond to the alert. |
||||
|
||||
Annotations are included by default in notification messages, and can use text or [templates](ref:shared-alert-rule-template) to display dynamic data from queries. |
||||
|
||||
Grafana provides several optional annotations. |
||||
|
||||
1. Optional: Add a summary. |
||||
|
||||
Short summary of what happened and why. |
||||
|
||||
1. Optional: Add a description. |
||||
|
||||
Description of what the alert rule does. |
||||
|
||||
1. Optional: Add a Runbook URL. |
||||
|
||||
Webpage where you keep your runbook for the alert |
||||
|
||||
1. Optional: Add a custom annotation. |
||||
|
||||
Add any additional information that could help address the alert. |
||||
|
||||
1. Optional: **Link dashboard and panel**. |
||||
|
||||
[Link the alert rule to a panel](ref:shared-link-alert-rules-to-panels) to facilitate alert investigation. |
||||
|
||||
1. Click **Save rule**. |
@ -0,0 +1,12 @@ |
||||
--- |
||||
labels: |
||||
products: |
||||
- oss |
||||
title: 'Provisioning' |
||||
--- |
||||
|
||||
### Provisioning |
||||
|
||||
Note that if you delete an alert resource created in the UI, you can no longer retrieve it. |
||||
|
||||
To backup and manage alert rules, you can [provision alerting resources](ref:shared-provision-alerting-resources) using options such as configuration files, Terraform, or the Alerting API. |
@ -0,0 +1,14 @@ |
||||
--- |
||||
labels: |
||||
products: |
||||
- oss |
||||
title: 'Table configure no data and error' |
||||
--- |
||||
|
||||
| Configure | Set alert state | Description | |
||||
| ------------ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
||||
| NoData | No Data | The default option for **No Data** events.<br/>Sets alert instance state to `No data`. <br/> The alert rule also creates a new alert instance `DatasourceNoData` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. | |
||||
| Error | Error | The default option for **Error** events.<br/>Sets alert instance state to `Error`. <br/> The alert rule also creates a new alert instance `DatasourceError` with the name and UID of the alert rule, and UID of the datasource that returned no data as labels. | |
||||
| NoData/Error | Alerting | Sets the alert instance state to `Pending` and then transitions to `Alerting` once the pending period ends. If you sent the pending period to 0, the alert instance state is immediately set to `Alerting`. | |
||||
| NoData/Error | Normal | Sets alert instance state to `Normal`. | |
||||
| NoData/Error | Keep Last State | Maintains the alert instance in its last state. Useful for mitigating temporary issues. | |
@ -0,0 +1,22 @@ |
||||
--- |
||||
description: Guide for upgrading to Grafana v11.4 |
||||
keywords: |
||||
- grafana |
||||
- configuration |
||||
- documentation |
||||
- upgrade |
||||
- '11.4' |
||||
title: Upgrade to Grafana v11.4 |
||||
menuTitle: Upgrade to v11.4 |
||||
weight: 800 |
||||
--- |
||||
|
||||
# Upgrade to Grafana v11.4 |
||||
|
||||
{{< docs/shared lookup="upgrade/intro.md" source="grafana" version="<GRAFANA_VERSION>" >}} |
||||
|
||||
{{< docs/shared lookup="back-up/back-up-grafana.md" source="grafana" version="<GRAFANA_VERSION>" leveloffset="+1" >}} |
||||
|
||||
{{< docs/shared lookup="upgrade/upgrade-common-tasks.md" source="grafana" version="<GRAFANA_VERSION>" >}} |
||||
|
||||
## Technical notes |
@ -0,0 +1,45 @@ |
||||
--- |
||||
description: Feature and improvement highlights for Grafana v11.4 |
||||
keywords: |
||||
- grafana |
||||
- new |
||||
- documentation |
||||
- '11.4' |
||||
- release notes |
||||
labels: |
||||
products: |
||||
- cloud |
||||
- enterprise |
||||
- oss |
||||
title: What's new in Grafana v11.4 |
||||
weight: -46 |
||||
--- |
||||
|
||||
<!-- vale GoogleWe = NO --> |
||||
<!-- vale We = NO --> |
||||
|
||||
# What’s new in Grafana v11.4 |
||||
|
||||
Welcome to Grafana 11.4! This is a special release with one new feature, created in partnership with AWS. We’ve made improvements to Cloudwatch so you can query your logs using two additional query languages: Opensearch PPL and Opensearch SQL. We’ve also updated the querying experience by providing a sample of commonly-used queries, syntax highlighting in the query editor, and auto-completion suggestions for complex queries. Read on to learn more about this new feature. |
||||
|
||||
For even more detail about all the changes in this release, refer to the [changelog](https://github.com/grafana/grafana/blob/main/CHANGELOG.md). For the specific steps we recommend when you upgrade to v11.4, check out our [Upgrade Guide](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/upgrade-guide/upgrade-v11.4/). |
||||
|
||||
## Query Cloudwatch Logs Insights with PPL and SQL |
||||
|
||||
<!-- Ida Štambuk, Zoe Chou --> |
||||
|
||||
_Generally available in all editions of Grafana_ |
||||
|
||||
The AWS CloudWatch data source plugin now offers two new query languages for searching through logs: OpenSearch PPL and OpenSearch SQL. You now have increased flexibility to choose a more familiar query language and to take advantage of their unique features (like the SQL JOIN command) when querying AWS CloudWatch Logs Insights. In addition to the already supported **Logs Insights QL** option, you can find the added query language options in the new **Query language** drop-down list. |
||||
|
||||
 |
||||
|
||||
We’ve also updated the query editor to support syntax highlighting and to provide suggestions while you type, which simplifies writing complex queries. When you select log groups, the suggestions also include [discovered fields](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData-discoverable-fields.html). |
||||
|
||||
Not sure where to start? We’ve also updated our **CloudWatch Logs cheat sheet** with the most commonly used queries so you can paste and customize to fit exactly what you need. Clicking on any of the example queries prefills the query input field. |
||||
|
||||
 |
||||
|
||||
For the complete list of commands supported for OpenSearch PPL and SQL, refer to the [Cloudwatch Logs Insights documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html). |
||||
|
||||
{{< youtube id="g1BfokyzF4Q" >}} |
@ -1,5 +1,5 @@ |
||||
{ |
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json", |
||||
"npmClient": "yarn", |
||||
"version": "11.4.0-pre" |
||||
"version": "11.5.0-pre" |
||||
} |
||||
|
@ -0,0 +1,61 @@ |
||||
import { createContext, useContext } from 'react'; |
||||
import { useObservable } from 'react-use'; |
||||
import { Observable } from 'rxjs'; |
||||
|
||||
import { Scope } from '@grafana/data'; |
||||
|
||||
export interface ScopesContextValueState { |
||||
drawerOpened: boolean; |
||||
enabled: boolean; |
||||
loading: boolean; |
||||
readOnly: boolean; |
||||
value: Scope[]; |
||||
} |
||||
|
||||
export interface ScopesContextValue { |
||||
/** |
||||
* Current state. |
||||
*/ |
||||
state: ScopesContextValueState; |
||||
|
||||
/** |
||||
* Observable that emits the current state. |
||||
*/ |
||||
stateObservable: Observable<ScopesContextValue['state']>; |
||||
|
||||
/** |
||||
* Change the selected scopes. The service takes care about loading them and propagating the changes. |
||||
* @param scopeNames |
||||
*/ |
||||
changeScopes(scopeNames: string[]): void; |
||||
|
||||
/** |
||||
* Set read-only mode. |
||||
* If `readOnly` is `true`, the selector will be set to read-only and the dashboards panel will be closed. |
||||
*/ |
||||
setReadOnly(readOnly: boolean): void; |
||||
|
||||
/** |
||||
* Enable or disable the usage of scopes. |
||||
* This will hide the selector and the dashboards panel, and it will stop propagating the scopes to the query object. |
||||
*/ |
||||
setEnabled(enabled: boolean): void; |
||||
} |
||||
|
||||
export const ScopesContext = createContext<ScopesContextValue | undefined>(undefined); |
||||
|
||||
export function useScopes(): ScopesContextValue | undefined { |
||||
const context = useContext(ScopesContext); |
||||
|
||||
useObservable(context?.stateObservable ?? new Observable(), context?.state); |
||||
|
||||
return context |
||||
? { |
||||
state: context.state, |
||||
stateObservable: context.stateObservable, |
||||
changeScopes: context.changeScopes, |
||||
setReadOnly: context.setReadOnly, |
||||
setEnabled: context.setEnabled, |
||||
} |
||||
: undefined; |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue