Provisioning: Update spec and dependencies (#101746)

Co-authored-by: Clarity-89 <homes89@ukr.net>
This commit is contained in:
Ryan McKinley
2025-03-07 10:57:13 +03:00
committed by GitHub
co-authored by Clarity-89
parent aa5f2e43d4
commit f52b6a5a42
23 changed files with 1330 additions and 186 deletions
+37 -12
View File
@@ -26,14 +26,17 @@ type JobList struct {
type JobAction string
const (
// Update a pull request -- send preview images, links etc
JobActionPullRequest JobAction = "pr"
// Sync the remote branch with the grafana instance
JobActionSync JobAction = "sync"
JobActionSync JobAction = "pull"
// Export from grafana into the remote repository
JobActionExport JobAction = "export"
JobActionExport JobAction = "push"
// Process a pull request -- apply comments with preview images, links etc
JobActionPullRequest JobAction = "pr"
// Migration task -- this will migrate an full instance from SQL > Git
JobActionMigrate JobAction = "migrate"
)
// +enum
@@ -66,11 +69,14 @@ type JobSpec struct {
// Pull request options
PullRequest *PullRequestJobOptions `json:"pr,omitempty"`
// Required when the action is `export`
Export *ExportJobOptions `json:"export,omitempty"`
// Required when the action is `push`
Push *ExportJobOptions `json:"push,omitempty"`
// Required when the action is `sync`
Sync *SyncJobOptions `json:"sync,omitempty"`
// Required when the action is `pull`
Pull *SyncJobOptions `json:"pull,omitempty"`
// Required when the action is `migrate`
Migrate *MigrateJobOptions `json:"migrate,omitempty"`
}
type PullRequestJobOptions struct {
@@ -94,15 +100,23 @@ 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"`
// Prefix in target file system
Prefix string `json:"prefix,omitempty"`
// Include the identifier in the exported metadata
Identifier bool `json:"identifier"`
}
type MigrateJobOptions struct {
// Target file prefix
Prefix string `json:"prefix,omitempty"`
// Preserve history (if possible)
History bool `json:"history,omitempty"`
// Include the identifier in the exported metadata
Identifier bool `json:"identifier"`
}
@@ -122,6 +136,17 @@ type JobStatus struct {
Summary []*JobResourceSummary `json:"summary,omitempty"`
}
// Convert a JOB to a
func (in JobStatus) ToSyncStatus(jobId string) SyncStatus {
return SyncStatus{
JobID: jobId,
State: in.State,
Started: in.Started,
Finished: in.Finished,
Message: in.Errors,
}
}
type JobResourceSummary struct {
Group string `json:"group,omitempty"`
Resource string `json:"resource,omitempty"`
@@ -9,6 +9,11 @@ import (
type RepositoryViewList struct {
metav1.TypeMeta `json:",inline"`
// The backend is using legacy storage
// FIXME: Not sure where this should be exposed... but we need it somewhere
// The UI should force the onboarding workflow when this is true
LegacyStorage bool `json:"legacyStorage,omitempty"`
// +mapType=atomic
Items []RepositoryView `json:"items"`
}
+41 -26
View File
@@ -102,8 +102,8 @@ const (
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
// The folder k8s name will be the same as the repository k8s name
SyncTargetTypeFolder SyncTargetType = "folder"
)
@@ -150,7 +150,8 @@ type HealthStatus struct {
// When the health was checked last time
Checked int64 `json:"checked,omitempty"`
// Summary messages (will be shown to users)
// Summary messages (can be shown to users)
// Will only be populated when not healthy
// +listType=atomic
Message []string `json:"message,omitempty"`
}
@@ -218,46 +219,29 @@ type ResourceWrapper struct {
// Path to the remote file
Path string `json:"path,omitempty"`
// The commit hash (if exists)
// The request ref (or branch if exists)
Ref string `json:"ref,omitempty"`
// The repo hash value
Hash string `json:"hash,omitempty"`
// Basic repository info
Repository ResourceRepositoryInfo `json:"repository"`
// Typed links for this file (only supported by external systems, github etc)
URLs *ResourceURLs `json:"urls,omitempty"`
// The modified time in the remote file system
Timestamp *metav1.Time `json:"timestamp,omitempty"`
// Different flavors of the same object
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"`
}
// The kubernetes action required when loading a given resource
// +enum
type LintSeverity string
// ResourceAction values
const (
LintSeverityExclude LintSeverity = "exclude"
LintSeverityQuiet LintSeverity = "quiet"
LintSeverityWarning LintSeverity = "warning"
LintSeverityError LintSeverity = "error"
LintSeverityFixed LintSeverity = "fixed"
)
type LintIssue struct {
Severity LintSeverity `json:"severity"`
Rule string `json:"rule"`
Message string `json:"message"`
}
type ResourceType struct {
Group string `json:"group,omitempty"`
Version string `json:"version,omitempty"`
@@ -284,6 +268,37 @@ type ResourceObjects struct {
// The value returned from a dryRun request
DryRun common.Unstructured `json:"dryRun,omitempty"`
// For write events, this will return the value that was added or updated
Upsert common.Unstructured `json:"upsert,omitempty"`
}
type ResourceRepositoryInfo struct {
// The repository type
Type RepositoryType `json:"type"`
// The display name for this repository
Title string `json:"title"`
// The namespace this belongs to
Namespace string `json:"namespace"`
// The name (identifier)
Name string `json:"name"`
}
type ResourceURLs struct {
// A URL pointing to the this file in the repository
SourceURL string `json:"sourceURL,omitempty"`
// A URL pointing to the repository this lives in
RepositoryURL string `json:"repositoryURL,omitempty"`
// A URL that will create a new pull requeset for this branch
NewPullRequestURL string `json:"newPullRequestURL,omitempty"`
// Compare this version to the target branch
CompareURL string `json:"compareURL,omitempty"`
}
// Information we can get just from the file listing
@@ -276,16 +276,21 @@ func (in *JobSpec) DeepCopyInto(out *JobSpec) {
*out = new(PullRequestJobOptions)
**out = **in
}
if in.Export != nil {
in, out := &in.Export, &out.Export
if in.Push != nil {
in, out := &in.Push, &out.Push
*out = new(ExportJobOptions)
**out = **in
}
if in.Sync != nil {
in, out := &in.Sync, &out.Sync
if in.Pull != nil {
in, out := &in.Pull, &out.Pull
*out = new(SyncJobOptions)
**out = **in
}
if in.Migrate != nil {
in, out := &in.Migrate, &out.Migrate
*out = new(MigrateJobOptions)
**out = **in
}
return
}
@@ -331,22 +336,6 @@ func (in *JobStatus) DeepCopy() *JobStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LintIssue) DeepCopyInto(out *LintIssue) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LintIssue.
func (in *LintIssue) DeepCopy() *LintIssue {
if in == nil {
return nil
}
out := new(LintIssue)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LocalRepositoryConfig) DeepCopyInto(out *LocalRepositoryConfig) {
*out = *in
@@ -363,6 +352,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 *MigrateJobOptions) DeepCopyInto(out *MigrateJobOptions) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MigrateJobOptions.
func (in *MigrateJobOptions) DeepCopy() *MigrateJobOptions {
if in == nil {
return nil
}
out := new(MigrateJobOptions)
in.DeepCopyInto(out)
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
@@ -616,6 +621,7 @@ func (in *ResourceObjects) DeepCopyInto(out *ResourceObjects) {
in.File.DeepCopyInto(&out.File)
in.Existing.DeepCopyInto(&out.Existing)
in.DryRun.DeepCopyInto(&out.DryRun)
in.Upsert.DeepCopyInto(&out.Upsert)
return
}
@@ -629,6 +635,22 @@ 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 *ResourceRepositoryInfo) DeepCopyInto(out *ResourceRepositoryInfo) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRepositoryInfo.
func (in *ResourceRepositoryInfo) DeepCopy() *ResourceRepositoryInfo {
if in == nil {
return nil
}
out := new(ResourceRepositoryInfo)
in.DeepCopyInto(out)
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
@@ -676,20 +698,37 @@ func (in *ResourceType) DeepCopy() *ResourceType {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceURLs) DeepCopyInto(out *ResourceURLs) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceURLs.
func (in *ResourceURLs) DeepCopy() *ResourceURLs {
if in == nil {
return nil
}
out := new(ResourceURLs)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceWrapper) DeepCopyInto(out *ResourceWrapper) {
*out = *in
out.TypeMeta = in.TypeMeta
out.Repository = in.Repository
if in.URLs != nil {
in, out := &in.URLs, &out.URLs
*out = new(ResourceURLs)
**out = **in
}
if in.Timestamp != nil {
in, out := &in.Timestamp, &out.Timestamp
*out = (*in).DeepCopy()
}
in.Resource.DeepCopyInto(&out.Resource)
if in.Lint != nil {
in, out := &in.Lint, &out.Lint
*out = make([]LintIssue, len(*in))
copy(*out, *in)
}
if in.Errors != nil {
in, out := &in.Errors, &out.Errors
*out = make([]string, len(*in))
@@ -27,8 +27,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"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.MigrateJobOptions": schema_pkg_apis_provisioning_v0alpha1_MigrateJobOptions(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),
@@ -40,8 +40,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
"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.ResourceRepositoryInfo": schema_pkg_apis_provisioning_v0alpha1_ResourceRepositoryInfo(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.ResourceURLs": schema_pkg_apis_provisioning_v0alpha1_ResourceURLs(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.SyncJobOptions": schema_pkg_apis_provisioning_v0alpha1_SyncJobOptions(ref),
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncOptions": schema_pkg_apis_provisioning_v0alpha1_SyncOptions(ref),
@@ -98,13 +100,6 @@ func schema_pkg_apis_provisioning_v0alpha1_ExportJobOptions(ref common.Reference
Format: "",
},
},
"history": {
SchemaProps: spec.SchemaProps{
Description: "Preserve history (if possible)",
Type: []string{"boolean"},
Format: "",
},
},
"branch": {
SchemaProps: spec.SchemaProps{
Description: "Target branch for export (only git)",
@@ -114,7 +109,7 @@ func schema_pkg_apis_provisioning_v0alpha1_ExportJobOptions(ref common.Reference
},
"prefix": {
SchemaProps: spec.SchemaProps{
Description: "Target file prefix",
Description: "Prefix in target file system",
Type: []string{"string"},
Format: "",
},
@@ -313,7 +308,7 @@ func schema_pkg_apis_provisioning_v0alpha1_HealthStatus(ref common.ReferenceCall
},
},
SchemaProps: spec.SchemaProps{
Description: "Summary messages (will be shown to users)",
Description: "Summary messages (can be shown to users) Will only be populated when not healthy",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
@@ -625,11 +620,11 @@ func schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref common.ReferenceCallback)
Properties: map[string]spec.Schema{
"action": {
SchemaProps: spec.SchemaProps{
Description: "Possible enum values:\n - `\"export\"` Export from grafana into the remote repository\n - `\"pr\"` Update a pull request -- send preview images, links etc\n - `\"sync\"` Sync the remote branch with the grafana instance",
Description: "Possible enum values:\n - `\"migrate\"` Migration task -- this will migrate an full instance from SQL > Git\n - `\"pr\"` Process a pull request -- apply comments with preview images, links etc\n - `\"pull\"` Sync the remote branch with the grafana instance\n - `\"push\"` Export from grafana into the remote repository",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"export", "pr", "sync"},
Enum: []interface{}{"migrate", "pr", "pull", "push"},
},
},
"repository": {
@@ -646,24 +641,30 @@ func schema_pkg_apis_provisioning_v0alpha1_JobSpec(ref common.ReferenceCallback)
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.PullRequestJobOptions"),
},
},
"export": {
"push": {
SchemaProps: spec.SchemaProps{
Description: "Required when the action is `export`",
Description: "Required when the action is `push`",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ExportJobOptions"),
},
},
"sync": {
"pull": {
SchemaProps: spec.SchemaProps{
Description: "Required when the action is `sync`",
Description: "Required when the action is `pull`",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions"),
},
},
"migrate": {
SchemaProps: spec.SchemaProps{
Description: "Required when the action is `migrate`",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.MigrateJobOptions"),
},
},
},
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"},
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ExportJobOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.MigrateJobOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.PullRequestJobOptions", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.SyncJobOptions"},
}
}
@@ -742,42 +743,6 @@ func schema_pkg_apis_provisioning_v0alpha1_JobStatus(ref common.ReferenceCallbac
}
}
func schema_pkg_apis_provisioning_v0alpha1_LintIssue(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"severity": {
SchemaProps: spec.SchemaProps{
Description: "Possible enum values:\n - `\"error\"`\n - `\"exclude\"`\n - `\"fixed\"`\n - `\"quiet\"`\n - `\"warning\"`",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"error", "exclude", "fixed", "quiet", "warning"},
},
},
"rule": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"severity", "rule", "message"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -796,6 +761,41 @@ func schema_pkg_apis_provisioning_v0alpha1_LocalRepositoryConfig(ref common.Refe
}
}
func schema_pkg_apis_provisioning_v0alpha1_MigrateJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"prefix": {
SchemaProps: spec.SchemaProps{
Description: "Target file prefix",
Type: []string{"string"},
Format: "",
},
},
"history": {
SchemaProps: spec.SchemaProps{
Description: "Preserve history (if possible)",
Type: []string{"boolean"},
Format: "",
},
},
"identifier": {
SchemaProps: spec.SchemaProps{
Description: "Include the identifier in the exported metadata",
Default: false,
Type: []string{"boolean"},
Format: "",
},
},
},
Required: []string{"identifier"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_PullRequestJobOptions(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -1112,7 +1112,7 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryView(ref common.ReferenceCa
},
"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)",
Description: "When syncing, where values are saved\n\nPossible enum values:\n - `\"folder\"` Resources will be saved into a folder managed by this repository It will contain a copy of everything from the remote The folder k8s name will be the same as the repository k8s name\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: "",
@@ -1147,6 +1147,13 @@ func schema_pkg_apis_provisioning_v0alpha1_RepositoryViewList(ref common.Referen
Format: "",
},
},
"legacyStorage": {
SchemaProps: spec.SchemaProps{
Description: "The backend is using legacy storage FIXME: Not sure where this should be exposed... but we need it somewhere The UI should force the onboarding workflow when this is true",
Type: []string{"boolean"},
Format: "",
},
},
"items": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
@@ -1373,6 +1380,12 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref common.ReferenceC
Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"),
},
},
"upsert": {
SchemaProps: spec.SchemaProps{
Description: "For write events, this will return the value that was added or updated",
Ref: ref("github.com/grafana/grafana/pkg/apimachinery/apis/common/v0alpha1.Unstructured"),
},
},
},
Required: []string{"type"},
},
@@ -1382,6 +1395,52 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceObjects(ref common.ReferenceC
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceRepositoryInfo(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"type": {
SchemaProps: spec.SchemaProps{
Description: "The repository type\n\nPossible enum values:\n - `\"github\"`\n - `\"local\"`",
Default: "",
Type: []string{"string"},
Format: "",
Enum: []interface{}{"github", "local"},
},
},
"title": {
SchemaProps: spec.SchemaProps{
Description: "The display name for this repository",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"namespace": {
SchemaProps: spec.SchemaProps{
Description: "The namespace this belongs to",
Default: "",
Type: []string{"string"},
Format: "",
},
},
"name": {
SchemaProps: spec.SchemaProps{
Description: "The name (identifier)",
Default: "",
Type: []string{"string"},
Format: "",
},
},
},
Required: []string{"type", "title", "namespace", "name"},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceStats(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -1479,6 +1538,46 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceType(ref common.ReferenceCall
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceURLs(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Type: []string{"object"},
Properties: map[string]spec.Schema{
"sourceURL": {
SchemaProps: spec.SchemaProps{
Description: "A URL pointing to the this file in the repository",
Type: []string{"string"},
Format: "",
},
},
"repositoryURL": {
SchemaProps: spec.SchemaProps{
Description: "A URL pointing to the repository this lives in",
Type: []string{"string"},
Format: "",
},
},
"newPullRequestURL": {
SchemaProps: spec.SchemaProps{
Description: "A URL that will create a new pull requeset for this branch",
Type: []string{"string"},
Format: "",
},
},
"compareURL": {
SchemaProps: spec.SchemaProps{
Description: "Compare this version to the target branch",
Type: []string{"string"},
Format: "",
},
},
},
},
},
}
}
func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
@@ -1509,7 +1608,7 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
},
"ref": {
SchemaProps: spec.SchemaProps{
Description: "The commit hash (if exists)",
Description: "The request ref (or branch if exists)",
Type: []string{"string"},
Format: "",
},
@@ -1521,6 +1620,19 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
Format: "",
},
},
"repository": {
SchemaProps: spec.SchemaProps{
Description: "Basic repository info",
Default: map[string]interface{}{},
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceRepositoryInfo"),
},
},
"urls": {
SchemaProps: spec.SchemaProps{
Description: "Typed links for this file (only supported by external systems, github etc)",
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceURLs"),
},
},
"timestamp": {
SchemaProps: spec.SchemaProps{
Description: "The modified time in the remote file system",
@@ -1534,25 +1646,6 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
Ref: ref("github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects"),
},
},
"lint": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
"x-kubernetes-list-type": "atomic",
},
},
SchemaProps: spec.SchemaProps{
Description: "Lint results",
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.LintIssue"),
},
},
},
},
},
"errors": {
VendorExtensible: spec.VendorExtensible{
Extensions: spec.Extensions{
@@ -1574,11 +1667,11 @@ func schema_pkg_apis_provisioning_v0alpha1_ResourceWrapper(ref common.ReferenceC
},
},
},
Required: []string{"resource"},
Required: []string{"repository", "resource"},
},
},
Dependencies: []string{
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.LintIssue", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
"github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceObjects", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceRepositoryInfo", "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1.ResourceURLs", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
@@ -1619,7 +1712,7 @@ func schema_pkg_apis_provisioning_v0alpha1_SyncOptions(ref common.ReferenceCallb
},
"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)",
Description: "Where values should be saved\n\nPossible enum values:\n - `\"folder\"` Resources will be saved into a folder managed by this repository It will contain a copy of everything from the remote The folder k8s name will be the same as the repository k8s name\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: "",
@@ -12,5 +12,6 @@ API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/provis
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,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,ResourceWrapper,URLs
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