Provisioning: Return available repository types in settings endpoint (#107977)
* Add types for other repositories * Inject the types from extras * Fix go-lint * Fix typecheck * Add it to the tests --------- Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
co-authored by
Stephanie Hingtgen
parent
eab8c1db07
commit
b49b103f42
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// BitbucketRepositoryConfigApplyConfiguration represents a declarative configuration of the BitbucketRepositoryConfig type for use
|
||||
// with apply.
|
||||
type BitbucketRepositoryConfigApplyConfiguration struct {
|
||||
URL *string `json:"url,omitempty"`
|
||||
Branch *string `json:"branch,omitempty"`
|
||||
Token *string `json:"token,omitempty"`
|
||||
EncryptedToken []byte `json:"encryptedToken,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
// BitbucketRepositoryConfigApplyConfiguration constructs a declarative configuration of the BitbucketRepositoryConfig type for use with
|
||||
// apply.
|
||||
func BitbucketRepositoryConfig() *BitbucketRepositoryConfigApplyConfiguration {
|
||||
return &BitbucketRepositoryConfigApplyConfiguration{}
|
||||
}
|
||||
|
||||
// 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 URL field is set to the value of the last call.
|
||||
func (b *BitbucketRepositoryConfigApplyConfiguration) WithURL(value string) *BitbucketRepositoryConfigApplyConfiguration {
|
||||
b.URL = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithBranch sets the Branch 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 Branch field is set to the value of the last call.
|
||||
func (b *BitbucketRepositoryConfigApplyConfiguration) WithBranch(value string) *BitbucketRepositoryConfigApplyConfiguration {
|
||||
b.Branch = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithToken sets the Token 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 Token field is set to the value of the last call.
|
||||
func (b *BitbucketRepositoryConfigApplyConfiguration) WithToken(value string) *BitbucketRepositoryConfigApplyConfiguration {
|
||||
b.Token = &value
|
||||
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 *BitbucketRepositoryConfigApplyConfiguration) WithEncryptedToken(values ...byte) *BitbucketRepositoryConfigApplyConfiguration {
|
||||
for i := range values {
|
||||
b.EncryptedToken = append(b.EncryptedToken, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPath sets the Path 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 Path field is set to the value of the last call.
|
||||
func (b *BitbucketRepositoryConfigApplyConfiguration) WithPath(value string) *BitbucketRepositoryConfigApplyConfiguration {
|
||||
b.Path = &value
|
||||
return b
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
// Code generated by applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v0alpha1
|
||||
|
||||
// GitLabRepositoryConfigApplyConfiguration represents a declarative configuration of the GitLabRepositoryConfig type for use
|
||||
// with apply.
|
||||
type GitLabRepositoryConfigApplyConfiguration struct {
|
||||
URL *string `json:"url,omitempty"`
|
||||
Branch *string `json:"branch,omitempty"`
|
||||
Token *string `json:"token,omitempty"`
|
||||
EncryptedToken []byte `json:"encryptedToken,omitempty"`
|
||||
Path *string `json:"path,omitempty"`
|
||||
}
|
||||
|
||||
// GitLabRepositoryConfigApplyConfiguration constructs a declarative configuration of the GitLabRepositoryConfig type for use with
|
||||
// apply.
|
||||
func GitLabRepositoryConfig() *GitLabRepositoryConfigApplyConfiguration {
|
||||
return &GitLabRepositoryConfigApplyConfiguration{}
|
||||
}
|
||||
|
||||
// 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 URL field is set to the value of the last call.
|
||||
func (b *GitLabRepositoryConfigApplyConfiguration) WithURL(value string) *GitLabRepositoryConfigApplyConfiguration {
|
||||
b.URL = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithBranch sets the Branch 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 Branch field is set to the value of the last call.
|
||||
func (b *GitLabRepositoryConfigApplyConfiguration) WithBranch(value string) *GitLabRepositoryConfigApplyConfiguration {
|
||||
b.Branch = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithToken sets the Token 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 Token field is set to the value of the last call.
|
||||
func (b *GitLabRepositoryConfigApplyConfiguration) WithToken(value string) *GitLabRepositoryConfigApplyConfiguration {
|
||||
b.Token = &value
|
||||
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 *GitLabRepositoryConfigApplyConfiguration) WithEncryptedToken(values ...byte) *GitLabRepositoryConfigApplyConfiguration {
|
||||
for i := range values {
|
||||
b.EncryptedToken = append(b.EncryptedToken, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPath sets the Path 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 Path field is set to the value of the last call.
|
||||
func (b *GitLabRepositoryConfigApplyConfiguration) WithPath(value string) *GitLabRepositoryConfigApplyConfiguration {
|
||||
b.Path = &value
|
||||
return b
|
||||
}
|
||||
@@ -11,14 +11,16 @@ import (
|
||||
// RepositorySpecApplyConfiguration represents a declarative configuration of the RepositorySpec type for use
|
||||
// with apply.
|
||||
type RepositorySpecApplyConfiguration struct {
|
||||
Title *string `json:"title,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
|
||||
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
|
||||
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
|
||||
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
|
||||
GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"`
|
||||
Git *GitRepositoryConfigApplyConfiguration `json:"git,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Workflows []provisioningv0alpha1.Workflow `json:"workflows,omitempty"`
|
||||
Sync *SyncOptionsApplyConfiguration `json:"sync,omitempty"`
|
||||
Type *provisioningv0alpha1.RepositoryType `json:"type,omitempty"`
|
||||
Local *LocalRepositoryConfigApplyConfiguration `json:"local,omitempty"`
|
||||
GitHub *GitHubRepositoryConfigApplyConfiguration `json:"github,omitempty"`
|
||||
Git *GitRepositoryConfigApplyConfiguration `json:"git,omitempty"`
|
||||
Bitbucket *BitbucketRepositoryConfigApplyConfiguration `json:"bitbucket,omitempty"`
|
||||
GitLab *GitLabRepositoryConfigApplyConfiguration `json:"gitlab,omitempty"`
|
||||
}
|
||||
|
||||
// RepositorySpecApplyConfiguration constructs a declarative configuration of the RepositorySpec type for use with
|
||||
@@ -92,3 +94,19 @@ func (b *RepositorySpecApplyConfiguration) WithGit(value *GitRepositoryConfigApp
|
||||
b.Git = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithBitbucket sets the Bitbucket 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 Bitbucket field is set to the value of the last call.
|
||||
func (b *RepositorySpecApplyConfiguration) WithBitbucket(value *BitbucketRepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration {
|
||||
b.Bitbucket = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGitLab sets the GitLab 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 GitLab field is set to the value of the last call.
|
||||
func (b *RepositorySpecApplyConfiguration) WithGitLab(value *GitLabRepositoryConfigApplyConfiguration) *RepositorySpecApplyConfiguration {
|
||||
b.GitLab = value
|
||||
return b
|
||||
}
|
||||
|
||||
@@ -20,8 +20,12 @@ import (
|
||||
func ForKind(kind schema.GroupVersionKind) interface{} {
|
||||
switch kind {
|
||||
// Group=provisioning.grafana.app, Version=v0alpha1
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("BitbucketRepositoryConfig"):
|
||||
return &provisioningv0alpha1.BitbucketRepositoryConfigApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("GitHubRepositoryConfig"):
|
||||
return &provisioningv0alpha1.GitHubRepositoryConfigApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("GitLabRepositoryConfig"):
|
||||
return &provisioningv0alpha1.GitLabRepositoryConfigApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("GitRepositoryConfig"):
|
||||
return &provisioningv0alpha1.GitRepositoryConfigApplyConfiguration{}
|
||||
case v0alpha1.SchemeGroupVersion.WithKind("HealthStatus"):
|
||||
|
||||
Reference in New Issue
Block a user