Provisioning: Sync API with current feature branch (#100252)

* Provisioning: Jobs: Define repository name field

* Provisioning: Jobs: Separate options per job type

* Provisioning: Define a sanitised settings resource

* Provisioning: Jobs: Define a job summary

* Provisioning: Remove linting

* Provisioning: Update docs for a few fields

* Provisioning: Remove HelloWorld

* Provisioning: Replace Repository with Message in job info

* Provisioning: Remove YAML support

* Provisioning: Remove custom folder specification

* Provisioning: Support read-only repositories

* Provisioning: Remove edit options

* Provisioning: Add sync options for repositories

* Provisioning: Add resource statistics

* Provisioning: Make slices atomic lists

* Provisioning: Message list needs to exist even if empty

If we don't do this, we can't clear the messages field, leading to buggy UX.

* Provisioning: Support incremental syncing

* Provisioning: Remove the 'items' subresource workaround

* Provisioning: Add resource list

* Provisioning: Reformat

* Provisioning: Declare new types

* OpenAPI: Generate openapi JSON spec from generated code

* Codegen: Generate OpenAPI spec

* Provisioning: Support generating frontend API

* Codegen: Generate Go code

* Provisioning: Define the base API

* Codegen: Generate frontend endpoints for provisioning

* Refactor: yarn prettier:write

* Provisioning: Tiger team takes ownership

* Chore: Remove dir we haven't added yet

* Provisioning: Remove frontend

* Test: Update example repositories
This commit is contained in:
Mariell Hoversholm 2025-02-07 15:35:55 +01:00 committed by GitHub
parent 9d7a4a53e4
commit dfaa12b800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 3516 additions and 286 deletions

3
.github/CODEOWNERS vendored
View File

@ -66,6 +66,9 @@
/scripts/go-workspace @grafana/grafana-app-platform-squad
/hack/ @grafana/grafana-app-platform-squad
/pkg/apis/provisioning @grafana/grafana-git-ui-sync-team
/pkg/registry/apis/provisioning @grafana/grafana-git-ui-sync-team
/apps/alerting/ @grafana/alerting-backend
/apps/playlist/ @grafana/grafana-app-platform-squad
/apps/investigation/ @fcjack @matryer

View File

@ -60,6 +60,20 @@ func (j JobState) Finished() bool {
type JobSpec struct {
Action JobAction `json:"action"`
// The the repository reference (for now also in labels)
Repository string `json:"repository"`
// Pull request options
PullRequest *PullRequestJobOptions `json:"pr,omitempty"`
// Required when the action is `export`
Export *ExportJobOptions `json:"export,omitempty"`
// Required when the action is `sync`
Sync *SyncJobOptions `json:"sync,omitempty"`
}
type PullRequestJobOptions struct {
// The branch of commit hash
Ref string `json:"ref,omitempty"`
@ -71,6 +85,28 @@ type JobSpec struct {
URL string `json:"url,omitempty"`
}
type SyncJobOptions struct {
// Incremental synchronization for versioned repositories
Incremental bool `json:"incremental"`
}
type ExportJobOptions struct {
// The source folder (or empty) to export
Folder string `json:"folder,omitempty"`
// Preserve history (if possible)
History bool `json:"history,omitempty"`
// Target branch for export (only git)
Branch string `json:"branch,omitempty"`
// Target file prefix
Prefix string `json:"prefix,omitempty"`
// Include the identifier in the exported metadata
Identifier bool `json:"identifier"`
}
// The job status
type JobStatus struct {
State JobState `json:"state,omitempty"`
@ -78,6 +114,30 @@ type JobStatus struct {
Finished int64 `json:"finished,omitempty"`
Message string `json:"message,omitempty"`
Errors []string `json:"errors,omitempty"`
// Optional value 0-100 that can be set while running
Progress float64 `json:"progress,omitempty"`
// Summary of processed actions
Summary []JobResourceSummary `json:"summary,omitempty"`
}
type JobResourceSummary struct {
Group string `json:"group,omitempty"`
Resource string `json:"resource,omitempty"`
Create int64 `json:"create,omitempty"`
Update int64 `json:"update,omitempty"`
Delete int64 `json:"delete,omitempty"`
Write int64 `json:"write,omitempty"` // Create or update (export)
Error int64 `json:"error,omitempty"` // The error count
// No action required (useful for sync)
Noop int64 `json:"noop,omitempty"`
// Report errors for this resource type
// This may not be an exhaustive list and recommend looking at the logs for more info
Errors []string `json:"errors,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

View File

@ -66,7 +66,7 @@ var JobResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
{Name: "Created At", Type: "date"},
{Name: "Action", Type: "string"},
{Name: "State", Type: "string"},
{Name: "Repository", Type: "string"},
{Name: "Message", Type: "string"},
},
Reader: func(obj any) ([]interface{}, error) {
m, ok := obj.(*Job)
@ -79,7 +79,7 @@ var JobResourceInfo = utils.NewResourceInfo(GROUP, VERSION,
m.CreationTimestamp.UTC().Format(time.RFC3339),
m.Spec.Action,
m.Status.State,
m.Labels["repository"],
m.Status.Message,
}, nil
},
})
@ -111,12 +111,13 @@ func AddKnownTypes(gv schema.GroupVersion, scheme *runtime.Scheme) error {
scheme.AddKnownTypes(gv,
&Repository{},
&RepositoryList{},
&HelloWorld{},
&WebhookResponse{},
&ResourceWrapper{},
&FileList{},
&HistoryList{},
&TestResults{},
&ResourceList{},
&ResourceStats{},
&Job{},
&JobList{},
)

View File

@ -0,0 +1,31 @@
package v0alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// Summary shows a view of the configuration that is sanitized and is OK for logged in users to see
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type RepositoryViewList struct {
metav1.TypeMeta `json:",inline"`
// +mapType=atomic
Items []RepositoryView `json:"items"`
}
type RepositoryView struct {
// The k8s name for this repository
Name string `json:"name"`
// Repository display
Title string `json:"title"`
// Edit options within the repository
ReadOnly bool `json:"readOnly"`
// The repository type
Type RepositoryType `json:"type"`
// When syncing, where values are saved
Target SyncTargetType `json:"target"`
}

View File

@ -54,9 +54,6 @@ type GitHubRepositoryConfig struct {
// By default, this is false (i.e. we will not create previews).
// This option is a no-op if BranchWorkflow is `false` or default.
GenerateDashboardPreviews bool `json:"generateDashboardPreviews,omitempty"`
// PullRequestLinter enables the dashboard linter for this repository in Pull Requests
PullRequestLinter bool `json:"pullRequestLinter,omitempty"`
}
// RepositoryType defines the types of Repository
@ -71,51 +68,66 @@ const (
)
type RepositorySpec struct {
// Describe the feature toggle
// The repository display name (shown in the UI)
Title string `json:"title"`
// Describe the feature toggle
// Repository description
Description string `json:"description,omitempty"`
// The folder that is backed by the repository.
// The value is a reference to the Kubernetes metadata name of the folder in the same namespace.
Folder string `json:"folder,omitempty"`
// ReadOnly repository does not allow any write commands
ReadOnly bool `json:"readOnly"`
// Should we prefer emitting YAML for this repository, e.g. upon export?
// Editing existing dashboards will continue to emit the file format used in the repository. (TODO: implement this)
// If you delete and then recreate a dashboard, it will switch to the preferred format.
PreferYAML bool `json:"preferYaml,omitempty"`
// Edit options within the repository
Editing EditingOptions `json:"editing"`
// Sync settings -- how values are pulled from the repository into grafana
Sync SyncOptions `json:"sync"`
// The repository type. When selected oneOf the values below should be non-nil
Type RepositoryType `json:"type"`
// Linting enables linting for this repository
Linting bool `json:"linting,omitempty"`
// The repository on the local file system.
// Mutually exclusive with s3 and github.
// Mutually exclusive with local | s3 | github.
Local *LocalRepositoryConfig `json:"local,omitempty"`
// The repository in an S3 bucket.
// Mutually exclusive with local and github.
// Mutually exclusive with local | s3 | github.
S3 *S3RepositoryConfig `json:"s3,omitempty"`
// The repository on GitHub.
// Mutually exclusive with local and s3.
// Mutually exclusive with local | s3 | github.
// TODO: github or just 'git'??
GitHub *GitHubRepositoryConfig `json:"github,omitempty"`
}
type EditingOptions struct {
// End users can create new files in the remote file system
Create bool `json:"create"`
// End users can update existing files in the remote file system
Update bool `json:"update"`
// End users can delete existing files in the remote file system
Delete bool `json:"delete"`
// SyncTargetType defines where we want all values to resolve
// +enum
type SyncTargetType string
// RepositoryType values
const (
// Resources are saved in the global context
// Only one repository may specify the `instance` target
// When this exists, the UI will promote writing to the instance repo
// rather than the grafana database (where possible)
SyncTargetTypeInstance SyncTargetType = "instance"
// Resources will be saved into a folder managed by this repository
// The folder k8s name will be the same as the repository k8s name
// It will contain a copy of everything from the remote
SyncTargetTypeFolder SyncTargetType = "folder"
)
type SyncOptions struct {
// Enabled must be saved as true before any sync job will run
Enabled bool `json:"enabled"`
// Where values should be saved
Target SyncTargetType `json:"target"`
// Shared folder target
// The value is a reference to the Kubernetes metadata name of the folder in the same namespace
// Folder string `json:"folder,omitempty"`
// When non-zero, the sync will run periodically
IntervalSeconds int64 `json:"intervalSeconds,omitempty"`
}
// The status of a Repository.
@ -131,6 +143,10 @@ type RepositoryStatus struct {
// Sync information with the last sync information
Sync SyncStatus `json:"sync"`
// The object count when sync last ran
// +listType=atomic
Stats []ResourceCount `json:"stats,omitempty"`
// Webhook Information (if applicable)
Webhook *WebhookStatus `json:"webhook"`
}
@ -143,6 +159,7 @@ type HealthStatus struct {
Checked int64 `json:"checked,omitempty"`
// Summary messages (will be shown to users)
// +listType=atomic
Message []string `json:"message,omitempty"`
}
@ -163,10 +180,14 @@ type SyncStatus struct {
Scheduled int64 `json:"scheduled,omitempty"`
// Summary messages (will be shown to users)
Message []string `json:"message,omitempty"`
// +listType=atomic
Message []string `json:"message"`
// The repository hash when the last sync ran
Hash string `json:"hash,omitempty"`
// Incremental synchronization for versioned repositories
Incremental bool `json:"incremental,omitempty"`
}
type WebhookStatus struct {
@ -181,16 +202,10 @@ type RepositoryList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// +listType=atomic
Items []Repository `json:"items,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type HelloWorld struct {
metav1.TypeMeta `json:",inline"`
Whom string `json:"whom,omitempty"`
}
// The kubernetes action required when loading a given resource
// +enum
type ResourceAction string
@ -223,9 +238,11 @@ type ResourceWrapper struct {
Resource ResourceObjects `json:"resource"`
// Lint results
// +listType=atomic
Lint []LintIssue `json:"lint,omitempty"`
// If errors exist, show them here
// +listType=atomic
Errors []string `json:"errors,omitempty"`
}
@ -282,9 +299,8 @@ type FileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// should be named "items", but avoid subresource error for now:
// kubernetes/kubernetes#126809
Items []FileItem `json:"files,omitempty"`
// +listType=atomic
Items []FileItem `json:"items,omitempty"`
}
type FileItem struct {
@ -295,6 +311,45 @@ type FileItem struct {
Author string `json:"author,omitempty"`
}
// Information we can get just from the file listing
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ResourceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// +listType=atomic
Items []ResourceListItem `json:"items,omitempty"`
}
type ResourceListItem struct {
Path string `json:"path"`
Group string `json:"group"`
Resource string `json:"resource"`
Name string `json:"name"` // the k8s identifier
Hash string `json:"hash"`
Time int64 `json:"time,omitempty"`
Title string `json:"title,omitempty"`
Folder string `json:"folder,omitempty"`
}
// Information we can get just from the file listing
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ResourceStats struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// +listType=atomic
Items []ResourceCount `json:"items,omitempty"`
}
type ResourceCount struct {
Repository string `json:"repository,omitempty"`
Group string `json:"group"`
Resource string `json:"resource"`
Count int64 `json:"count"`
}
// HistoryList is a list of versions of a resource
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type TestResults struct {
@ -319,8 +374,7 @@ type HistoryList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// should be named "items", but avoid subresource error for now:
// kubernetes/kubernetes#126809
// +listType=atomic
Items []HistoryItem `json:"items,omitempty"`
}
@ -331,8 +385,9 @@ type Author struct {
}
type HistoryItem struct {
Ref string `json:"ref"`
Message string `json:"message"`
Ref string `json:"ref"`
Message string `json:"message"`
// +listType=atomic
Authors []Author `json:"authors"`
CreatedAt int64 `json:"createdAt"`
}

View File

@ -28,17 +28,17 @@ func (in *Author) DeepCopy() *Author {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *EditingOptions) DeepCopyInto(out *EditingOptions) {
func (in *ExportJobOptions) DeepCopyInto(out *ExportJobOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EditingOptions.
func (in *EditingOptions) DeepCopy() *EditingOptions {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExportJobOptions.
func (in *ExportJobOptions) DeepCopy() *ExportJobOptions {
if in == nil {
return nil
}
out := new(EditingOptions)
out := new(ExportJobOptions)
in.DeepCopyInto(out)
return out
}
@ -127,31 +127,6 @@ func (in *HealthStatus) DeepCopy() *HealthStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HelloWorld) DeepCopyInto(out *HelloWorld) {
*out = *in
out.TypeMeta = in.TypeMeta
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HelloWorld.
func (in *HelloWorld) DeepCopy() *HelloWorld {
if in == nil {
return nil
}
out := new(HelloWorld)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HelloWorld) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HistoryItem) DeepCopyInto(out *HistoryItem) {
*out = *in
@ -211,7 +186,7 @@ func (in *Job) DeepCopyInto(out *Job) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
@ -267,9 +242,45 @@ func (in *JobList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobResourceSummary) DeepCopyInto(out *JobResourceSummary) {
*out = *in
if in.Errors != nil {
in, out := &in.Errors, &out.Errors
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JobResourceSummary.
func (in *JobResourceSummary) DeepCopy() *JobResourceSummary {
if in == nil {
return nil
}
out := new(JobResourceSummary)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *JobSpec) DeepCopyInto(out *JobSpec) {
*out = *in
if in.PullRequest != nil {
in, out := &in.PullRequest, &out.PullRequest
*out = new(PullRequestJobOptions)
**out = **in
}
if in.Export != nil {
in, out := &in.Export, &out.Export
*out = new(ExportJobOptions)
**out = **in
}
if in.Sync != nil {
in, out := &in.Sync, &out.Sync
*out = new(SyncJobOptions)
**out = **in
}
return
}
@ -291,6 +302,13 @@ func (in *JobStatus) DeepCopyInto(out *JobStatus) {
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Summary != nil {
in, out := &in.Summary, &out.Summary
*out = make([]JobResourceSummary, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
@ -336,6 +354,22 @@ func (in *LocalRepositoryConfig) DeepCopy() *LocalRepositoryConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PullRequestJobOptions) DeepCopyInto(out *PullRequestJobOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PullRequestJobOptions.
func (in *PullRequestJobOptions) DeepCopy() *PullRequestJobOptions {
if in == nil {
return nil
}
out := new(PullRequestJobOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Repository) DeepCopyInto(out *Repository) {
*out = *in
@ -400,7 +434,7 @@ func (in *RepositoryList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RepositorySpec) DeepCopyInto(out *RepositorySpec) {
*out = *in
out.Editing = in.Editing
out.Sync = in.Sync
if in.Local != nil {
in, out := &in.Local, &out.Local
*out = new(LocalRepositoryConfig)
@ -434,6 +468,11 @@ func (in *RepositoryStatus) DeepCopyInto(out *RepositoryStatus) {
*out = *in
in.Health.DeepCopyInto(&out.Health)
in.Sync.DeepCopyInto(&out.Sync)
if in.Stats != nil {
in, out := &in.Stats, &out.Stats
*out = make([]ResourceCount, len(*in))
copy(*out, *in)
}
if in.Webhook != nil {
in, out := &in.Webhook, &out.Webhook
*out = new(WebhookStatus)
@ -452,6 +491,115 @@ func (in *RepositoryStatus) DeepCopy() *RepositoryStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RepositoryView) DeepCopyInto(out *RepositoryView) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryView.
func (in *RepositoryView) DeepCopy() *RepositoryView {
if in == nil {
return nil
}
out := new(RepositoryView)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RepositoryViewList) DeepCopyInto(out *RepositoryViewList) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]RepositoryView, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryViewList.
func (in *RepositoryViewList) DeepCopy() *RepositoryViewList {
if in == nil {
return nil
}
out := new(RepositoryViewList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RepositoryViewList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceCount) DeepCopyInto(out *ResourceCount) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceCount.
func (in *ResourceCount) DeepCopy() *ResourceCount {
if in == nil {
return nil
}
out := new(ResourceCount)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceList) DeepCopyInto(out *ResourceList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ResourceListItem, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceList.
func (in *ResourceList) DeepCopy() *ResourceList {
if in == nil {
return nil
}
out := new(ResourceList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ResourceList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceListItem) DeepCopyInto(out *ResourceListItem) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceListItem.
func (in *ResourceListItem) DeepCopy() *ResourceListItem {
if in == nil {
return nil
}
out := new(ResourceListItem)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceObjects) DeepCopyInto(out *ResourceObjects) {
*out = *in
@ -472,6 +620,37 @@ func (in *ResourceObjects) DeepCopy() *ResourceObjects {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceStats) DeepCopyInto(out *ResourceStats) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ResourceCount, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStats.
func (in *ResourceStats) DeepCopy() *ResourceStats {
if in == nil {
return nil
}
out := new(ResourceStats)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ResourceStats) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceType) DeepCopyInto(out *ResourceType) {
*out = *in
@ -544,6 +723,38 @@ func (in *S3RepositoryConfig) DeepCopy() *S3RepositoryConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SyncJobOptions) DeepCopyInto(out *SyncJobOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncJobOptions.
func (in *SyncJobOptions) DeepCopy() *SyncJobOptions {
if in == nil {
return nil
}
out := new(SyncJobOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SyncOptions) DeepCopyInto(out *SyncOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SyncOptions.
func (in *SyncOptions) DeepCopy() *SyncOptions {
if in == nil {
return nil
}
out := new(SyncOptions)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SyncStatus) DeepCopyInto(out *SyncStatus) {
*out = *in
@ -606,7 +817,7 @@ func (in *WebhookResponse) DeepCopyInto(out *WebhookResponse) {
if in.Job != nil {
in, out := &in.Job, &out.Job
*out = new(JobSpec)
**out = **in
(*in).DeepCopyInto(*out)
}
return
}

View File

@ -15,28 +15,37 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Author": schema_pkg_apis_provisioning_v0alpha1_Author(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions": schema_pkg_apis_provisioning_v0alpha1_EditingOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ExportJobOptions": schema_pkg_apis_provisioning_v0alpha1_ExportJobOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileItem": schema_pkg_apis_provisioning_v0alpha1_FileItem(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.FileList": schema_pkg_apis_provisioning_v0alpha1_FileList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus": schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HelloWorld": schema_pkg_apis_provisioning_v0alpha1_HelloWorld(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryItem": schema_pkg_apis_provisioning_v0alpha1_HistoryItem(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HistoryList": schema_pkg_apis_provisioning_v0alpha1_HistoryList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Job": schema_pkg_apis_provisioning_v0alpha1_Job(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobList": schema_pkg_apis_provisioning_v0alpha1_JobList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobResourceSummary": schema_pkg_apis_provisioning_v0alpha1_JobResourceSummary(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobSpec": schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobStatus": schema_pkg_apis_provisioning_v0alpha1_JobStatus(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LintIssue": schema_pkg_apis_provisioning_v0alpha1_LintIssue(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.PullRequestJobOptions": schema_pkg_apis_provisioning_v0alpha1_PullRequestJobOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.Repository": schema_pkg_apis_provisioning_v0alpha1_Repository(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryList": schema_pkg_apis_provisioning_v0alpha1_RepositoryList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositorySpec": schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryStatus": schema_pkg_apis_provisioning_v0alpha1_RepositoryStatus(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryView": schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryViewList": schema_pkg_apis_provisioning_v0alpha1_RepositoryViewList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceCount": schema_pkg_apis_provisioning_v0alpha1_ResourceCount(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceList": schema_pkg_apis_provisioning_v0alpha1_ResourceList(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceListItem": schema_pkg_apis_provisioning_v0alpha1_ResourceListItem(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects": schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceStats": schema_pkg_apis_provisioning_v0alpha1_ResourceStats(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceType": schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceWrapper": schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig": schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions": schema_pkg_apis_provisioning_v0alpha1_SyncJobOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions": schema_pkg_apis_provisioning_v0alpha1_SyncOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus": schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.TestResults": schema_pkg_apis_provisioning_v0alpha1_TestResults(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookResponse": schema_pkg_apis_provisioning_v0alpha1_WebhookResponse(ref),
@ -77,38 +86,50 @@ func schema_pkg_apis_provisioning_v0alpha1_Author(ref common.ReferenceCallback)
}
}
func schema_pkg_apis_provisioning_v0alpha1_EditingOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
func schema_pkg_apis_provisioning_v0alpha1_ExportJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"create": {
"folder": {
SchemaProps: spec.SchemaProps{
Description: "End users can create new files in the remote file system",
Default: false,
Description: "The source folder (or empty) to export",
Type: []string{"string"},
Format: "",
},
},
"history": {
SchemaProps: spec.SchemaProps{
Description: "Preserve history (if possible)",
Type: []string{"boolean"},
Format: "",
},
},
"update": {
"branch": {
SchemaProps: spec.SchemaProps{
Description: "End users can update existing files in the remote file system",
Default: false,
Type: []string{"boolean"},
Description: "Target branch for export (only git)",
Type: []string{"string"},
Format: "",
},
},
"delete": {
"prefix": {
SchemaProps: spec.SchemaProps{
Description: "End users can delete existing files in the remote file system",
Description: "Target file prefix",
Type: []string{"string"},
Format: "",
},
},
"identifier": {
SchemaProps: spec.SchemaProps{
Description: "Include the identifier in the exported metadata",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"create", "update", "delete"},
Required: []string{"identifier"},
},
},
}
@ -185,10 +206,14 @@ func schema_pkg_apis_provisioning_v0alpha1_FileList(ref common.ReferenceCallback
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"files": {
"items": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "should be named \"items\", but avoid subresource error for now: kubernetes/kubernetes#126809",
Type: []string{"array"},
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
@ -255,13 +280,6 @@ func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.Ref
Format: "",
},
},
"pullRequestLinter": {
SchemaProps: spec.SchemaProps{
Description: "PullRequestLinter enables the dashboard linter for this repository in Pull Requests",
Type: []string{"boolean"},
Format: "",
},
},
},
},
},
@ -290,6 +308,11 @@ func schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref common.ReferenceCall
},
},
"message": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "Summary messages (will be shown to users)",
Type: []string{"array"},
@ -311,38 +334,6 @@ func schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref common.ReferenceCall
}
}
func schema_pkg_apis_provisioning_v0alpha1_HelloWorld(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: "",
},
},
"whom": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_HistoryItem(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -364,6 +355,11 @@ func schema_pkg_apis_provisioning_v0alpha1_HistoryItem(ref common.ReferenceCallb
},
},
"authors": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
@ -420,9 +416,13 @@ func schema_pkg_apis_provisioning_v0alpha1_HistoryList(ref common.ReferenceCallb
},
},
"items": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "should be named \"items\", but avoid subresource error for now: kubernetes/kubernetes#126809",
Type: []string{"array"},
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
@ -535,6 +535,83 @@ func schema_pkg_apis_provisioning_v0alpha1_JobList(ref common.ReferenceCallback)
}
}
func schema_pkg_apis_provisioning_v0alpha1_JobResourceSummary(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"group": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"resource": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"create": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"update": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"delete": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"write": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"error": {
SchemaProps: spec.SchemaProps{
Description: "Create or update (export)",
Type: []string{"integer"},
Format: "int64",
},
},
"noop": {
SchemaProps: spec.SchemaProps{
Description: "No action required (useful for sync)",
Type: []string{"integer"},
Format: "int64",
},
},
"errors": {
SchemaProps: spec.SchemaProps{
Description: "Report errors for this resource type This may not be an exhaustive list and recommend looking at the logs for more info",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
},
},
},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -550,37 +627,38 @@ func schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref common.ReferenceCallback)
Enum: []interface{}{"export", "pr", "sync"},
},
},
"ref": {
"repository": {
SchemaProps: spec.SchemaProps{
Description: "The branch of commit hash",
Description: "The the repository reference (for now also in labels)",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"pr": {
SchemaProps: spec.SchemaProps{
Description: "Pull request number (when appropriate)",
Type: []string{"integer"},
Format: "int32",
Description: "Pull request options",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.PullRequestJobOptions"),
},
},
"hash": {
"export": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
Description: "Required when the action is `export`",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ExportJobOptions"),
},
},
"url": {
"sync": {
SchemaProps: spec.SchemaProps{
Description: "URL to the originator (eg, PR URL)",
Type: []string{"string"},
Format: "",
Description: "Required when the action is `sync`",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions"),
},
},
},
Required: []string{"action"},
Required: []string{"action", "repository"},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ExportJobOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.PullRequestJobOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions"},
}
}
@ -631,9 +709,32 @@ func schema_pkg_apis_provisioning_v0alpha1_JobStatus(ref common.ReferenceCallbac
},
},
},
"progress": {
SchemaProps: spec.SchemaProps{
Description: "Optional value 0-100 that can be set while running",
Type: []string{"number"},
Format: "double",
},
},
"summary": {
SchemaProps: spec.SchemaProps{
Description: "Summary of processed actions",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobResourceSummary"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.JobResourceSummary"},
}
}
@ -691,6 +792,45 @@ func schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref common.Refe
}
}
func schema_pkg_apis_provisioning_v0alpha1_PullRequestJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"ref": {
SchemaProps: spec.SchemaProps{
Description: "The branch of commit hash",
Type: []string{"string"},
Format: "",
},
},
"pr": {
SchemaProps: spec.SchemaProps{
Description: "Pull request number (when appropriate)",
Type: []string{"integer"},
Format: "int32",
},
},
"hash": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"url": {
SchemaProps: spec.SchemaProps{
Description: "URL to the originator (eg, PR URL)",
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_Repository(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -765,6 +905,11 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryList(ref common.ReferenceCa
},
},
"items": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Type: []string{"array"},
Items: &spec.SchemaOrArray{
@ -793,7 +938,7 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
Properties: map[string]spec.Schema{
"title": {
SchemaProps: spec.SchemaProps{
Description: "Describe the feature toggle",
Description: "The repository display name (shown in the UI)",
Default: "",
Type: []string{"string"},
Format: "",
@ -801,30 +946,24 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
},
"description": {
SchemaProps: spec.SchemaProps{
Description: "Describe the feature toggle",
Description: "Repository description",
Type: []string{"string"},
Format: "",
},
},
"folder": {
"readOnly": {
SchemaProps: spec.SchemaProps{
Description: "The folder that is backed by the repository. The value is a reference to the Kubernetes metadata name of the folder in the same namespace.",
Type: []string{"string"},
Format: "",
},
},
"preferYaml": {
SchemaProps: spec.SchemaProps{
Description: "Should we prefer emitting YAML for this repository, e.g. upon export? Editing existing dashboards will continue to emit the file format used in the repository. (TODO: implement this) If you delete and then recreate a dashboard, it will switch to the preferred format.",
Description: "ReadOnly repository does not allow any write commands",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
"editing": {
"sync": {
SchemaProps: spec.SchemaProps{
Description: "Edit options within the repository",
Description: "Sync settings -- how values are pulled from the repository into grafana",
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions"),
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions"),
},
},
"type": {
@ -836,37 +975,30 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositorySpec(ref common.ReferenceCa
Enum: []interface{}{"github", "local", "s3"},
},
},
"linting": {
SchemaProps: spec.SchemaProps{
Description: "Linting enables linting for this repository",
Type: []string{"boolean"},
Format: "",
},
},
"local": {
SchemaProps: spec.SchemaProps{
Description: "The repository on the local file system. Mutually exclusive with s3 and github.",
Description: "The repository on the local file system. Mutually exclusive with local | s3 | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig"),
},
},
"s3": {
SchemaProps: spec.SchemaProps{
Description: "The repository in an S3 bucket. Mutually exclusive with local and github.",
Description: "The repository in an S3 bucket. Mutually exclusive with local | s3 | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig"),
},
},
"github": {
SchemaProps: spec.SchemaProps{
Description: "The repository on GitHub. Mutually exclusive with local and s3.",
Description: "The repository on GitHub. Mutually exclusive with local | s3 | github.",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig"),
},
},
},
Required: []string{"title", "editing", "type"},
Required: []string{"title", "readOnly", "sync", "type"},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.EditingOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig"},
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.GitHubRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LocalRepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.S3RepositoryConfig", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions"},
}
}
@ -899,6 +1031,25 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryStatus(ref common.Reference
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus"),
},
},
"stats": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "The object count when sync last ran",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceCount"),
},
},
},
},
},
"webhook": {
SchemaProps: spec.SchemaProps{
Description: "Webhook Information (if applicable)",
@ -910,7 +1061,270 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryStatus(ref common.Reference
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookStatus"},
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.HealthStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceCount", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncStatus", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.WebhookStatus"},
}
}
func schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"name": {
SchemaProps: spec.SchemaProps{
Description: "The k8s name for this repository",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"title": {
SchemaProps: spec.SchemaProps{
Description: "Repository display",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"readOnly": {
SchemaProps: spec.SchemaProps{
Description: "Edit options within the repository",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
"type": {
SchemaProps: spec.SchemaProps{
Description: "The repository type\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`\n - `\"s3\"`",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"github", "local", "s3"},
},
},
"target": {
SchemaProps: spec.SchemaProps{
Description: "When syncing, where values are saved\n\nPossible enum values:\n - `\"folder\"` Resources will be saved into a folder managed by this repository The folder k8s name will be the same as the repository k8s name It will contain a copy of everything from the remote\n - `\"instance\"` Resources are saved in the global context Only one repository may specify the `instance` target When this exists, the UI will promote writing to the instance repo rather than the grafana database (where possible)",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"folder", "instance"},
},
},
},
Required: []string{"name", "title", "readOnly", "type", "target"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_RepositoryViewList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Summary shows a view of the configuration that is sanitized and is OK for logged in users to see",
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: "",
},
},
"items": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-map-type": "atomic",
},
},
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/pkg/apis/provisioning/v0alpha1.RepositoryView"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.RepositoryView"},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceCount(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"repository": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"group": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"resource": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"count": {
SchemaProps: spec.SchemaProps{
Default: 0,
Type: []string{"integer"},
Format: "int64",
},
},
},
Required: []string{"group", "resource", "count"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Information we can get just from the file listing",
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": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
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/pkg/apis/provisioning/v0alpha1.ResourceListItem"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceListItem", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceListItem(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"path": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"group": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"resource": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"name": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"hash": {
SchemaProps: spec.SchemaProps{
Description: "the k8s identifier",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"time": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int64",
},
},
"title": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
"folder": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"path", "group", "resource", "name", "hash"},
},
},
}
}
@ -962,6 +1376,59 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref common.ReferenceC
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceStats(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "Information we can get just from the file listing",
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": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
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/pkg/apis/provisioning/v0alpha1.ResourceCount"),
},
},
},
},
},
},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceCount", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -1062,6 +1529,11 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
},
},
"lint": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "Lint results",
Type: []string{"array"},
@ -1076,6 +1548,11 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
},
},
"errors": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "If errors exist, show them here",
Type: []string{"array"},
@ -1123,6 +1600,64 @@ func schema_pkg_apis_provisioning_v0alpha1_S3RepositoryConfig(ref common.Referen
}
}
func schema_pkg_apis_provisioning_v0alpha1_SyncJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"incremental": {
SchemaProps: spec.SchemaProps{
Description: "Incremental synchronization for versioned repositories",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"incremental"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_SyncOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"enabled": {
SchemaProps: spec.SchemaProps{
Description: "Enabled must be saved as true before any sync job will run",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
"target": {
SchemaProps: spec.SchemaProps{
Description: "Where values should be saved\n\nPossible enum values:\n - `\"folder\"` Resources will be saved into a folder managed by this repository The folder k8s name will be the same as the repository k8s name It will contain a copy of everything from the remote\n - `\"instance\"` Resources are saved in the global context Only one repository may specify the `instance` target When this exists, the UI will promote writing to the instance repo rather than the grafana database (where possible)",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"folder", "instance"},
},
},
"intervalSeconds": {
SchemaProps: spec.SchemaProps{
Description: "When non-zero, the sync will run periodically",
Type: []string{"integer"},
Format: "int64",
},
},
},
Required: []string{"enabled", "target"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@ -1167,6 +1702,11 @@ func schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref common.ReferenceCallba
},
},
"message": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "Summary messages (will be shown to users)",
Type: []string{"array"},
@ -1188,8 +1728,15 @@ func schema_pkg_apis_provisioning_v0alpha1_SyncStatus(ref common.ReferenceCallba
Format: "",
},
},
"incremental": {
SchemaProps: spec.SchemaProps{
Description: "Incremental synchronization for versioned repositories",
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"state"},
Required: []string{"state", "message"},
},
},
}

View File

@ -1,13 +1,15 @@
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HealthStatus,Message
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HistoryItem,Authors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,FileList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,HistoryList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobResourceSummary,Errors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobStatus,Errors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceWrapper,Errors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceWrapper,Lint
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,SyncStatus,Message
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobStatus,Summary
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositoryViewList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceList,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,ResourceStats,Items
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,TestResults,Errors
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,WebhookStatus,SubscribedEvents
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,FileList,Items
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,JobSpec,PullRequest
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,GitHub
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,RepositorySpec,PreferYAML
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,SyncStatus,JobID
API rule violation: names_match,github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1,WebhookResponse,Message

View File

@ -1,43 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// EditingOptionsApplyConfiguration represents a declarative configuration of the EditingOptions type for use
// with apply.
type EditingOptionsApplyConfiguration struct {
Create *bool `json:"create,omitempty"`
Update *bool `json:"update,omitempty"`
Delete *bool `json:"delete,omitempty"`
}
// EditingOptionsApplyConfiguration constructs a declarative configuration of the EditingOptions type for use with
// apply.
func EditingOptions() *EditingOptionsApplyConfiguration {
return &EditingOptionsApplyConfiguration{}
}
// WithCreate sets the Create field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Create field is set to the value of the last call.
func (b *EditingOptionsApplyConfiguration) WithCreate(value bool) *EditingOptionsApplyConfiguration {
b.Create = &value
return b
}
// WithUpdate sets the Update field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Update field is set to the value of the last call.
func (b *EditingOptionsApplyConfiguration) WithUpdate(value bool) *EditingOptionsApplyConfiguration {
b.Update = &value
return b
}
// WithDelete sets the Delete field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Delete field is set to the value of the last call.
func (b *EditingOptionsApplyConfiguration) WithDelete(value bool) *EditingOptionsApplyConfiguration {
b.Delete = &value
return b
}

View File

@ -13,7 +13,6 @@ type GitHubRepositoryConfigApplyConfiguration struct {
Token *string `json:"token,omitempty"`
BranchWorkflow *bool `json:"branchWorkflow,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
PullRequestLinter *bool `json:"pullRequestLinter,omitempty"`
}
// GitHubRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitHubRepositoryConfig type for use with
@ -69,11 +68,3 @@ func (b *GitHubRepositoryConfigApplyConfiguration) WithGenerateDashboardPreviews
b.GenerateDashboardPreviews = &value
return b
}
// WithPullRequestLinter sets the PullRequestLinter field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PullRequestLinter field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithPullRequestLinter(value bool) *GitHubRepositoryConfigApplyConfiguration {
b.PullRequestLinter = &value
return b
}

View File

@ -13,11 +13,9 @@ import (
type RepositorySpecApplyConfiguration struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Folder *string `json:"folder,omitempty"`
PreferYAML *bool `json:"preferYaml,omitempty"`
Editing *EditingOptionsApplyConfiguration `json:"editing,omitempty"`
ReadOnly *bool `json:"readOnly,omitempty"`
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
Linting *bool `json:"linting,omitempty"`
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
S3 *S3RepositoryConfigApplyConfiguration `json:"s3,omitempty"`
GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"`
@ -45,27 +43,19 @@ func (b *RepositorySpecApplyConfiguration) WithDescription(value string) *Reposi
return b
}
// WithFolder sets the Folder field in the declarative configuration to the given value
// WithReadOnly sets the ReadOnly field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Folder field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithFolder(value string) *RepositorySpecApplyConfiguration {
b.Folder = &value
// If called multiple times, the ReadOnly field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithReadOnly(value bool) *RepositorySpecApplyConfiguration {
b.ReadOnly = &value
return b
}
// WithPreferYAML sets the PreferYAML field in the declarative configuration to the given value
// WithSync sets the Sync field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PreferYAML field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithPreferYAML(value bool) *RepositorySpecApplyConfiguration {
b.PreferYAML = &value
return b
}
// WithEditing sets the Editing field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Editing field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithEditing(value *EditingOptionsApplyConfiguration) *RepositorySpecApplyConfiguration {
b.Editing = value
// If called multiple times, the Sync field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithSync(value *SyncOptionsApplyConfiguration) *RepositorySpecApplyConfiguration {
b.Sync = value
return b
}
@ -77,14 +67,6 @@ func (b *RepositorySpecApplyConfiguration) WithType(value provisioningv0alpha1.R
return b
}
// WithLinting sets the Linting field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Linting field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithLinting(value bool) *RepositorySpecApplyConfiguration {
b.Linting = &value
return b
}
// WithLocal sets the Local field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Local field is set to the value of the last call.

View File

@ -7,10 +7,11 @@ package v0alpha1
// RepositoryStatusApplyConfiguration represents a declarative configuration of the RepositoryStatus type for use
// with apply.
type RepositoryStatusApplyConfiguration struct {
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
Health *HealthStatusApplyConfiguration `json:"health,omitempty"`
Sync *SyncStatusApplyConfiguration `json:"sync,omitempty"`
Webhook *WebhookStatusApplyConfiguration `json:"webhook,omitempty"`
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
Health *HealthStatusApplyConfiguration `json:"health,omitempty"`
Sync *SyncStatusApplyConfiguration `json:"sync,omitempty"`
Stats []ResourceCountApplyConfiguration `json:"stats,omitempty"`
Webhook *WebhookStatusApplyConfiguration `json:"webhook,omitempty"`
}
// RepositoryStatusApplyConfiguration constructs a declarative configuration of the RepositoryStatus type for use with
@ -43,6 +44,19 @@ func (b *RepositoryStatusApplyConfiguration) WithSync(value *SyncStatusApplyConf
return b
}
// WithStats adds the given value to the Stats field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, values provided by each call will be appended to the Stats field.
func (b *RepositoryStatusApplyConfiguration) WithStats(values ...*ResourceCountApplyConfiguration) *RepositoryStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithStats")
}
b.Stats = append(b.Stats, *values[i])
}
return b
}
// WithWebhook sets the Webhook field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Webhook field is set to the value of the last call.

View File

@ -0,0 +1,52 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// ResourceCountApplyConfiguration represents a declarative configuration of the ResourceCount type for use
// with apply.
type ResourceCountApplyConfiguration struct {
Repository *string `json:"repository,omitempty"`
Group *string `json:"group,omitempty"`
Resource *string `json:"resource,omitempty"`
Count *int64 `json:"count,omitempty"`
}
// ResourceCountApplyConfiguration constructs a declarative configuration of the ResourceCount type for use with
// apply.
func ResourceCount() *ResourceCountApplyConfiguration {
return &ResourceCountApplyConfiguration{}
}
// WithRepository sets the Repository field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Repository field is set to the value of the last call.
func (b *ResourceCountApplyConfiguration) WithRepository(value string) *ResourceCountApplyConfiguration {
b.Repository = &value
return b
}
// WithGroup sets the Group field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Group field is set to the value of the last call.
func (b *ResourceCountApplyConfiguration) WithGroup(value string) *ResourceCountApplyConfiguration {
b.Group = &value
return b
}
// WithResource sets the Resource field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Resource field is set to the value of the last call.
func (b *ResourceCountApplyConfiguration) WithResource(value string) *ResourceCountApplyConfiguration {
b.Resource = &value
return b
}
// WithCount sets the Count field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Count field is set to the value of the last call.
func (b *ResourceCountApplyConfiguration) WithCount(value int64) *ResourceCountApplyConfiguration {
b.Count = &value
return b
}

View File

@ -0,0 +1,47 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1"
)
// SyncOptionsApplyConfiguration represents a declarative configuration of the SyncOptions type for use
// with apply.
type SyncOptionsApplyConfiguration struct {
Enabled *bool `json:"enabled,omitempty"`
Target *provisioningv0alpha1.SyncTargetType `json:"target,omitempty"`
IntervalSeconds *int64 `json:"intervalSeconds,omitempty"`
}
// SyncOptionsApplyConfiguration constructs a declarative configuration of the SyncOptions type for use with
// apply.
func SyncOptions() *SyncOptionsApplyConfiguration {
return &SyncOptionsApplyConfiguration{}
}
// WithEnabled sets the Enabled field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Enabled field is set to the value of the last call.
func (b *SyncOptionsApplyConfiguration) WithEnabled(value bool) *SyncOptionsApplyConfiguration {
b.Enabled = &value
return b
}
// WithTarget sets the Target field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Target field is set to the value of the last call.
func (b *SyncOptionsApplyConfiguration) WithTarget(value provisioningv0alpha1.SyncTargetType) *SyncOptionsApplyConfiguration {
b.Target = &value
return b
}
// WithIntervalSeconds sets the IntervalSeconds field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the IntervalSeconds field is set to the value of the last call.
func (b *SyncOptionsApplyConfiguration) WithIntervalSeconds(value int64) *SyncOptionsApplyConfiguration {
b.IntervalSeconds = &value
return b
}

View File

@ -11,13 +11,14 @@ import (
// SyncStatusApplyConfiguration represents a declarative configuration of the SyncStatus type for use
// with apply.
type SyncStatusApplyConfiguration struct {
State *provisioningv0alpha1.JobState `json:"state,omitempty"`
JobID *string `json:"job,omitempty"`
Started *int64 `json:"started,omitempty"`
Finished *int64 `json:"finished,omitempty"`
Scheduled *int64 `json:"scheduled,omitempty"`
Message []string `json:"message,omitempty"`
Hash *string `json:"hash,omitempty"`
State *provisioningv0alpha1.JobState `json:"state,omitempty"`
JobID *string `json:"job,omitempty"`
Started *int64 `json:"started,omitempty"`
Finished *int64 `json:"finished,omitempty"`
Scheduled *int64 `json:"scheduled,omitempty"`
Message []string `json:"message,omitempty"`
Hash *string `json:"hash,omitempty"`
Incremental *bool `json:"incremental,omitempty"`
}
// SyncStatusApplyConfiguration constructs a declarative configuration of the SyncStatus type for use with
@ -83,3 +84,11 @@ func (b *SyncStatusApplyConfiguration) WithHash(value string) *SyncStatusApplyCo
b.Hash = &value
return b
}
// WithIncremental sets the Incremental field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Incremental field is set to the value of the last call.
func (b *SyncStatusApplyConfiguration) WithIncremental(value bool) *SyncStatusApplyConfiguration {
b.Incremental = &value
return b
}

View File

@ -20,8 +20,6 @@ import (
func ForKind(kind schema.GroupVersionKind) interface{} {
switch kind {
// Group=provisioning.grafana.app, Version=v0alpha1
case v0alpha1.SchemeGroupVersion.WithKind("EditingOptions"):
return &provisioningv0alpha1.EditingOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("GitHubRepositoryConfig"):
return &provisioningv0alpha1.GitHubRepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("HealthStatus"):
@ -34,8 +32,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &provisioningv0alpha1.RepositorySpecApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("RepositoryStatus"):
return &provisioningv0alpha1.RepositoryStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ResourceCount"):
return &provisioningv0alpha1.ResourceCountApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("S3RepositoryConfig"):
return &provisioningv0alpha1.S3RepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncOptions"):
return &provisioningv0alpha1.SyncOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncStatus"):
return &provisioningv0alpha1.SyncStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("WebhookStatus"):

File diff suppressed because it is too large Load Diff

View File

@ -70,6 +70,9 @@ func TestIntegrationOpenAPIs(t *testing.T) {
}, {
Group: "iam.grafana.app",
Version: "v0alpha1",
}, {
Group: "provisioning.grafana.app",
Version: "v0alpha1",
}}
for _, gv := range groups {
VerifyOpenAPISnapshots(t, dir, gv, h)

View File

@ -8,11 +8,6 @@
"title": "Github Example",
"description": "load resources from github",
"type": "github",
"editing": {
"create": true,
"update": true,
"delete": true
},
"github": {
"owner": "grafana",
"repository": "git-ui-sync-demo",
@ -20,6 +15,12 @@
"branchWorkflow": true,
"generateDashboardPreviews": true,
"token": "github_pat_dummy"
}
},
"sync": {
"enabled": false,
"target": "",
"intervalSeconds": 60
},
"readOnly": false
}
}

View File

@ -7,10 +7,11 @@
"spec": {
"title": "Load devenv dashboards",
"description": "Load /devenv/dev-dashboards (from root of repository)",
"editing": {
"create": true,
"update": true,
"delete": true
"readOnly": false,
"sync": {
"enabled": true,
"target": "mirror",
"intervalSeconds": 60
},
"type": "local",
"local": {