Provisioning: Update types (#100722)

* Provisioning: Remove S3

* Provisioning: Use URL for GitHub

Co-Authored-By: Ryan McKinley <ryantxu@gmail.com>
Co-Authored-By: Alex Khomenko <Clarity-89@users.noreply.github.com>

* Provisioning: Use workflow list

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

* Provisioning: Model secrets

* Provisioning: Define a total in the job summary

* Provisioning: Generate code

* Provisioning: Update testdata

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.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-17 12:45:23 +01:00
committed by GitHub
co-authored by Ryan McKinley Alex Khomenko Roberto Jiménez Sánchez
parent a05ba6ff41
commit f535a7804f
13 changed files with 174 additions and 198 deletions
@@ -4,15 +4,20 @@
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 {
Owner *string `json:"owner,omitempty"`
Repository *string `json:"repository,omitempty"`
Branch *string `json:"branch,omitempty"`
Token *string `json:"token,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"`
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
BranchWorkflow *bool `json:"branchWorkflow,omitempty"`
GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"`
}
// GitHubRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitHubRepositoryConfig type for use with
@@ -21,19 +26,11 @@ func GitHubRepositoryConfig() *GitHubRepositoryConfigApplyConfiguration {
return &GitHubRepositoryConfigApplyConfiguration{}
}
// WithOwner sets the Owner field in the declarative configuration to the given value
// WithURL sets the URL 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 Owner field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithOwner(value string) *GitHubRepositoryConfigApplyConfiguration {
b.Owner = &value
return b
}
// 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 *GitHubRepositoryConfigApplyConfiguration) WithRepository(value string) *GitHubRepositoryConfigApplyConfiguration {
b.Repository = &value
// If called multiple times, the URL field is set to the value of the last call.
func (b *GitHubRepositoryConfigApplyConfiguration) WithURL(value string) *GitHubRepositoryConfigApplyConfiguration {
b.URL = &value
return b
}
@@ -53,6 +50,26 @@ func (b *GitHubRepositoryConfigApplyConfiguration) WithToken(value string) *GitH
return b
}
// WithEncryptedToken adds the given value to the EncryptedToken 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 EncryptedToken field.
func (b *GitHubRepositoryConfigApplyConfiguration) WithEncryptedToken(values ...byte) *GitHubRepositoryConfigApplyConfiguration {
for i := range values {
b.EncryptedToken = append(b.EncryptedToken, values[i])
}
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.
@@ -17,7 +17,6 @@ type RepositorySpecApplyConfiguration struct {
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
S3 *S3RepositoryConfigApplyConfiguration `json:"s3,omitempty"`
GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"`
}
@@ -75,14 +74,6 @@ func (b *RepositorySpecApplyConfiguration) WithLocal(value *LocalRepositoryConfi
return b
}
// WithS3 sets the S3 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 S3 field is set to the value of the last call.
func (b *RepositorySpecApplyConfiguration) WithS3(value *S3RepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration {
b.S3 = value
return b
}
// WithGitHub sets the GitHub 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 GitHub field is set to the value of the last call.
@@ -1,34 +0,0 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// S3RepositoryConfigApplyConfiguration represents a declarative configuration of the S3RepositoryConfig type for use
// with apply.
type S3RepositoryConfigApplyConfiguration struct {
Region *string `json:"region,omitempty"`
Bucket *string `json:"bucket,omitempty"`
}
// S3RepositoryConfigApplyConfiguration constructs a declarative configuration of the S3RepositoryConfig type for use with
// apply.
func S3RepositoryConfig() *S3RepositoryConfigApplyConfiguration {
return &S3RepositoryConfigApplyConfiguration{}
}
// WithRegion sets the Region 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 Region field is set to the value of the last call.
func (b *S3RepositoryConfigApplyConfiguration) WithRegion(value string) *S3RepositoryConfigApplyConfiguration {
b.Region = &value
return b
}
// WithBucket sets the Bucket 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 Bucket field is set to the value of the last call.
func (b *S3RepositoryConfigApplyConfiguration) WithBucket(value string) *S3RepositoryConfigApplyConfiguration {
b.Bucket = &value
return b
}
@@ -10,6 +10,7 @@ type WebhookStatusApplyConfiguration struct {
ID *int64 `json:"id,omitempty"`
URL *string `json:"url,omitempty"`
Secret *string `json:"secret,omitempty"`
EncryptedSecret []byte `json:"encryptedSecret,omitempty"`
SubscribedEvents []string `json:"subscribedEvents,omitempty"`
}
@@ -43,6 +44,16 @@ func (b *WebhookStatusApplyConfiguration) WithSecret(value string) *WebhookStatu
return b
}
// WithEncryptedSecret adds the given value to the EncryptedSecret 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 EncryptedSecret field.
func (b *WebhookStatusApplyConfiguration) WithEncryptedSecret(values ...byte) *WebhookStatusApplyConfiguration {
for i := range values {
b.EncryptedSecret = append(b.EncryptedSecret, values[i])
}
return b
}
// WithSubscribedEvents adds the given value to the SubscribedEvents 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 SubscribedEvents field.
@@ -34,8 +34,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
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"):