From d78c9d9a7c3cc4e9f02256529c7cb5d8f74acf86 Mon Sep 17 00:00:00 2001 From: fraliv13 <5892139+fraliv13@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:35:08 +0200 Subject: [PATCH] EntraUser provisioning resource (#91) * EntraUser provisioning resource * Fix user creation bug in pulumi provisioner * Add ObjectMeta to EntraUser in test file --- README.md | 42 ++++ .../provisioning.totalsoft.ro_entrausers.yaml | 191 ++++++++++++++++ .../provisioners/pulumi/entra_user.go | 67 ++++++ .../provisioners/pulumi/entra_user_test.go | 39 ++++ .../provisioners/pulumi/pulumi.go | 12 +- .../provisioning/provisioning_controller.go | 14 ++ .../provisioning/provisioning_types.go | 5 +- pkg/apis/provisioning/v1alpha1/commonTypes.go | 1 + .../provisioning/v1alpha1/entraUserTypes.go | 65 ++++++ pkg/apis/provisioning/v1alpha1/register.go | 2 + .../v1alpha1/zz_generated.deepcopy.go | 100 +++++++++ .../provisioning/v1alpha1/entrauser.go | 210 ++++++++++++++++++ .../v1alpha1/entrauserexportsspec.go | 57 +++++ .../provisioning/v1alpha1/entrauserspec.go | 127 +++++++++++ pkg/generated/applyconfiguration/utils.go | 6 + .../typed/provisioning/v1alpha1/entrauser.go | 208 +++++++++++++++++ .../v1alpha1/fake/fake_entrauser.go | 154 +++++++++++++ .../v1alpha1/fake/fake_provisioning_client.go | 4 + .../v1alpha1/generated_expansion.go | 2 + .../v1alpha1/provisioning_client.go | 5 + .../informers/externalversions/generic.go | 2 + .../provisioning/v1alpha1/entrauser.go | 90 ++++++++ .../provisioning/v1alpha1/interface.go | 7 + .../provisioning/v1alpha1/entrauser.go | 99 +++++++++ .../v1alpha1/expansion_generated.go | 8 + 25 files changed, 1515 insertions(+), 2 deletions(-) create mode 100644 helm/crds/provisioning.totalsoft.ro_entrausers.yaml create mode 100644 internal/controllers/provisioning/provisioners/pulumi/entra_user.go create mode 100644 internal/controllers/provisioning/provisioners/pulumi/entra_user_test.go create mode 100644 pkg/apis/provisioning/v1alpha1/entraUserTypes.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauser.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserexportsspec.go create mode 100644 pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserspec.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/entrauser.go create mode 100644 pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_entrauser.go create mode 100644 pkg/generated/informers/externalversions/provisioning/v1alpha1/entrauser.go create mode 100644 pkg/generated/listers/provisioning/v1alpha1/entrauser.go diff --git a/README.md b/README.md index d0d5512..9628362 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,48 @@ spec: workspaceFriendlyName: Charisma ``` +### EntraUser + +`EntraUser` is a Custom Resource Definition (CRD) that represents a user for Entra Id. + +Definition can be found [here](./helm/crds/provisioning.totalsoft.ro_entrausers.yaml) + +## Spec + +The `EntraUser` spec has the following fields: + +- `userPrincipalName`: The user principal name of the user. This is typically the user's email address or username. +- `displayName`: The display name of the user. +- `initialPassword`: The initial password for the user. If this is not provided, a random password will be generated. +- `domainRef`: The reference to the domain that the user belongs to. +- `platformRef`: The reference to the platform that the user belongs to. + +## Example + +Here's an example of an `EntraUser` resource: + +```yaml +apiVersion: provisioning.totalsoft.ro/v1alpha1 +kind: EntraUser +metadata: + name: example-user + namespace: qa-lsng +spec: + userPrincipalName: "user@tenant1-qa.example.com" + displayName: "Example User" + initialPassword: "password123" + domainRef: "entra-users" + platformRef: "qa" + exports: + - domain: entra-users + initialPassword: + toVault: + keyTemplate: InitialPassword + userPrincipalName: + toVault: + keyTemplate: UserPrincipalName +``` + ## configuration.totalsoft.ro manages external configuration for the services in the platform, read more about from the [Twelve-Factor App ](https://12factor.net/config) methodology. diff --git a/helm/crds/provisioning.totalsoft.ro_entrausers.yaml b/helm/crds/provisioning.totalsoft.ro_entrausers.yaml new file mode 100644 index 0000000..283bd58 --- /dev/null +++ b/helm/crds/provisioning.totalsoft.ro_entrausers.yaml @@ -0,0 +1,191 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: entrausers.provisioning.totalsoft.ro +spec: + group: provisioning.totalsoft.ro + names: + kind: EntraUser + listKind: EntraUserList + plural: entrausers + singular: entrauser + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.displayName + name: Display name + type: string + - jsonPath: .spec.userPrincipalName + name: User principal name + type: string + - jsonPath: .spec.platformRef + name: Platform + type: string + - jsonPath: .spec.domainRef + name: Domain + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + properties: + dependsOn: + description: List of dependencies + items: + properties: + kind: + description: Kind is a string value representing the REST resource + this dependency represents. + type: string + name: + description: ' The name of the dependency.' + type: string + required: + - kind + - name + type: object + type: array + displayName: + description: DisplayName represents the display name of the user, + e.g. "John Doe" + type: string + domainRef: + description: Business Domain that this resource is provision for. + type: string + exports: + description: Export provisioning values spec. + items: + properties: + domain: + description: The domain or bounded-context in which this database + will be used. + type: string + initialPassword: + description: The initial password for the user + properties: + toConfigMap: + properties: + keyTemplate: + type: string + required: + - keyTemplate + type: object + toVault: + properties: + keyTemplate: + type: string + required: + - keyTemplate + type: object + type: object + userPrincipalName: + description: The user principal name + properties: + toConfigMap: + properties: + keyTemplate: + type: string + required: + - keyTemplate + type: object + toVault: + properties: + keyTemplate: + type: string + required: + - keyTemplate + type: object + type: object + required: + - domain + type: object + type: array + initialPassword: + description: InitialPassword represents the initial password for the + user + type: string + platformRef: + description: Target platform (custom resource name). + type: string + target: + default: + category: Tenant + description: The provisioning target. + properties: + category: + default: Tenant + description: 'Provisioning target type. Possible values: Tenant, + Platform' + enum: + - Tenant + - Platform + type: string + filter: + description: |- + Filter targets (applies for category "Tenant"). + If ommited all targets are selected. + properties: + kind: + default: Blacklist + description: 'Includes or excludes the speciffied targets. + Possibile values: Blacklist, Whitelist' + enum: + - Blacklist + - Whitelist + type: string + values: + description: A list of targets to include or exculde + items: + type: string + type: array + required: + - kind + type: object + required: + - category + type: object + tenantOverrides: + additionalProperties: + x-kubernetes-preserve-unknown-fields: true + description: |- + Overrides for tenants. Dictionary with tenant name as key, spec override as value. + The spec override has the same structure as Spec + type: object + userPrincipalName: + description: UserPrincipalName represents the user principal name, + e.g. "jdoe@domain.com" + type: string + required: + - displayName + - domainRef + - platformRef + - target + - userPrincipalName + type: object + required: + - spec + type: object + served: true + storage: true + subresources: {} diff --git a/internal/controllers/provisioning/provisioners/pulumi/entra_user.go b/internal/controllers/provisioning/provisioners/pulumi/entra_user.go new file mode 100644 index 0000000..414fd7d --- /dev/null +++ b/internal/controllers/provisioning/provisioners/pulumi/entra_user.go @@ -0,0 +1,67 @@ +package pulumi + +import ( + "fmt" + + "github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread" + "github.com/pulumi/pulumi-random/sdk/v4/go/random" + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "totalsoft.ro/platform-controllers/internal/controllers/provisioning" + provisioningv1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" +) + +func deployEntraUser(target provisioning.ProvisioningTarget, + entraUser *provisioningv1.EntraUser, + dependencies []pulumi.Resource, + ctx *pulumi.Context) (*azuread.User, error) { + + valueExporter := handleValueExport(target) + gvk := provisioningv1.SchemeGroupVersion.WithKind("AzureDatabase") + + initialPassword := pulumi.String(entraUser.Spec.InitialPassword).ToStringOutput() + if entraUser.Spec.InitialPassword == "" { + randomPassword, err := random.NewRandomPassword(ctx, fmt.Sprintf("%s-initial-password", entraUser.Spec.UserPrincipalName), &random.RandomPasswordArgs{ + Length: pulumi.Int(10), + Upper: pulumi.Bool(true), + MinUpper: pulumi.Int(1), + Lower: pulumi.Bool(true), + MinLower: pulumi.Int(1), + Numeric: pulumi.Bool(true), + MinNumeric: pulumi.Int(1), + Special: pulumi.Bool(true), + MinSpecial: pulumi.Int(1), + }) + + if err != nil { + return nil, err + } + + initialPassword = randomPassword.Result + } + + user, err := azuread.NewUser(ctx, entraUser.Name, &azuread.UserArgs{ + UserPrincipalName: pulumi.String(entraUser.Spec.UserPrincipalName), + DisplayName: pulumi.String(entraUser.Spec.DisplayName), + Password: initialPassword, + }) + if err != nil { + return nil, err + } + + for _, exp := range entraUser.Spec.Exports { + domain := exp.Domain + if domain == "" { + domain = entraUser.Spec.DomainRef + } + + err = valueExporter(newExportContext(ctx, domain, entraUser.Name, entraUser.ObjectMeta, gvk), + map[string]exportTemplateWithValue{ + "initialPassword": {exp.InitialPassword, initialPassword}, + "userPrincipalName": {exp.UserPrincipalName, pulumi.String(entraUser.Spec.UserPrincipalName)}, + }) + if err != nil { + return nil, err + } + } + return user, nil +} diff --git a/internal/controllers/provisioning/provisioners/pulumi/entra_user_test.go b/internal/controllers/provisioning/provisioners/pulumi/entra_user_test.go new file mode 100644 index 0000000..dfe177d --- /dev/null +++ b/internal/controllers/provisioning/provisioners/pulumi/entra_user_test.go @@ -0,0 +1,39 @@ +package pulumi + +import ( + "testing" + + "github.com/pulumi/pulumi/sdk/v3/go/pulumi" + "github.com/stretchr/testify/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + provisioningv1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" +) + +func TestDeployEntraUser(t *testing.T) { + t.Run("maximal entra user spec", func(t *testing.T) { + platform := "dev" + tenant := newTenant("tenant1", platform) + entraUser := &provisioningv1.EntraUser{ + ObjectMeta: metav1.ObjectMeta{ + Name: "my-entra-user", + }, + Spec: provisioningv1.EntraUserSpec{ + UserPrincipalName: "user@example.com", + DisplayName: "Example User", + InitialPassword: "password123", + ProvisioningMeta: provisioningv1.ProvisioningMeta{ + DomainRef: "example-domain", + }, + }, + } + + err := pulumi.RunErr(func(ctx *pulumi.Context) error { + user, err := deployEntraUser(tenant, entraUser, []pulumi.Resource{}, ctx) + assert.NoError(t, err) + assert.NotNil(t, user) + return nil + + }, pulumi.WithMocks("project", "stack", mocks(0))) + assert.NoError(t, err) + }) +} diff --git a/internal/controllers/provisioning/provisioners/pulumi/pulumi.go b/internal/controllers/provisioning/provisioners/pulumi/pulumi.go index 627abcc..4370e06 100644 --- a/internal/controllers/provisioning/provisioners/pulumi/pulumi.go +++ b/internal/controllers/provisioning/provisioners/pulumi/pulumi.go @@ -40,8 +40,9 @@ func Create(target provisioning.ProvisioningTarget, domain string, infra *provis anyHelmRelease := len(infra.HelmReleases) > 0 anyVirtualMachine := len(infra.AzureVirtualMachines) > 0 anyVirtualDesktop := len(infra.AzureVirtualDesktops) > 0 + anyEntraUser := len(infra.EntraUsers) > 0 - anyResource := anyAzureDb || anyManagedAzureDb || anyHelmRelease || anyVirtualMachine || anyVirtualDesktop + anyResource := anyAzureDb || anyManagedAzureDb || anyHelmRelease || anyVirtualMachine || anyVirtualDesktop || anyEntraUser needsResourceGroup := anyVirtualMachine || anyVirtualDesktop stackName := provisioning.Match(target, @@ -222,6 +223,8 @@ func deployResource(target provisioning.ProvisioningTarget, } switch kind { + case string(provisioningv1.ProvisioningResourceKindEntraUser): + return deployEntraUser(target, res.(*provisioningv1.EntraUser), dependencies, ctx) case string(provisioningv1.ProvisioningResourceKindAzureDatabase): return deployAzureDb(target, res.(*provisioningv1.AzureDatabase), dependencies, ctx) case string(provisioningv1.ProvisioningResourceKindAzureManagedDatabase): @@ -284,6 +287,13 @@ func deployFunc(target provisioning.ProvisioningTarget, domain string, rgName = &resGroupName } + for _, user := range infra.EntraUsers { + _, err := deployResourceWithDeps(target, rgName, user, provisionedRes, infra, ctx) + if err != nil { + return err + } + } + for _, db := range infra.AzureDbs { _, err := deployResourceWithDeps(target, rgName, db, provisionedRes, infra, ctx) if err != nil { diff --git a/internal/controllers/provisioning/provisioning_controller.go b/internal/controllers/provisioning/provisioning_controller.go index e770dac..761e1be 100644 --- a/internal/controllers/provisioning/provisioning_controller.go +++ b/internal/controllers/provisioning/provisioning_controller.go @@ -70,6 +70,7 @@ type ProvisioningController struct { helmReleaseInformer provisioningInformersv1.HelmReleaseInformer azureVirtualMachineInformer provisioningInformersv1.AzureVirtualMachineInformer azureVirtualDesktopInformer provisioningInformersv1.AzureVirtualDesktopInformer + entraUserInformer provisioningInformersv1.EntraUserInformer messagingPublisher messaging.MessagingPublisher } @@ -100,6 +101,7 @@ func NewProvisioningController(clientSet clientset.Interface, helmReleaseInformer: factory.Provisioning().V1alpha1().HelmReleases(), azureVirtualMachineInformer: factory.Provisioning().V1alpha1().AzureVirtualMachines(), azureVirtualDesktopInformer: factory.Provisioning().V1alpha1().AzureVirtualDesktops(), + entraUserInformer: factory.Provisioning().V1alpha1().EntraUsers(), provisioner: tenantProvisioner, clientset: clientSet, @@ -119,6 +121,7 @@ func NewProvisioningController(clientSet clientset.Interface, addResourceHandlers[*provisioningv1.HelmRelease]("Helm release", c.helmReleaseInformer.Informer(), c.enqueueDomain) addResourceHandlers[*provisioningv1.AzureVirtualMachine]("Azure virtual machine", c.azureVirtualMachineInformer.Informer(), c.enqueueDomain) addResourceHandlers[*provisioningv1.AzureVirtualDesktop]("Azure virtual Desktop", c.azureVirtualDesktopInformer.Informer(), c.enqueueDomain) + addResourceHandlers[*provisioningv1.EntraUser]("Entra user", c.entraUserInformer.Informer(), c.enqueueDomain) return c } @@ -325,12 +328,23 @@ func (c *ProvisioningController) syncTarget(target ProvisioningTarget, domain st return err } + entraUsers, err := c.entraUserInformer.Lister().List(labels.Everything()) + if err != nil { + return err + } + entraUsers = selectItemsInTarget(target.GetPlatformName(), domain, entraUsers, target) + entraUsers, err = applyTargetOverrides(entraUsers, target) + if err != nil { + return err + } + result := c.provisioner(target, domain, &InfrastructureManifests{ AzureDbs: azureDbs, AzureManagedDbs: azureManagedDbs, HelmReleases: helmReleases, AzureVirtualMachines: azureVirtualMachines, AzureVirtualDesktops: azureVirtualDesktops, + EntraUsers: entraUsers, }) if result.Error == nil && result.HasChanges { diff --git a/internal/controllers/provisioning/provisioning_types.go b/internal/controllers/provisioning/provisioning_types.go index 2271a23..ce88818 100644 --- a/internal/controllers/provisioning/provisioning_types.go +++ b/internal/controllers/provisioning/provisioning_types.go @@ -20,6 +20,7 @@ type CreateInfrastructureFunc func( infra *InfrastructureManifests) ProvisioningResult type InfrastructureManifests struct { + EntraUsers []*provisioningv1.EntraUser AzureDbs []*provisioningv1.AzureDatabase AzureManagedDbs []*provisioningv1.AzureManagedDatabase HelmReleases []*provisioningv1.HelmRelease @@ -29,6 +30,8 @@ type InfrastructureManifests struct { func (infra *InfrastructureManifests) Get(id provisioningv1.ProvisioningResourceIdendtifier) (BaseProvisioningResource, bool) { switch id.Kind { + case provisioningv1.ProvisioningResourceKindEntraUser: + return FindByName[*provisioningv1.EntraUser](id.Name, infra.EntraUsers) case provisioningv1.ProvisioningResourceKindAzureDatabase: return FindByName[*provisioningv1.AzureDatabase](id.Name, infra.AzureDbs) case provisioningv1.ProvisioningResourceKindAzureManagedDatabase: @@ -59,7 +62,7 @@ type ProvisioningResult struct { } type ProvisioningResource interface { - *provisioningv1.AzureDatabase | *provisioningv1.AzureManagedDatabase | *provisioningv1.HelmRelease | *provisioningv1.AzureVirtualMachine | *provisioningv1.AzureVirtualDesktop + *provisioningv1.EntraUser | *provisioningv1.AzureDatabase | *provisioningv1.AzureManagedDatabase | *provisioningv1.HelmRelease | *provisioningv1.AzureVirtualMachine | *provisioningv1.AzureVirtualDesktop GetProvisioningMeta() *provisioningv1.ProvisioningMeta GetSpec() any diff --git a/pkg/apis/provisioning/v1alpha1/commonTypes.go b/pkg/apis/provisioning/v1alpha1/commonTypes.go index 482899d..ea4b61d 100644 --- a/pkg/apis/provisioning/v1alpha1/commonTypes.go +++ b/pkg/apis/provisioning/v1alpha1/commonTypes.go @@ -84,6 +84,7 @@ type ProvisioningResourceIdendtifier struct { type ProvisioningResourceKind string const ( + ProvisioningResourceKindEntraUser = ProvisioningResourceKind("EntraUser") ProvisioningResourceKindAzureDatabase = ProvisioningResourceKind("AzureDatabase") ProvisioningResourceKindAzureManagedDatabase = ProvisioningResourceKind("AzureManagedDatabase") ProvisioningResourceKindAzureVirtualDesktop = ProvisioningResourceKind("AzureVirtualDesktop") diff --git a/pkg/apis/provisioning/v1alpha1/entraUserTypes.go b/pkg/apis/provisioning/v1alpha1/entraUserTypes.go new file mode 100644 index 0000000..5fc269f --- /dev/null +++ b/pkg/apis/provisioning/v1alpha1/entraUserTypes.go @@ -0,0 +1,65 @@ +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:printcolumn:name="Display name",type=string,JSONPath=`.spec.displayName` +// +kubebuilder:printcolumn:name="User principal name",type=string,JSONPath=`.spec.userPrincipalName` +// +kubebuilder:printcolumn:name="Platform",type=string,JSONPath=`.spec.platformRef` +// +kubebuilder:printcolumn:name="Domain",type=string,JSONPath=`.spec.domainRef` + +type EntraUser struct { + metav1.TypeMeta `json:",inline"` + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec EntraUserSpec `json:"spec"` +} + +type EntraUserSpec struct { + // UserPrincipalName represents the user principal name, e.g. "jdoe@domain.com" + UserPrincipalName string `json:"userPrincipalName"` + + // InitialPassword represents the initial password for the user + // +optional + InitialPassword string `json:"initialPassword,omitempty"` + + // DisplayName represents the display name of the user, e.g. "John Doe" + DisplayName string `json:"displayName"` + + // Export provisioning values spec. + // +optional + Exports []EntraUserExportsSpec `json:"exports,omitempty"` + ProvisioningMeta `json:",inline"` +} + +type EntraUserExportsSpec struct { + + // The domain or bounded-context in which this user will be used. + Domain string `json:"domain"` + + // The initial password for the user + InitialPassword ValueExport `json:"initialPassword,omitempty"` + + // The user principal name + UserPrincipalName ValueExport `json:"userPrincipalName,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type EntraUserList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + + Items []EntraUser `json:"items"` +} + +func (db *EntraUser) GetProvisioningMeta() *ProvisioningMeta { + return &db.Spec.ProvisioningMeta +} + +func (db *EntraUser) GetSpec() any { + return &db.Spec +} diff --git a/pkg/apis/provisioning/v1alpha1/register.go b/pkg/apis/provisioning/v1alpha1/register.go index 9a5b9c4..20da463 100644 --- a/pkg/apis/provisioning/v1alpha1/register.go +++ b/pkg/apis/provisioning/v1alpha1/register.go @@ -37,6 +37,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &AzureVirtualMachineList{}, &AzureVirtualDesktop{}, &AzureVirtualDesktopList{}, + &EntraUser{}, + &EntraUserList{}, &HelmRelease{}, &HelmReleaseList{}, &metav1.Status{}, diff --git a/pkg/apis/provisioning/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/provisioning/v1alpha1/zz_generated.deepcopy.go index 339b5e0..c226372 100644 --- a/pkg/apis/provisioning/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/provisioning/v1alpha1/zz_generated.deepcopy.go @@ -599,6 +599,106 @@ func (in *ConfigMapTemplate) DeepCopy() *ConfigMapTemplate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EntraUser) DeepCopyInto(out *EntraUser) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntraUser. +func (in *EntraUser) DeepCopy() *EntraUser { + if in == nil { + return nil + } + out := new(EntraUser) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EntraUser) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EntraUserExportsSpec) DeepCopyInto(out *EntraUserExportsSpec) { + *out = *in + out.InitialPassword = in.InitialPassword + out.UserPrincipalName = in.UserPrincipalName + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntraUserExportsSpec. +func (in *EntraUserExportsSpec) DeepCopy() *EntraUserExportsSpec { + if in == nil { + return nil + } + out := new(EntraUserExportsSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EntraUserList) DeepCopyInto(out *EntraUserList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]EntraUser, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntraUserList. +func (in *EntraUserList) DeepCopy() *EntraUserList { + if in == nil { + return nil + } + out := new(EntraUserList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *EntraUserList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EntraUserSpec) DeepCopyInto(out *EntraUserSpec) { + *out = *in + if in.Exports != nil { + in, out := &in.Exports, &out.Exports + *out = make([]EntraUserExportsSpec, len(*in)) + copy(*out, *in) + } + in.ProvisioningMeta.DeepCopyInto(&out.ProvisioningMeta) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EntraUserSpec. +func (in *EntraUserSpec) DeepCopy() *EntraUserSpec { + if in == nil { + return nil + } + out := new(EntraUserSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmRelease) DeepCopyInto(out *HelmRelease) { *out = *in diff --git a/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauser.go b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauser.go new file mode 100644 index 0000000..cc71ad5 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauser.go @@ -0,0 +1,210 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// EntraUserApplyConfiguration represents an declarative configuration of the EntraUser type for use +// with apply. +type EntraUserApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *EntraUserSpecApplyConfiguration `json:"spec,omitempty"` +} + +// EntraUser constructs an declarative configuration of the EntraUser type for use with +// apply. +func EntraUser(name, namespace string) *EntraUserApplyConfiguration { + b := &EntraUserApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("EntraUser") + b.WithAPIVersion("provisioning.totalsoft.ro/v1alpha1") + 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 *EntraUserApplyConfiguration) WithKind(value string) *EntraUserApplyConfiguration { + b.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 *EntraUserApplyConfiguration) WithAPIVersion(value string) *EntraUserApplyConfiguration { + b.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 *EntraUserApplyConfiguration) WithName(value string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithGenerateName(value string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithNamespace(value string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithUID(value types.UID) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithResourceVersion(value string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithGeneration(value int64) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithCreationTimestamp(value metav1.Time) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.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 *EntraUserApplyConfiguration) WithLabels(entries map[string]string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.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 *EntraUserApplyConfiguration) WithAnnotations(entries map[string]string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.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 *EntraUserApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.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 *EntraUserApplyConfiguration) WithFinalizers(values ...string) *EntraUserApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *EntraUserApplyConfiguration) 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 *EntraUserApplyConfiguration) WithSpec(value *EntraUserSpecApplyConfiguration) *EntraUserApplyConfiguration { + b.Spec = value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserexportsspec.go b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserexportsspec.go new file mode 100644 index 0000000..5a85936 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserexportsspec.go @@ -0,0 +1,57 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// EntraUserExportsSpecApplyConfiguration represents an declarative configuration of the EntraUserExportsSpec type for use +// with apply. +type EntraUserExportsSpecApplyConfiguration struct { + Domain *string `json:"domain,omitempty"` + InitialPassword *ValueExportApplyConfiguration `json:"initialPassword,omitempty"` + UserPrincipalName *ValueExportApplyConfiguration `json:"userPrincipalName,omitempty"` +} + +// EntraUserExportsSpecApplyConfiguration constructs an declarative configuration of the EntraUserExportsSpec type for use with +// apply. +func EntraUserExportsSpec() *EntraUserExportsSpecApplyConfiguration { + return &EntraUserExportsSpecApplyConfiguration{} +} + +// WithDomain sets the Domain 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 Domain field is set to the value of the last call. +func (b *EntraUserExportsSpecApplyConfiguration) WithDomain(value string) *EntraUserExportsSpecApplyConfiguration { + b.Domain = &value + return b +} + +// WithInitialPassword sets the InitialPassword 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 InitialPassword field is set to the value of the last call. +func (b *EntraUserExportsSpecApplyConfiguration) WithInitialPassword(value *ValueExportApplyConfiguration) *EntraUserExportsSpecApplyConfiguration { + b.InitialPassword = value + return b +} + +// WithUserPrincipalName sets the UserPrincipalName 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 UserPrincipalName field is set to the value of the last call. +func (b *EntraUserExportsSpecApplyConfiguration) WithUserPrincipalName(value *ValueExportApplyConfiguration) *EntraUserExportsSpecApplyConfiguration { + b.UserPrincipalName = value + return b +} diff --git a/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserspec.go b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserspec.go new file mode 100644 index 0000000..cb6b965 --- /dev/null +++ b/pkg/generated/applyconfiguration/provisioning/v1alpha1/entrauserspec.go @@ -0,0 +1,127 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// EntraUserSpecApplyConfiguration represents an declarative configuration of the EntraUserSpec type for use +// with apply. +type EntraUserSpecApplyConfiguration struct { + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + InitialPassword *string `json:"initialPassword,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Exports []EntraUserExportsSpecApplyConfiguration `json:"exports,omitempty"` + ProvisioningMetaApplyConfiguration `json:",inline"` +} + +// EntraUserSpecApplyConfiguration constructs an declarative configuration of the EntraUserSpec type for use with +// apply. +func EntraUserSpec() *EntraUserSpecApplyConfiguration { + return &EntraUserSpecApplyConfiguration{} +} + +// WithUserPrincipalName sets the UserPrincipalName 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 UserPrincipalName field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithUserPrincipalName(value string) *EntraUserSpecApplyConfiguration { + b.UserPrincipalName = &value + return b +} + +// WithInitialPassword sets the InitialPassword 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 InitialPassword field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithInitialPassword(value string) *EntraUserSpecApplyConfiguration { + b.InitialPassword = &value + return b +} + +// WithDisplayName sets the DisplayName 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 DisplayName field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithDisplayName(value string) *EntraUserSpecApplyConfiguration { + b.DisplayName = &value + return b +} + +// WithExports adds the given value to the Exports 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 Exports field. +func (b *EntraUserSpecApplyConfiguration) WithExports(values ...*EntraUserExportsSpecApplyConfiguration) *EntraUserSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithExports") + } + b.Exports = append(b.Exports, *values[i]) + } + return b +} + +// WithPlatformRef sets the PlatformRef 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 PlatformRef field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithPlatformRef(value string) *EntraUserSpecApplyConfiguration { + b.PlatformRef = &value + return b +} + +// WithDomainRef sets the DomainRef 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 DomainRef field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithDomainRef(value string) *EntraUserSpecApplyConfiguration { + b.DomainRef = &value + return b +} + +// WithTenantOverrides puts the entries into the TenantOverrides 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 TenantOverrides field, +// overwriting an existing map entries in TenantOverrides field with the same key. +func (b *EntraUserSpecApplyConfiguration) WithTenantOverrides(entries map[string]*v1.JSON) *EntraUserSpecApplyConfiguration { + if b.TenantOverrides == nil && len(entries) > 0 { + b.TenantOverrides = make(map[string]*v1.JSON, len(entries)) + } + for k, v := range entries { + b.TenantOverrides[k] = v + } + return b +} + +// WithTarget sets the Target 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 Target field is set to the value of the last call. +func (b *EntraUserSpecApplyConfiguration) WithTarget(value *ProvisioningTargetApplyConfiguration) *EntraUserSpecApplyConfiguration { + b.Target = value + return b +} + +// WithDependsOn adds the given value to the DependsOn 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 DependsOn field. +func (b *EntraUserSpecApplyConfiguration) WithDependsOn(values ...*ProvisioningResourceIdendtifierApplyConfiguration) *EntraUserSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDependsOn") + } + b.DependsOn = append(b.DependsOn, *values[i]) + } + return b +} diff --git a/pkg/generated/applyconfiguration/utils.go b/pkg/generated/applyconfiguration/utils.go index 7f04f94..9e5e61c 100644 --- a/pkg/generated/applyconfiguration/utils.go +++ b/pkg/generated/applyconfiguration/utils.go @@ -103,6 +103,12 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationprovisioningv1alpha1.AzureVirtualMachineSpecApplyConfiguration{} case provisioningv1alpha1.SchemeGroupVersion.WithKind("ConfigMapTemplate"): return &applyconfigurationprovisioningv1alpha1.ConfigMapTemplateApplyConfiguration{} + case provisioningv1alpha1.SchemeGroupVersion.WithKind("EntraUser"): + return &applyconfigurationprovisioningv1alpha1.EntraUserApplyConfiguration{} + case provisioningv1alpha1.SchemeGroupVersion.WithKind("EntraUserExportsSpec"): + return &applyconfigurationprovisioningv1alpha1.EntraUserExportsSpecApplyConfiguration{} + case provisioningv1alpha1.SchemeGroupVersion.WithKind("EntraUserSpec"): + return &applyconfigurationprovisioningv1alpha1.EntraUserSpecApplyConfiguration{} case provisioningv1alpha1.SchemeGroupVersion.WithKind("HelmRelease"): return &applyconfigurationprovisioningv1alpha1.HelmReleaseApplyConfiguration{} case provisioningv1alpha1.SchemeGroupVersion.WithKind("HelmReleaseExportsSpec"): diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/entrauser.go b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/entrauser.go new file mode 100644 index 0000000..968d57b --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/entrauser.go @@ -0,0 +1,208 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" + provisioningv1alpha1 "totalsoft.ro/platform-controllers/pkg/generated/applyconfiguration/provisioning/v1alpha1" + scheme "totalsoft.ro/platform-controllers/pkg/generated/clientset/versioned/scheme" +) + +// EntraUsersGetter has a method to return a EntraUserInterface. +// A group's client should implement this interface. +type EntraUsersGetter interface { + EntraUsers(namespace string) EntraUserInterface +} + +// EntraUserInterface has methods to work with EntraUser resources. +type EntraUserInterface interface { + Create(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.CreateOptions) (*v1alpha1.EntraUser, error) + Update(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.UpdateOptions) (*v1alpha1.EntraUser, 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) (*v1alpha1.EntraUser, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.EntraUserList, 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 *v1alpha1.EntraUser, err error) + Apply(ctx context.Context, entraUser *provisioningv1alpha1.EntraUserApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.EntraUser, err error) + EntraUserExpansion +} + +// entraUsers implements EntraUserInterface +type entraUsers struct { + client rest.Interface + ns string +} + +// newEntraUsers returns a EntraUsers +func newEntraUsers(c *ProvisioningV1alpha1Client, namespace string) *entraUsers { + return &entraUsers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the entraUser, and returns the corresponding entraUser object, and an error if there is any. +func (c *entraUsers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EntraUser, err error) { + result = &v1alpha1.EntraUser{} + err = c.client.Get(). + Namespace(c.ns). + Resource("entrausers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of EntraUsers that match those selectors. +func (c *entraUsers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EntraUserList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.EntraUserList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("entrausers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested entraUsers. +func (c *entraUsers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("entrausers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a entraUser and creates it. Returns the server's representation of the entraUser, and an error, if there is any. +func (c *entraUsers) Create(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.CreateOptions) (result *v1alpha1.EntraUser, err error) { + result = &v1alpha1.EntraUser{} + err = c.client.Post(). + Namespace(c.ns). + Resource("entrausers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(entraUser). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a entraUser and updates it. Returns the server's representation of the entraUser, and an error, if there is any. +func (c *entraUsers) Update(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.UpdateOptions) (result *v1alpha1.EntraUser, err error) { + result = &v1alpha1.EntraUser{} + err = c.client.Put(). + Namespace(c.ns). + Resource("entrausers"). + Name(entraUser.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(entraUser). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the entraUser and deletes it. Returns an error if one occurs. +func (c *entraUsers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("entrausers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *entraUsers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("entrausers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched entraUser. +func (c *entraUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EntraUser, err error) { + result = &v1alpha1.EntraUser{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("entrausers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied entraUser. +func (c *entraUsers) Apply(ctx context.Context, entraUser *provisioningv1alpha1.EntraUserApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.EntraUser, err error) { + if entraUser == nil { + return nil, fmt.Errorf("entraUser provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(entraUser) + if err != nil { + return nil, err + } + name := entraUser.Name + if name == nil { + return nil, fmt.Errorf("entraUser.Name must be provided to Apply") + } + result = &v1alpha1.EntraUser{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("entrausers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_entrauser.go b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_entrauser.go new file mode 100644 index 0000000..1c19d59 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_entrauser.go @@ -0,0 +1,154 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" + provisioningv1alpha1 "totalsoft.ro/platform-controllers/pkg/generated/applyconfiguration/provisioning/v1alpha1" +) + +// FakeEntraUsers implements EntraUserInterface +type FakeEntraUsers struct { + Fake *FakeProvisioningV1alpha1 + ns string +} + +var entrausersResource = v1alpha1.SchemeGroupVersion.WithResource("entrausers") + +var entrausersKind = v1alpha1.SchemeGroupVersion.WithKind("EntraUser") + +// Get takes name of the entraUser, and returns the corresponding entraUser object, and an error if there is any. +func (c *FakeEntraUsers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.EntraUser, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(entrausersResource, c.ns, name), &v1alpha1.EntraUser{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.EntraUser), err +} + +// List takes label and field selectors, and returns the list of EntraUsers that match those selectors. +func (c *FakeEntraUsers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.EntraUserList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(entrausersResource, entrausersKind, c.ns, opts), &v1alpha1.EntraUserList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.EntraUserList{ListMeta: obj.(*v1alpha1.EntraUserList).ListMeta} + for _, item := range obj.(*v1alpha1.EntraUserList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested entraUsers. +func (c *FakeEntraUsers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(entrausersResource, c.ns, opts)) + +} + +// Create takes the representation of a entraUser and creates it. Returns the server's representation of the entraUser, and an error, if there is any. +func (c *FakeEntraUsers) Create(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.CreateOptions) (result *v1alpha1.EntraUser, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(entrausersResource, c.ns, entraUser), &v1alpha1.EntraUser{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.EntraUser), err +} + +// Update takes the representation of a entraUser and updates it. Returns the server's representation of the entraUser, and an error, if there is any. +func (c *FakeEntraUsers) Update(ctx context.Context, entraUser *v1alpha1.EntraUser, opts v1.UpdateOptions) (result *v1alpha1.EntraUser, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(entrausersResource, c.ns, entraUser), &v1alpha1.EntraUser{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.EntraUser), err +} + +// Delete takes name of the entraUser and deletes it. Returns an error if one occurs. +func (c *FakeEntraUsers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(entrausersResource, c.ns, name, opts), &v1alpha1.EntraUser{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeEntraUsers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(entrausersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.EntraUserList{}) + return err +} + +// Patch applies the patch and returns the patched entraUser. +func (c *FakeEntraUsers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.EntraUser, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(entrausersResource, c.ns, name, pt, data, subresources...), &v1alpha1.EntraUser{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.EntraUser), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied entraUser. +func (c *FakeEntraUsers) Apply(ctx context.Context, entraUser *provisioningv1alpha1.EntraUserApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.EntraUser, err error) { + if entraUser == nil { + return nil, fmt.Errorf("entraUser provided to Apply must not be nil") + } + data, err := json.Marshal(entraUser) + if err != nil { + return nil, err + } + name := entraUser.Name + if name == nil { + return nil, fmt.Errorf("entraUser.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(entrausersResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.EntraUser{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.EntraUser), err +} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_provisioning_client.go b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_provisioning_client.go index c72379c..687584c 100644 --- a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_provisioning_client.go +++ b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/fake/fake_provisioning_client.go @@ -44,6 +44,10 @@ func (c *FakeProvisioningV1alpha1) AzureVirtualMachines(namespace string) v1alph return &FakeAzureVirtualMachines{c, namespace} } +func (c *FakeProvisioningV1alpha1) EntraUsers(namespace string) v1alpha1.EntraUserInterface { + return &FakeEntraUsers{c, namespace} +} + func (c *FakeProvisioningV1alpha1) HelmReleases(namespace string) v1alpha1.HelmReleaseInterface { return &FakeHelmReleases{c, namespace} } diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/generated_expansion.go index eca5afd..4b6180d 100644 --- a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/generated_expansion.go @@ -26,4 +26,6 @@ type AzureVirtualDesktopExpansion interface{} type AzureVirtualMachineExpansion interface{} +type EntraUserExpansion interface{} + type HelmReleaseExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/provisioning_client.go b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/provisioning_client.go index 5c98452..3694e24 100644 --- a/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/provisioning_client.go +++ b/pkg/generated/clientset/versioned/typed/provisioning/v1alpha1/provisioning_client.go @@ -32,6 +32,7 @@ type ProvisioningV1alpha1Interface interface { AzureManagedDatabasesGetter AzureVirtualDesktopsGetter AzureVirtualMachinesGetter + EntraUsersGetter HelmReleasesGetter } @@ -56,6 +57,10 @@ func (c *ProvisioningV1alpha1Client) AzureVirtualMachines(namespace string) Azur return newAzureVirtualMachines(c, namespace) } +func (c *ProvisioningV1alpha1Client) EntraUsers(namespace string) EntraUserInterface { + return newEntraUsers(c, namespace) +} + func (c *ProvisioningV1alpha1Client) HelmReleases(namespace string) HelmReleaseInterface { return newHelmReleases(c, namespace) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 1c037f4..322a753 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -77,6 +77,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V1alpha1().AzureVirtualDesktops().Informer()}, nil case provisioningv1alpha1.SchemeGroupVersion.WithResource("azurevirtualmachines"): return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V1alpha1().AzureVirtualMachines().Informer()}, nil + case provisioningv1alpha1.SchemeGroupVersion.WithResource("entrausers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V1alpha1().EntraUsers().Informer()}, nil case provisioningv1alpha1.SchemeGroupVersion.WithResource("helmreleases"): return &genericInformer{resource: resource.GroupResource(), informer: f.Provisioning().V1alpha1().HelmReleases().Informer()}, nil diff --git a/pkg/generated/informers/externalversions/provisioning/v1alpha1/entrauser.go b/pkg/generated/informers/externalversions/provisioning/v1alpha1/entrauser.go new file mode 100644 index 0000000..e957f9a --- /dev/null +++ b/pkg/generated/informers/externalversions/provisioning/v1alpha1/entrauser.go @@ -0,0 +1,90 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + 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" + provisioningv1alpha1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" + versioned "totalsoft.ro/platform-controllers/pkg/generated/clientset/versioned" + internalinterfaces "totalsoft.ro/platform-controllers/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "totalsoft.ro/platform-controllers/pkg/generated/listers/provisioning/v1alpha1" +) + +// EntraUserInformer provides access to a shared informer and lister for +// EntraUsers. +type EntraUserInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.EntraUserLister +} + +type entraUserInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewEntraUserInformer constructs a new informer for EntraUser 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 NewEntraUserInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredEntraUserInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredEntraUserInformer constructs a new informer for EntraUser 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 NewFilteredEntraUserInformer(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.ProvisioningV1alpha1().EntraUsers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ProvisioningV1alpha1().EntraUsers(namespace).Watch(context.TODO(), options) + }, + }, + &provisioningv1alpha1.EntraUser{}, + resyncPeriod, + indexers, + ) +} + +func (f *entraUserInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredEntraUserInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *entraUserInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&provisioningv1alpha1.EntraUser{}, f.defaultInformer) +} + +func (f *entraUserInformer) Lister() v1alpha1.EntraUserLister { + return v1alpha1.NewEntraUserLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/provisioning/v1alpha1/interface.go b/pkg/generated/informers/externalversions/provisioning/v1alpha1/interface.go index ba70a23..1b038af 100644 --- a/pkg/generated/informers/externalversions/provisioning/v1alpha1/interface.go +++ b/pkg/generated/informers/externalversions/provisioning/v1alpha1/interface.go @@ -32,6 +32,8 @@ type Interface interface { AzureVirtualDesktops() AzureVirtualDesktopInformer // AzureVirtualMachines returns a AzureVirtualMachineInformer. AzureVirtualMachines() AzureVirtualMachineInformer + // EntraUsers returns a EntraUserInformer. + EntraUsers() EntraUserInformer // HelmReleases returns a HelmReleaseInformer. HelmReleases() HelmReleaseInformer } @@ -67,6 +69,11 @@ func (v *version) AzureVirtualMachines() AzureVirtualMachineInformer { return &azureVirtualMachineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// EntraUsers returns a EntraUserInformer. +func (v *version) EntraUsers() EntraUserInformer { + return &entraUserInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // HelmReleases returns a HelmReleaseInformer. func (v *version) HelmReleases() HelmReleaseInformer { return &helmReleaseInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/generated/listers/provisioning/v1alpha1/entrauser.go b/pkg/generated/listers/provisioning/v1alpha1/entrauser.go new file mode 100644 index 0000000..af675b4 --- /dev/null +++ b/pkg/generated/listers/provisioning/v1alpha1/entrauser.go @@ -0,0 +1,99 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "totalsoft.ro/platform-controllers/pkg/apis/provisioning/v1alpha1" +) + +// EntraUserLister helps list EntraUsers. +// All objects returned here must be treated as read-only. +type EntraUserLister interface { + // List lists all EntraUsers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EntraUser, err error) + // EntraUsers returns an object that can list and get EntraUsers. + EntraUsers(namespace string) EntraUserNamespaceLister + EntraUserListerExpansion +} + +// entraUserLister implements the EntraUserLister interface. +type entraUserLister struct { + indexer cache.Indexer +} + +// NewEntraUserLister returns a new EntraUserLister. +func NewEntraUserLister(indexer cache.Indexer) EntraUserLister { + return &entraUserLister{indexer: indexer} +} + +// List lists all EntraUsers in the indexer. +func (s *entraUserLister) List(selector labels.Selector) (ret []*v1alpha1.EntraUser, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.EntraUser)) + }) + return ret, err +} + +// EntraUsers returns an object that can list and get EntraUsers. +func (s *entraUserLister) EntraUsers(namespace string) EntraUserNamespaceLister { + return entraUserNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// EntraUserNamespaceLister helps list and get EntraUsers. +// All objects returned here must be treated as read-only. +type EntraUserNamespaceLister interface { + // List lists all EntraUsers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.EntraUser, err error) + // Get retrieves the EntraUser from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.EntraUser, error) + EntraUserNamespaceListerExpansion +} + +// entraUserNamespaceLister implements the EntraUserNamespaceLister +// interface. +type entraUserNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all EntraUsers in the indexer for a given namespace. +func (s entraUserNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EntraUser, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.EntraUser)) + }) + return ret, err +} + +// Get retrieves the EntraUser from the indexer for a given namespace and name. +func (s entraUserNamespaceLister) Get(name string) (*v1alpha1.EntraUser, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("entrauser"), name) + } + return obj.(*v1alpha1.EntraUser), nil +} diff --git a/pkg/generated/listers/provisioning/v1alpha1/expansion_generated.go b/pkg/generated/listers/provisioning/v1alpha1/expansion_generated.go index 86a093d..ced29de 100644 --- a/pkg/generated/listers/provisioning/v1alpha1/expansion_generated.go +++ b/pkg/generated/listers/provisioning/v1alpha1/expansion_generated.go @@ -50,6 +50,14 @@ type AzureVirtualMachineListerExpansion interface{} // AzureVirtualMachineNamespaceLister. type AzureVirtualMachineNamespaceListerExpansion interface{} +// EntraUserListerExpansion allows custom methods to be added to +// EntraUserLister. +type EntraUserListerExpansion interface{} + +// EntraUserNamespaceListerExpansion allows custom methods to be added to +// EntraUserNamespaceLister. +type EntraUserNamespaceListerExpansion interface{} + // HelmReleaseListerExpansion allows custom methods to be added to // HelmReleaseLister. type HelmReleaseListerExpansion interface{}