From 45a586c725162a52480bc0a8b9fba87f992daf1e Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Thu, 13 Feb 2025 13:25:21 +0100 Subject: [PATCH] feat: regen openapi --- pkg/apis/provisioning/v0alpha1/types.go | 1 + .../provisioning/v0alpha1/zz_generated.deepcopy.go | 5 +++++ .../provisioning/v0alpha1/zz_generated.openapi.go | 14 +++++++++++++- .../v0alpha1/githubrepositoryconfig.go | 11 +++++++++++ .../provisioning.grafana.app-v0alpha1.json | 8 +++++++- .../app/features/provisioning/api/endpoints.gen.ts | 4 +++- 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/pkg/apis/provisioning/v0alpha1/types.go b/pkg/apis/provisioning/v0alpha1/types.go index a245246335f..7583af30dc1 100644 --- a/pkg/apis/provisioning/v0alpha1/types.go +++ b/pkg/apis/provisioning/v0alpha1/types.go @@ -56,6 +56,7 @@ type GitHubRepositoryConfig struct { Token string `json:"token,omitempty"` // Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted. + // +listType=atomic EncryptedToken []byte `json:"encryptedToken,omitempty"` // Workflow allowed for changes to the repository. diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go b/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go index 92a4bc345c0..a31190ecb79 100644 --- a/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.deepcopy.go @@ -93,6 +93,11 @@ func (in *FileList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitHubRepositoryConfig) DeepCopyInto(out *GitHubRepositoryConfig) { *out = *in + if in.EncryptedToken != nil { + in, out := &in.EncryptedToken, &out.EncryptedToken + *out = make([]byte, len(*in)) + copy(*out, *in) + } if in.Workflows != nil { in, out := &in.Workflows, &out.Workflows *out = make([]Workflow, len(*in)) diff --git a/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go index ba44abc7892..93e3e4bcf76 100644 --- a/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go +++ b/pkg/apis/provisioning/v0alpha1/zz_generated.openapi.go @@ -255,11 +255,23 @@ func schema_pkg_apis_provisioning_v0alpha1_GitHubRepositoryConfig(ref common.Ref }, "token": { SchemaProps: spec.SchemaProps{ - Description: "Token for accessing the repository.", + Description: "Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.", Type: []string{"string"}, Format: "", }, }, + "encryptedToken": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.", + Type: []string{"string"}, + Format: "byte", + }, + }, "workflows": { SchemaProps: spec.SchemaProps{ Description: "Workflow allowed for changes to the repository. The order is relevant for defining the precedence of the workflows. Possible values: pull-request, branch, push.", diff --git a/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go b/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go index 53f85b71fa8..3003228ef15 100644 --- a/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go +++ b/pkg/generated/applyconfiguration/provisioning/v0alpha1/githubrepositoryconfig.go @@ -14,6 +14,7 @@ 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"` GenerateDashboardPreviews *bool `json:"generateDashboardPreviews,omitempty"` } @@ -48,6 +49,16 @@ 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. diff --git a/pkg/tests/apis/openapi_snapshots/provisioning.grafana.app-v0alpha1.json b/pkg/tests/apis/openapi_snapshots/provisioning.grafana.app-v0alpha1.json index 0c0aab6a190..68f0273d1bf 100644 --- a/pkg/tests/apis/openapi_snapshots/provisioning.grafana.app-v0alpha1.json +++ b/pkg/tests/apis/openapi_snapshots/provisioning.grafana.app-v0alpha1.json @@ -2788,12 +2788,18 @@ "description": "The branch to use in the repository. By default, this is the main branch.", "type": "string" }, + "encryptedToken": { + "description": "Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted.", + "type": "string", + "format": "byte", + "x-kubernetes-list-type": "atomic" + }, "generateDashboardPreviews": { "description": "Whether we should show dashboard previews for pull requests By default, this is false (i.e. we will not create previews).", "type": "boolean" }, "token": { - "description": "Token for accessing the repository.", + "description": "Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again.", "type": "string" }, "url": { diff --git a/public/app/features/provisioning/api/endpoints.gen.ts b/public/app/features/provisioning/api/endpoints.gen.ts index 72f3f7f4a36..9a16ac019ab 100644 --- a/public/app/features/provisioning/api/endpoints.gen.ts +++ b/public/app/features/provisioning/api/endpoints.gen.ts @@ -736,9 +736,11 @@ export type JobList = { export type GitHubRepositoryConfig = { /** The branch to use in the repository. By default, this is the main branch. */ branch?: string; + /** Token for accessing the repository, but encrypted. This is not possible to read back to a user decrypted. */ + encryptedToken?: string; /** Whether we should show dashboard previews for pull requests By default, this is false (i.e. we will not create previews). */ generateDashboardPreviews?: boolean; - /** Token for accessing the repository. */ + /** Token for accessing the repository. If set, it will be encrypted into encryptedToken, then set to an empty string again. */ token?: string; /** The repository URL `https://github.com/example/test`). */ url: string;