Provisioning: Define large parts of our infrastructure (#101029)

* Provisioning: Define secrets service

* Provisioning: Create and store secrets service

* Provisioning: Define safepath

* Provisioning: Define the repository

* Identity: Support a provisioning service

* Provisioning: Define a job queue

* Chore: Regen code

* Provisioning: Show progress more often

Co-Authored-By: Ryan McKinley <ryantxu@gmail.com>

* Provisioning: Rename hash field to lastRef

Co-Authored-By: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= <roberto.jimenez@grafana.com>

* Provisioning: Workflows as write access

Co-Authored-By: Ryan McKinley <ryantxu@gmail.com>

* Provisioning: Regen OpenAPI snapshot

* Provisioning: Update tests to match new fields

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: =?UTF-8?q?Roberto=20Jim=C3=A9nez=20S=C3=A1nchez?= <roberto.jimenez@grafana.com>
This commit is contained in:
Mariell Hoversholm
2025-02-24 09:08:58 +01:00
committed by GitHub
co-authored by Ryan McKinley Roberto Jiménez Sánchez
parent 8f9972a509
commit 279b641469
21 changed files with 2120 additions and 134 deletions
@@ -4,20 +4,14 @@
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1"
)
// GitHubRepositoryConfigApplyConfiguration represents a declarative configuration of the GitHubRepositoryConfig type for use
// with apply.
type GitHubRepositoryConfigApplyConfiguration struct {
URL *string `json:"url,omitempty"`
Branch *string `json:"branch,omitempty"`
Token *string `json:"token,omitempty"`
EncryptedToken []byte `json:"encryptedToken,omitempty"`
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
BranchWorkflow *bool `json:"branchWorkflow,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
URL *string `json:"url,omitempty"`
Branch *string `json:"branch,omitempty"`
Token *string `json:"token,omitempty"`
EncryptedToken []byte `json:"encryptedToken,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
}
// GitHubRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitHubRepositoryConfig type for use with
@@ -60,24 +54,6 @@ func (b *GitHubRepositoryConfigApplyConfiguration) WithEncryptedToken(values ...
return b
}
// WithWorkflows adds the given value to the Workflows 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 Workflows field.
func (b *GitHubRepositoryConfigApplyConfiguration) WithWorkflows(values ...provisioningv0alpha1.Workflow) *GitHubRepositoryConfigApplyConfiguration {
for i := range values {
b.Workflows = append(b.Workflows, values[i])
}
return b
}
// WithBranchWorkflow sets the BranchWorkflow 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 BranchWorkflow field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithBranchWorkflow(value bool) *GitHubRepositoryConfigApplyConfiguration {
b.BranchWorkflow = &value
return b
}
// WithGenerateDashboardPreviews sets the GenerateDashboardPreviews 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 GenerateDashboardPreviews field is set to the value of the last call.
@@ -13,7 +13,7 @@ import (
type RepositorySpecApplyConfiguration struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
ReadOnly *bool `json:"readOnly,omitempty"`
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
@@ -42,11 +42,13 @@ func (b *RepositorySpecApplyConfiguration) WithDescription(value string) *Reposi
return b
}
// 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 ReadOnly field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithReadOnly(value bool) *RepositorySpecApplyConfiguration {
b.ReadOnly = &value
// WithWorkflows adds the given value to the Workflows 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 Workflows field.
func (b *RepositorySpecApplyConfiguration) WithWorkflows(values ...provisioningv0alpha1.Workflow) *RepositorySpecApplyConfiguration {
for i := range values {
b.Workflows = append(b.Workflows, values[i])
}
return b
}
@@ -17,7 +17,7 @@ type SyncStatusApplyConfiguration struct {
Finished *int64 `json:"finished,omitempty"`
Scheduled *int64 `json:"scheduled,omitempty"`
Message []string `json:"message,omitempty"`
Hash *string `json:"hash,omitempty"`
LastRef *string `json:"lastRef,omitempty"`
Incremental *bool `json:"incremental,omitempty"`
}
@@ -77,11 +77,11 @@ func (b *SyncStatusApplyConfiguration) WithMessage(values ...string) *SyncStatus
return b
}
// WithHash sets the Hash field in the declarative configuration to the given value
// WithLastRef sets the LastRef 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 Hash field is set to the value of the last call.
func (b *SyncStatusApplyConfiguration) WithHash(value string) *SyncStatusApplyConfiguration {
b.Hash = &value
// If called multiple times, the LastRef field is set to the value of the last call.
func (b *SyncStatusApplyConfiguration) WithLastRef(value string) *SyncStatusApplyConfiguration {
b.LastRef = &value
return b
}