grafana/apps/provisioning/kinds/provisioning_manifest.go

84 lines
11 KiB
Go

//
// This file is generated by grafana-app-sdk
// DO NOT EDIT
//
package kinds
import (
"encoding/json"
"fmt"
"strings"
"github.com/grafana/grafana-app-sdk/app"
"github.com/grafana/grafana-app-sdk/resource"
v0alpha1 "github.com/grafana/grafana/apps/provisioning/kinds/provisioning/v0alpha1"
)
var (
rawSchemaRepositoryv0alpha1 = []byte(`{"spec":{"properties":{"bitbucket":{"description":"The repository on Bitbucket.\nMutually exclusive with local | github | git.","properties":{"branch":{"description":"The branch to use in the repository.","type":"string"},"encryptedToken":{"description":"Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.","items":{"type":"string"},"type":"array"},"path":{"description":"Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.","type":"string"},"token":{"description":"Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.","type":"string"},"tokenUser":{"description":"TokenUser is the user that will be used to access the repository if it's a personal access token.","type":"string"},"url":{"description":"The repository URL (e.g. ` + "`" + `https://bitbucket.org/example/test` + "`" + `).","type":"string"}},"required":["branch"],"type":"object"},"description":{"description":"Repository description","type":"string"},"git":{"description":"The repository on Git.\nMutually exclusive with local | github | git.","properties":{"branch":{"description":"The branch to use in the repository.","type":"string"},"encryptedToken":{"description":"Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.","items":{"type":"string"},"type":"array"},"path":{"description":"Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.","type":"string"},"token":{"description":"Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.","type":"string"},"tokenUser":{"description":"TokenUser is the user that will be used to access the repository if it's a personal access token.","type":"string"},"url":{"description":"The repository URL (e.g. ` + "`" + `https://github.com/example/test.git` + "`" + `).","type":"string"}},"required":["branch"],"type":"object"},"github":{"description":"The repository on GitHub.\nMutually exclusive with local | github | git.","properties":{"branch":{"description":"The branch to use in the repository.","type":"string"},"encryptedToken":{"description":"Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.","items":{"type":"string"},"type":"array"},"generateDashboardPreviews":{"description":"Whether we should show dashboard previews for pull requests.\nBy default, this is false (i.e. we will not create previews).","type":"boolean"},"path":{"description":"Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.","type":"string"},"token":{"description":"Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.","type":"string"},"url":{"description":"The repository URL (e.g. ` + "`" + `https://github.com/example/test` + "`" + `).","type":"string"}},"required":["branch"],"type":"object"},"gitlab":{"description":"The repository on GitLab.\nMutually exclusive with local | github | git.","properties":{"branch":{"description":"The branch to use in the repository.","type":"string"},"encryptedToken":{"description":"Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.","items":{"type":"string"},"type":"array"},"path":{"description":"Path is the subdirectory for the Grafana data. If specified, Grafana will ignore anything that is outside this directory in the repository.","type":"string"},"token":{"description":"Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.","type":"string"},"url":{"description":"The repository URL (e.g. ` + "`" + `https://gitlab.com/example/test` + "`" + `).","type":"string"}},"required":["branch"],"type":"object"},"local":{"description":"The repository on the local file system.\nMutually exclusive with local | github.","properties":{"path":{"description":"Path to the local repository","type":"string"}},"required":["path"],"type":"object"},"sync":{"description":"Sync settings -- how values are pulled from the repository into grafana","properties":{"enabled":{"description":"Enabled must be saved as true before any sync job will run","type":"boolean"},"intervalSeconds":{"description":"When non-zero, the sync will run periodically","type":"integer"},"target":{"description":"Where values should be saved","enum":["unified","legacy"],"type":"string"}},"required":["enabled","target"],"type":"object"},"title":{"description":"The repository display name (shown in the UI)","type":"string"},"type":{"description":"The repository type. When selected oneOf the values below should be non-nil","enum":["local","github","git","bitbucket","gitlab"],"type":"string"},"workflows":{"description":"UI driven Workflow that allow changes to the contends of the repository.\nThe order is relevant for defining the precedence of the workflows.\nWhen empty, the repository does not support any edits (eg, readonly)","items":{"type":"string"},"type":"array"}},"required":["title","sync","type"],"type":"object"},"status":{"properties":{"additionalFields":{"description":"additionalFields is reserved for future use","type":"object","x-kubernetes-preserve-unknown-fields":true},"health":{"description":"This will get updated with the current health status (and updated periodically)","properties":{"checked":{"description":"When the health was checked last time","type":"integer"},"healthy":{"description":"When not healthy, requests will not be executed","type":"boolean"},"message":{"description":"Summary messages (can be shown to users)\nWill only be populated when not healthy","items":{"type":"string"},"type":"array"}},"required":["healthy"],"type":"object"},"observedGeneration":{"description":"The generation of the spec last time reconciliation ran","type":"integer"},"operatorStates":{"additionalProperties":{"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"description":"details contains any extra information that is operator-specific","type":"object","x-kubernetes-preserve-unknown-fields":true},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"},"stats":{"description":"The object count when sync last ran","items":{"properties":{"count":{"type":"integer"},"group":{"type":"string"},"resource":{"type":"string"}},"required":["group","resource","count"],"type":"object"},"type":"array"},"sync":{"description":"Sync information with the last sync information","properties":{"finished":{"description":"When the sync job finished","type":"integer"},"incremental":{"description":"Incremental synchronization for versioned repositories","type":"boolean"},"job":{"description":"The ID for the job that ran this sync","type":"string"},"lastRef":{"description":"The repository ref when the last successful sync ran","type":"string"},"message":{"description":"Summary messages (will be shown to users)","items":{"type":"string"},"type":"array"},"scheduled":{"description":"When the next sync check is scheduled","type":"integer"},"started":{"description":"When the sync job started","type":"integer"},"state":{"description":"pending, running, success, error","enum":["pending","running","success","error"],"type":"string"}},"required":["state","message"],"type":"object"},"webhook":{"description":"Webhook Information (if applicable)","properties":{"encryptedSecret":{"items":{"type":"string"},"type":"array"},"id":{"type":"integer"},"lastEvent":{"type":"integer"},"secret":{"type":"string"},"subscribedEvents":{"items":{"type":"string"},"type":"array"},"url":{"type":"string"}},"type":"object"}},"required":["health","sync"],"type":"object"}}`)
versionSchemaRepositoryv0alpha1 app.VersionSchema
_ = json.Unmarshal(rawSchemaRepositoryv0alpha1, &versionSchemaRepositoryv0alpha1)
)
var appManifestData = app.ManifestData{
AppName: "provisioning",
Group: "provisioning.grafana.app",
Versions: []app.ManifestVersion{
{
Name: "v0alpha1",
Served: true,
Kinds: []app.ManifestVersionKind{
{
Kind: "Repository",
Plural: "Repositories",
Scope: "Namespaced",
Conversion: false,
Admission: &app.AdmissionCapabilities{
Validation: &app.ValidationCapability{
Operations: []app.AdmissionOperation{
app.AdmissionOperationCreate,
app.AdmissionOperationUpdate,
},
},
},
Schema: &versionSchemaRepositoryv0alpha1,
},
},
},
},
}
func LocalManifest() app.Manifest {
return app.NewEmbeddedManifest(appManifestData)
}
func RemoteManifest() app.Manifest {
return app.NewAPIServerManifest("provisioning")
}
var kindVersionToGoType = map[string]resource.Kind{
"Repository/v0alpha1": v0alpha1.RepositoryKind(),
}
// ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists.
// If there is no association for the provided Kind and Version, exists will return false.
func ManifestGoTypeAssociator(kind, version string) (goType resource.Kind, exists bool) {
goType, exists = kindVersionToGoType[fmt.Sprintf("%s/%s", kind, version)]
return goType, exists
}
var customRouteToGoResponseType = map[string]any{}
// ManifestCustomRouteResponsesAssociator returns the associated response go type for a given kind, version, custom route path, and method, if one exists.
// kind may be empty for custom routes which are not kind subroutes. Leading slashes are removed from subroute paths.
// If there is no association for the provided kind, version, custom route path, and method, exists will return false.
func ManifestCustomRouteResponsesAssociator(kind, version, path, verb string) (goType any, exists bool) {
if len(path) > 0 && path[0] == '/' {
path = path[1:]
}
goType, exists = customRouteToGoResponseType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))]
return goType, exists
}