Provisioning: generate client for jobs (#109242)

* Generate client for jobs

* Revert changes in client and openapi
This commit is contained in:
Roberto Jiménez Sánchez
2025-08-06 10:32:11 +00:00
committed by GitHub
parent 7e09f75100
commit 102d230321
24 changed files with 1130 additions and 17 deletions
@@ -4,6 +4,11 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// When this code is changed, make sure to update the code generation.
// As of writing, this can be done via the hack dir in the root of the repo: ./hack/update-codegen.sh provisioning
// If you've opened the generated files in this dir at some point in VSCode, you may also have to re-open them to clear errors.
// +genclient
// The repository name and type are stored as labels
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Job struct {
@@ -230,20 +235,3 @@ type JobResourceSummary struct {
// This may not be an exhaustive list and recommend looking at the logs for more info
Errors []string `json:"errors,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type WebhookResponse struct {
metav1.TypeMeta `json:",inline"`
// HTTP Status code
// 200 implies that the payload was understood but nothing is required
// 202 implies that an async job has been scheduled to handle the request
Code int `json:"code,omitempty"`
// Optional message
Message string `json:"added,omitempty"`
// Jobs to be processed
// When the response is 202 (Accepted) the queued jobs will be returned
Job *JobSpec `json:"job,omitempty"`
}
@@ -0,0 +1,20 @@
package v0alpha1
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type WebhookResponse struct {
metav1.TypeMeta `json:",inline"`
// HTTP Status code
// 200 implies that the payload was understood but nothing is required
// 202 implies that an async job has been scheduled to handle the request
Code int `json:"code,omitempty"`
// Optional message
Message string `json:"added,omitempty"`
// Jobs to be processed
// When the response is 202 (Accepted) the queued jobs will be returned
Job *JobSpec `json:"job,omitempty"`
}
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// DeleteJobOptionsApplyConfiguration represents a declarative configuration of the DeleteJobOptions type for use
// with apply.
type DeleteJobOptionsApplyConfiguration struct {
Ref *string `json:"ref,omitempty"`
Paths []string `json:"paths,omitempty"`
Resources []ResourceRefApplyConfiguration `json:"resources,omitempty"`
}
// DeleteJobOptionsApplyConfiguration constructs a declarative configuration of the DeleteJobOptions type for use with
// apply.
func DeleteJobOptions() *DeleteJobOptionsApplyConfiguration {
return &DeleteJobOptionsApplyConfiguration{}
}
// WithRef sets the Ref 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 Ref field is set to the value of the last call.
func (b *DeleteJobOptionsApplyConfiguration) WithRef(value string) *DeleteJobOptionsApplyConfiguration {
b.Ref = &value
return b
}
// WithPaths adds the given value to the Paths 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 Paths field.
func (b *DeleteJobOptionsApplyConfiguration) WithPaths(values ...string) *DeleteJobOptionsApplyConfiguration {
for i := range values {
b.Paths = append(b.Paths, values[i])
}
return b
}
// WithResources adds the given value to the Resources 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 Resources field.
func (b *DeleteJobOptionsApplyConfiguration) WithResources(values ...*ResourceRefApplyConfiguration) *DeleteJobOptionsApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithResources")
}
b.Resources = append(b.Resources, *values[i])
}
return b
}
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// ExportJobOptionsApplyConfiguration represents a declarative configuration of the ExportJobOptions type for use
// with apply.
type ExportJobOptionsApplyConfiguration struct {
Message *string `json:"message,omitempty"`
Folder *string `json:"folder,omitempty"`
Branch *string `json:"branch,omitempty"`
Path *string `json:"path,omitempty"`
}
// ExportJobOptionsApplyConfiguration constructs a declarative configuration of the ExportJobOptions type for use with
// apply.
func ExportJobOptions() *ExportJobOptionsApplyConfiguration {
return &ExportJobOptionsApplyConfiguration{}
}
// WithMessage sets the Message 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 Message field is set to the value of the last call.
func (b *ExportJobOptionsApplyConfiguration) WithMessage(value string) *ExportJobOptionsApplyConfiguration {
b.Message = &value
return b
}
// WithFolder sets the Folder 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 Folder field is set to the value of the last call.
func (b *ExportJobOptionsApplyConfiguration) WithFolder(value string) *ExportJobOptionsApplyConfiguration {
b.Folder = &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 *ExportJobOptionsApplyConfiguration) WithBranch(value string) *ExportJobOptionsApplyConfiguration {
b.Branch = &value
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 *ExportJobOptionsApplyConfiguration) WithPath(value string) *ExportJobOptionsApplyConfiguration {
b.Path = &value
return b
}
@@ -0,0 +1,211 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
)
// JobApplyConfiguration represents a declarative configuration of the Job type for use
// with apply.
type JobApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
Spec *JobSpecApplyConfiguration `json:"spec,omitempty"`
Status *JobStatusApplyConfiguration `json:"status,omitempty"`
}
// Job constructs a declarative configuration of the Job type for use with
// apply.
func Job(name, namespace string) *JobApplyConfiguration {
b := &JobApplyConfiguration{}
b.WithName(name)
b.WithNamespace(namespace)
b.WithKind("Job")
b.WithAPIVersion("provisioning.grafana.app/v0alpha1")
return b
}
// WithKind sets the Kind 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 Kind field is set to the value of the last call.
func (b *JobApplyConfiguration) WithKind(value string) *JobApplyConfiguration {
b.TypeMetaApplyConfiguration.Kind = &value
return b
}
// WithAPIVersion sets the APIVersion 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 APIVersion field is set to the value of the last call.
func (b *JobApplyConfiguration) WithAPIVersion(value string) *JobApplyConfiguration {
b.TypeMetaApplyConfiguration.APIVersion = &value
return b
}
// WithName sets the Name 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 Name field is set to the value of the last call.
func (b *JobApplyConfiguration) WithName(value string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Name = &value
return b
}
// WithGenerateName sets the GenerateName 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 GenerateName field is set to the value of the last call.
func (b *JobApplyConfiguration) WithGenerateName(value string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.GenerateName = &value
return b
}
// WithNamespace sets the Namespace 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 Namespace field is set to the value of the last call.
func (b *JobApplyConfiguration) WithNamespace(value string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Namespace = &value
return b
}
// WithUID sets the UID 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 UID field is set to the value of the last call.
func (b *JobApplyConfiguration) WithUID(value types.UID) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.UID = &value
return b
}
// WithResourceVersion sets the ResourceVersion 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 ResourceVersion field is set to the value of the last call.
func (b *JobApplyConfiguration) WithResourceVersion(value string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
return b
}
// WithGeneration sets the Generation 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 Generation field is set to the value of the last call.
func (b *JobApplyConfiguration) WithGeneration(value int64) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.Generation = &value
return b
}
// WithCreationTimestamp sets the CreationTimestamp 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 CreationTimestamp field is set to the value of the last call.
func (b *JobApplyConfiguration) WithCreationTimestamp(value metav1.Time) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
return b
}
// WithDeletionTimestamp sets the DeletionTimestamp 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 DeletionTimestamp field is set to the value of the last call.
func (b *JobApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
return b
}
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds 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 DeletionGracePeriodSeconds field is set to the value of the last call.
func (b *JobApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
return b
}
// WithLabels puts the entries into the Labels field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Labels field,
// overwriting an existing map entries in Labels field with the same key.
func (b *JobApplyConfiguration) WithLabels(entries map[string]string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Labels[k] = v
}
return b
}
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
// If called multiple times, the entries provided by each call will be put on the Annotations field,
// overwriting an existing map entries in Annotations field with the same key.
func (b *JobApplyConfiguration) WithAnnotations(entries map[string]string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
}
for k, v := range entries {
b.ObjectMetaApplyConfiguration.Annotations[k] = v
}
return b
}
// WithOwnerReferences adds the given value to the OwnerReferences 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 OwnerReferences field.
func (b *JobApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
if values[i] == nil {
panic("nil value passed to WithOwnerReferences")
}
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
}
return b
}
// WithFinalizers adds the given value to the Finalizers 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 Finalizers field.
func (b *JobApplyConfiguration) WithFinalizers(values ...string) *JobApplyConfiguration {
b.ensureObjectMetaApplyConfigurationExists()
for i := range values {
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
}
return b
}
func (b *JobApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
if b.ObjectMetaApplyConfiguration == nil {
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
}
}
// WithSpec sets the Spec 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 Spec field is set to the value of the last call.
func (b *JobApplyConfiguration) WithSpec(value *JobSpecApplyConfiguration) *JobApplyConfiguration {
b.Spec = value
return b
}
// WithStatus sets the Status 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 Status field is set to the value of the last call.
func (b *JobApplyConfiguration) WithStatus(value *JobStatusApplyConfiguration) *JobApplyConfiguration {
b.Status = value
return b
}
// GetName retrieves the value of the Name field in the declarative configuration.
func (b *JobApplyConfiguration) GetName() *string {
b.ensureObjectMetaApplyConfigurationExists()
return b.ObjectMetaApplyConfiguration.Name
}
@@ -0,0 +1,108 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// JobResourceSummaryApplyConfiguration represents a declarative configuration of the JobResourceSummary type for use
// with apply.
type JobResourceSummaryApplyConfiguration struct {
Group *string `json:"group,omitempty"`
Resource *string `json:"resource,omitempty"`
Total *int64 `json:"total,omitempty"`
Create *int64 `json:"create,omitempty"`
Update *int64 `json:"update,omitempty"`
Delete *int64 `json:"delete,omitempty"`
Write *int64 `json:"write,omitempty"`
Error *int64 `json:"error,omitempty"`
Noop *int64 `json:"noop,omitempty"`
Errors []string `json:"errors,omitempty"`
}
// JobResourceSummaryApplyConfiguration constructs a declarative configuration of the JobResourceSummary type for use with
// apply.
func JobResourceSummary() *JobResourceSummaryApplyConfiguration {
return &JobResourceSummaryApplyConfiguration{}
}
// WithGroup sets the Group 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 Group field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithGroup(value string) *JobResourceSummaryApplyConfiguration {
b.Group = &value
return b
}
// WithResource sets the Resource 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 Resource field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithResource(value string) *JobResourceSummaryApplyConfiguration {
b.Resource = &value
return b
}
// WithTotal sets the Total 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 Total field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithTotal(value int64) *JobResourceSummaryApplyConfiguration {
b.Total = &value
return b
}
// WithCreate sets the Create 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 Create field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithCreate(value int64) *JobResourceSummaryApplyConfiguration {
b.Create = &value
return b
}
// WithUpdate sets the Update 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 Update field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithUpdate(value int64) *JobResourceSummaryApplyConfiguration {
b.Update = &value
return b
}
// WithDelete sets the Delete 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 Delete field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithDelete(value int64) *JobResourceSummaryApplyConfiguration {
b.Delete = &value
return b
}
// WithWrite sets the Write 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 Write field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithWrite(value int64) *JobResourceSummaryApplyConfiguration {
b.Write = &value
return b
}
// WithError sets the Error 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 Error field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithError(value int64) *JobResourceSummaryApplyConfiguration {
b.Error = &value
return b
}
// WithNoop sets the Noop 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 Noop field is set to the value of the last call.
func (b *JobResourceSummaryApplyConfiguration) WithNoop(value int64) *JobResourceSummaryApplyConfiguration {
b.Noop = &value
return b
}
// WithErrors adds the given value to the Errors 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 Errors field.
func (b *JobResourceSummaryApplyConfiguration) WithErrors(values ...string) *JobResourceSummaryApplyConfiguration {
for i := range values {
b.Errors = append(b.Errors, values[i])
}
return b
}
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
)
// JobSpecApplyConfiguration represents a declarative configuration of the JobSpec type for use
// with apply.
type JobSpecApplyConfiguration struct {
Action *provisioningv0alpha1.JobAction `json:"action,omitempty"`
Repository *string `json:"repository,omitempty"`
PullRequest *PullRequestJobOptionsApplyConfiguration `json:"pr,omitempty"`
Push *ExportJobOptionsApplyConfiguration `json:"push,omitempty"`
Pull *SyncJobOptionsApplyConfiguration `json:"pull,omitempty"`
Migrate *MigrateJobOptionsApplyConfiguration `json:"migrate,omitempty"`
Delete *DeleteJobOptionsApplyConfiguration `json:"delete,omitempty"`
Move *MoveJobOptionsApplyConfiguration `json:"move,omitempty"`
}
// JobSpecApplyConfiguration constructs a declarative configuration of the JobSpec type for use with
// apply.
func JobSpec() *JobSpecApplyConfiguration {
return &JobSpecApplyConfiguration{}
}
// WithAction sets the Action 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 Action field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithAction(value provisioningv0alpha1.JobAction) *JobSpecApplyConfiguration {
b.Action = &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 *JobSpecApplyConfiguration) WithRepository(value string) *JobSpecApplyConfiguration {
b.Repository = &value
return b
}
// WithPullRequest sets the PullRequest 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 PullRequest field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithPullRequest(value *PullRequestJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.PullRequest = value
return b
}
// WithPush sets the Push 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 Push field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithPush(value *ExportJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.Push = value
return b
}
// WithPull sets the Pull 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 Pull field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithPull(value *SyncJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.Pull = value
return b
}
// WithMigrate sets the Migrate 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 Migrate field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithMigrate(value *MigrateJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.Migrate = value
return b
}
// WithDelete sets the Delete 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 Delete field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithDelete(value *DeleteJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.Delete = value
return b
}
// WithMove sets the Move 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 Move field is set to the value of the last call.
func (b *JobSpecApplyConfiguration) WithMove(value *MoveJobOptionsApplyConfiguration) *JobSpecApplyConfiguration {
b.Move = value
return b
}
@@ -0,0 +1,90 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
)
// JobStatusApplyConfiguration represents a declarative configuration of the JobStatus type for use
// with apply.
type JobStatusApplyConfiguration struct {
State *provisioningv0alpha1.JobState `json:"state,omitempty"`
Started *int64 `json:"started,omitempty"`
Finished *int64 `json:"finished,omitempty"`
Message *string `json:"message,omitempty"`
Errors []string `json:"errors,omitempty"`
Progress *float64 `json:"progress,omitempty"`
Summary []*provisioningv0alpha1.JobResourceSummary `json:"summary,omitempty"`
}
// JobStatusApplyConfiguration constructs a declarative configuration of the JobStatus type for use with
// apply.
func JobStatus() *JobStatusApplyConfiguration {
return &JobStatusApplyConfiguration{}
}
// WithState sets the State 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 State field is set to the value of the last call.
func (b *JobStatusApplyConfiguration) WithState(value provisioningv0alpha1.JobState) *JobStatusApplyConfiguration {
b.State = &value
return b
}
// WithStarted sets the Started 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 Started field is set to the value of the last call.
func (b *JobStatusApplyConfiguration) WithStarted(value int64) *JobStatusApplyConfiguration {
b.Started = &value
return b
}
// WithFinished sets the Finished 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 Finished field is set to the value of the last call.
func (b *JobStatusApplyConfiguration) WithFinished(value int64) *JobStatusApplyConfiguration {
b.Finished = &value
return b
}
// WithMessage sets the Message 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 Message field is set to the value of the last call.
func (b *JobStatusApplyConfiguration) WithMessage(value string) *JobStatusApplyConfiguration {
b.Message = &value
return b
}
// WithErrors adds the given value to the Errors 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 Errors field.
func (b *JobStatusApplyConfiguration) WithErrors(values ...string) *JobStatusApplyConfiguration {
for i := range values {
b.Errors = append(b.Errors, values[i])
}
return b
}
// WithProgress sets the Progress 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 Progress field is set to the value of the last call.
func (b *JobStatusApplyConfiguration) WithProgress(value float64) *JobStatusApplyConfiguration {
b.Progress = &value
return b
}
// WithSummary adds the given value to the Summary 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 Summary field.
func (b *JobStatusApplyConfiguration) WithSummary(values ...**provisioningv0alpha1.JobResourceSummary) *JobStatusApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithSummary")
}
b.Summary = append(b.Summary, *values[i])
}
return b
}
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// MigrateJobOptionsApplyConfiguration represents a declarative configuration of the MigrateJobOptions type for use
// with apply.
type MigrateJobOptionsApplyConfiguration struct {
History *bool `json:"history,omitempty"`
Message *string `json:"message,omitempty"`
}
// MigrateJobOptionsApplyConfiguration constructs a declarative configuration of the MigrateJobOptions type for use with
// apply.
func MigrateJobOptions() *MigrateJobOptionsApplyConfiguration {
return &MigrateJobOptionsApplyConfiguration{}
}
// WithHistory sets the History 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 History field is set to the value of the last call.
func (b *MigrateJobOptionsApplyConfiguration) WithHistory(value bool) *MigrateJobOptionsApplyConfiguration {
b.History = &value
return b
}
// WithMessage sets the Message 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 Message field is set to the value of the last call.
func (b *MigrateJobOptionsApplyConfiguration) WithMessage(value string) *MigrateJobOptionsApplyConfiguration {
b.Message = &value
return b
}
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// MoveJobOptionsApplyConfiguration represents a declarative configuration of the MoveJobOptions type for use
// with apply.
type MoveJobOptionsApplyConfiguration struct {
Ref *string `json:"ref,omitempty"`
Paths []string `json:"paths,omitempty"`
TargetPath *string `json:"targetPath,omitempty"`
Resources []ResourceRefApplyConfiguration `json:"resources,omitempty"`
}
// MoveJobOptionsApplyConfiguration constructs a declarative configuration of the MoveJobOptions type for use with
// apply.
func MoveJobOptions() *MoveJobOptionsApplyConfiguration {
return &MoveJobOptionsApplyConfiguration{}
}
// WithRef sets the Ref 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 Ref field is set to the value of the last call.
func (b *MoveJobOptionsApplyConfiguration) WithRef(value string) *MoveJobOptionsApplyConfiguration {
b.Ref = &value
return b
}
// WithPaths adds the given value to the Paths 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 Paths field.
func (b *MoveJobOptionsApplyConfiguration) WithPaths(values ...string) *MoveJobOptionsApplyConfiguration {
for i := range values {
b.Paths = append(b.Paths, values[i])
}
return b
}
// WithTargetPath sets the TargetPath 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 TargetPath field is set to the value of the last call.
func (b *MoveJobOptionsApplyConfiguration) WithTargetPath(value string) *MoveJobOptionsApplyConfiguration {
b.TargetPath = &value
return b
}
// WithResources adds the given value to the Resources 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 Resources field.
func (b *MoveJobOptionsApplyConfiguration) WithResources(values ...*ResourceRefApplyConfiguration) *MoveJobOptionsApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithResources")
}
b.Resources = append(b.Resources, *values[i])
}
return b
}
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// PullRequestJobOptionsApplyConfiguration represents a declarative configuration of the PullRequestJobOptions type for use
// with apply.
type PullRequestJobOptionsApplyConfiguration struct {
Ref *string `json:"ref,omitempty"`
PR *int `json:"pr,omitempty"`
Hash *string `json:"hash,omitempty"`
URL *string `json:"url,omitempty"`
}
// PullRequestJobOptionsApplyConfiguration constructs a declarative configuration of the PullRequestJobOptions type for use with
// apply.
func PullRequestJobOptions() *PullRequestJobOptionsApplyConfiguration {
return &PullRequestJobOptionsApplyConfiguration{}
}
// WithRef sets the Ref 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 Ref field is set to the value of the last call.
func (b *PullRequestJobOptionsApplyConfiguration) WithRef(value string) *PullRequestJobOptionsApplyConfiguration {
b.Ref = &value
return b
}
// WithPR sets the PR 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 PR field is set to the value of the last call.
func (b *PullRequestJobOptionsApplyConfiguration) WithPR(value int) *PullRequestJobOptionsApplyConfiguration {
b.PR = &value
return b
}
// WithHash sets the Hash 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 *PullRequestJobOptionsApplyConfiguration) WithHash(value string) *PullRequestJobOptionsApplyConfiguration {
b.Hash = &value
return b
}
// 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 *PullRequestJobOptionsApplyConfiguration) WithURL(value string) *PullRequestJobOptionsApplyConfiguration {
b.URL = &value
return b
}
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// ResourceRefApplyConfiguration represents a declarative configuration of the ResourceRef type for use
// with apply.
type ResourceRefApplyConfiguration struct {
Name *string `json:"name,omitempty"`
Kind *string `json:"kind,omitempty"`
Group *string `json:"group,omitempty"`
}
// ResourceRefApplyConfiguration constructs a declarative configuration of the ResourceRef type for use with
// apply.
func ResourceRef() *ResourceRefApplyConfiguration {
return &ResourceRefApplyConfiguration{}
}
// WithName sets the Name 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 Name field is set to the value of the last call.
func (b *ResourceRefApplyConfiguration) WithName(value string) *ResourceRefApplyConfiguration {
b.Name = &value
return b
}
// WithKind sets the Kind 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 Kind field is set to the value of the last call.
func (b *ResourceRefApplyConfiguration) WithKind(value string) *ResourceRefApplyConfiguration {
b.Kind = &value
return b
}
// WithGroup sets the Group 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 Group field is set to the value of the last call.
func (b *ResourceRefApplyConfiguration) WithGroup(value string) *ResourceRefApplyConfiguration {
b.Group = &value
return b
}
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v0alpha1
// SyncJobOptionsApplyConfiguration represents a declarative configuration of the SyncJobOptions type for use
// with apply.
type SyncJobOptionsApplyConfiguration struct {
Incremental *bool `json:"incremental,omitempty"`
}
// SyncJobOptionsApplyConfiguration constructs a declarative configuration of the SyncJobOptions type for use with
// apply.
func SyncJobOptions() *SyncJobOptionsApplyConfiguration {
return &SyncJobOptionsApplyConfiguration{}
}
// WithIncremental sets the Incremental 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 Incremental field is set to the value of the last call.
func (b *SyncJobOptionsApplyConfiguration) WithIncremental(value bool) *SyncJobOptionsApplyConfiguration {
b.Incremental = &value
return b
}
@@ -20,6 +20,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
// Group=provisioning.grafana.app, Version=v0alpha1
case v0alpha1.SchemeGroupVersion.WithKind("BitbucketRepositoryConfig"):
return &provisioningv0alpha1.BitbucketRepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("DeleteJobOptions"):
return &provisioningv0alpha1.DeleteJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ExportJobOptions"):
return &provisioningv0alpha1.ExportJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("GitHubRepositoryConfig"):
return &provisioningv0alpha1.GitHubRepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("GitLabRepositoryConfig"):
@@ -28,8 +32,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &provisioningv0alpha1.GitRepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("HealthStatus"):
return &provisioningv0alpha1.HealthStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("Job"):
return &provisioningv0alpha1.JobApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("JobResourceSummary"):
return &provisioningv0alpha1.JobResourceSummaryApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("JobSpec"):
return &provisioningv0alpha1.JobSpecApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("JobStatus"):
return &provisioningv0alpha1.JobStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("LocalRepositoryConfig"):
return &provisioningv0alpha1.LocalRepositoryConfigApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("MigrateJobOptions"):
return &provisioningv0alpha1.MigrateJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("MoveJobOptions"):
return &provisioningv0alpha1.MoveJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("PullRequestJobOptions"):
return &provisioningv0alpha1.PullRequestJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("Repository"):
return &provisioningv0alpha1.RepositoryApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("RepositorySpec"):
@@ -38,6 +56,10 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &provisioningv0alpha1.RepositoryStatusApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ResourceCount"):
return &provisioningv0alpha1.ResourceCountApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("ResourceRef"):
return &provisioningv0alpha1.ResourceRefApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncJobOptions"):
return &provisioningv0alpha1.SyncJobOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncOptions"):
return &provisioningv0alpha1.SyncOptionsApplyConfiguration{}
case v0alpha1.SchemeGroupVersion.WithKind("SyncStatus"):
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/generated/applyconfiguration/provisioning/v0alpha1"
typedprovisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/generated/clientset/versioned/typed/provisioning/v0alpha1"
gentype "k8s.io/client-go/gentype"
)
// fakeJobs implements JobInterface
type fakeJobs struct {
*gentype.FakeClientWithListAndApply[*v0alpha1.Job, *v0alpha1.JobList, *provisioningv0alpha1.JobApplyConfiguration]
Fake *FakeProvisioningV0alpha1
}
func newFakeJobs(fake *FakeProvisioningV0alpha1, namespace string) typedprovisioningv0alpha1.JobInterface {
return &fakeJobs{
gentype.NewFakeClientWithListAndApply[*v0alpha1.Job, *v0alpha1.JobList, *provisioningv0alpha1.JobApplyConfiguration](
fake.Fake,
namespace,
v0alpha1.SchemeGroupVersion.WithResource("jobs"),
v0alpha1.SchemeGroupVersion.WithKind("Job"),
func() *v0alpha1.Job { return &v0alpha1.Job{} },
func() *v0alpha1.JobList { return &v0alpha1.JobList{} },
func(dst, src *v0alpha1.JobList) { dst.ListMeta = src.ListMeta },
func(list *v0alpha1.JobList) []*v0alpha1.Job { return gentype.ToPointerSlice(list.Items) },
func(list *v0alpha1.JobList, items []*v0alpha1.Job) { list.Items = gentype.FromPointerSlice(items) },
),
fake,
}
}
@@ -14,6 +14,10 @@ type FakeProvisioningV0alpha1 struct {
*testing.Fake
}
func (c *FakeProvisioningV0alpha1) Jobs(namespace string) v0alpha1.JobInterface {
return newFakeJobs(c, namespace)
}
func (c *FakeProvisioningV0alpha1) Repositories(namespace string) v0alpha1.RepositoryInterface {
return newFakeRepositories(c, namespace)
}
@@ -4,4 +4,6 @@
package v0alpha1
type JobExpansion interface{}
type RepositoryExpansion interface{}
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by client-gen. DO NOT EDIT.
package v0alpha1
import (
context "context"
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
applyconfigurationprovisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/generated/applyconfiguration/provisioning/v0alpha1"
scheme "github.com/grafana/grafana/apps/provisioning/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype"
)
// JobsGetter has a method to return a JobInterface.
// A group's client should implement this interface.
type JobsGetter interface {
Jobs(namespace string) JobInterface
}
// JobInterface has methods to work with Job resources.
type JobInterface interface {
Create(ctx context.Context, job *provisioningv0alpha1.Job, opts v1.CreateOptions) (*provisioningv0alpha1.Job, error)
Update(ctx context.Context, job *provisioningv0alpha1.Job, opts v1.UpdateOptions) (*provisioningv0alpha1.Job, error)
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
UpdateStatus(ctx context.Context, job *provisioningv0alpha1.Job, opts v1.UpdateOptions) (*provisioningv0alpha1.Job, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*provisioningv0alpha1.Job, error)
List(ctx context.Context, opts v1.ListOptions) (*provisioningv0alpha1.JobList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *provisioningv0alpha1.Job, err error)
Apply(ctx context.Context, job *applyconfigurationprovisioningv0alpha1.JobApplyConfiguration, opts v1.ApplyOptions) (result *provisioningv0alpha1.Job, err error)
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
ApplyStatus(ctx context.Context, job *applyconfigurationprovisioningv0alpha1.JobApplyConfiguration, opts v1.ApplyOptions) (result *provisioningv0alpha1.Job, err error)
JobExpansion
}
// jobs implements JobInterface
type jobs struct {
*gentype.ClientWithListAndApply[*provisioningv0alpha1.Job, *provisioningv0alpha1.JobList, *applyconfigurationprovisioningv0alpha1.JobApplyConfiguration]
}
// newJobs returns a Jobs
func newJobs(c *ProvisioningV0alpha1Client, namespace string) *jobs {
return &jobs{
gentype.NewClientWithListAndApply[*provisioningv0alpha1.Job, *provisioningv0alpha1.JobList, *applyconfigurationprovisioningv0alpha1.JobApplyConfiguration](
"jobs",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *provisioningv0alpha1.Job { return &provisioningv0alpha1.Job{} },
func() *provisioningv0alpha1.JobList { return &provisioningv0alpha1.JobList{} },
),
}
}
@@ -14,6 +14,7 @@ import (
type ProvisioningV0alpha1Interface interface {
RESTClient() rest.Interface
JobsGetter
RepositoriesGetter
}
@@ -22,6 +23,10 @@ type ProvisioningV0alpha1Client struct {
restClient rest.Interface
}
func (c *ProvisioningV0alpha1Client) Jobs(namespace string) JobInterface {
return newJobs(c, namespace)
}
func (c *ProvisioningV0alpha1Client) Repositories(namespace string) RepositoryInterface {
return newRepositories(c, namespace)
}
@@ -39,6 +39,8 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=provisioning.grafana.app, Version=v0alpha1
case v0alpha1.SchemeGroupVersion.WithResource("jobs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V0alpha1().Jobs().Informer()}, nil
case v0alpha1.SchemeGroupVersion.WithResource("repositories"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V0alpha1().Repositories().Informer()}, nil
@@ -10,6 +10,8 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// Jobs returns a JobInformer.
Jobs() JobInformer
// Repositories returns a RepositoryInformer.
Repositories() RepositoryInformer
}
@@ -25,6 +27,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// Jobs returns a JobInformer.
func (v *version) Jobs() JobInformer {
return &jobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// Repositories returns a RepositoryInformer.
func (v *version) Repositories() RepositoryInformer {
return &repositoryInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by informer-gen. DO NOT EDIT.
package v0alpha1
import (
context "context"
time "time"
apisprovisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
versioned "github.com/grafana/grafana/apps/provisioning/pkg/generated/clientset/versioned"
internalinterfaces "github.com/grafana/grafana/apps/provisioning/pkg/generated/informers/externalversions/internalinterfaces"
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/generated/listers/provisioning/v0alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// JobInformer provides access to a shared informer and lister for
// Jobs.
type JobInformer interface {
Informer() cache.SharedIndexInformer
Lister() provisioningv0alpha1.JobLister
}
type jobInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewJobInformer constructs a new informer for Job type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredJobInformer constructs a new informer for Job type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ProvisioningV0alpha1().Jobs(namespace).List(context.Background(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ProvisioningV0alpha1().Jobs(namespace).Watch(context.Background(), options)
},
ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ProvisioningV0alpha1().Jobs(namespace).List(ctx, options)
},
WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ProvisioningV0alpha1().Jobs(namespace).Watch(ctx, options)
},
},
&apisprovisioningv0alpha1.Job{},
resyncPeriod,
indexers,
)
}
func (f *jobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *jobInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apisprovisioningv0alpha1.Job{}, f.defaultInformer)
}
func (f *jobInformer) Lister() provisioningv0alpha1.JobLister {
return provisioningv0alpha1.NewJobLister(f.Informer().GetIndexer())
}
@@ -4,6 +4,14 @@
package v0alpha1
// JobListerExpansion allows custom methods to be added to
// JobLister.
type JobListerExpansion interface{}
// JobNamespaceListerExpansion allows custom methods to be added to
// JobNamespaceLister.
type JobNamespaceListerExpansion interface{}
// RepositoryListerExpansion allows custom methods to be added to
// RepositoryLister.
type RepositoryListerExpansion interface{}
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: AGPL-3.0-only
// Code generated by lister-gen. DO NOT EDIT.
package v0alpha1
import (
provisioningv0alpha1 "github.com/grafana/grafana/apps/provisioning/pkg/apis/provisioning/v0alpha1"
labels "k8s.io/apimachinery/pkg/labels"
listers "k8s.io/client-go/listers"
cache "k8s.io/client-go/tools/cache"
)
// JobLister helps list Jobs.
// All objects returned here must be treated as read-only.
type JobLister interface {
// List lists all Jobs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*provisioningv0alpha1.Job, err error)
// Jobs returns an object that can list and get Jobs.
Jobs(namespace string) JobNamespaceLister
JobListerExpansion
}
// jobLister implements the JobLister interface.
type jobLister struct {
listers.ResourceIndexer[*provisioningv0alpha1.Job]
}
// NewJobLister returns a new JobLister.
func NewJobLister(indexer cache.Indexer) JobLister {
return &jobLister{listers.New[*provisioningv0alpha1.Job](indexer, provisioningv0alpha1.Resource("job"))}
}
// Jobs returns an object that can list and get Jobs.
func (s *jobLister) Jobs(namespace string) JobNamespaceLister {
return jobNamespaceLister{listers.NewNamespaced[*provisioningv0alpha1.Job](s.ResourceIndexer, namespace)}
}
// JobNamespaceLister helps list and get Jobs.
// All objects returned here must be treated as read-only.
type JobNamespaceLister interface {
// List lists all Jobs in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*provisioningv0alpha1.Job, err error)
// Get retrieves the Job from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*provisioningv0alpha1.Job, error)
JobNamespaceListerExpansion
}
// jobNamespaceLister implements the JobNamespaceLister
// interface.
type jobNamespaceLister struct {
listers.ResourceIndexer[*provisioningv0alpha1.Job]
}