diff --git a/apis/loadbalancer/v1alpha1/zz_generated.deepcopy.go b/apis/loadbalancer/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000..c84f192 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,815 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "github.com/crossplane/crossplane-runtime/apis/common/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheckConfigurationObservation) DeepCopyInto(out *HealthCheckConfigurationObservation) { + *out = *in + if in.HealthyThreshold != nil { + in, out := &in.HealthyThreshold, &out.HealthyThreshold + *out = new(float64) + **out = **in + } + if in.IntervalSeconds != nil { + in, out := &in.IntervalSeconds, &out.IntervalSeconds + *out = new(float64) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } + if in.TimeoutSeconds != nil { + in, out := &in.TimeoutSeconds, &out.TimeoutSeconds + *out = new(float64) + **out = **in + } + if in.URLPath != nil { + in, out := &in.URLPath, &out.URLPath + *out = new(string) + **out = **in + } + if in.UnhealthyThreshold != nil { + in, out := &in.UnhealthyThreshold, &out.UnhealthyThreshold + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckConfigurationObservation. +func (in *HealthCheckConfigurationObservation) DeepCopy() *HealthCheckConfigurationObservation { + if in == nil { + return nil + } + out := new(HealthCheckConfigurationObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HealthCheckConfigurationParameters) DeepCopyInto(out *HealthCheckConfigurationParameters) { + *out = *in + if in.HealthyThreshold != nil { + in, out := &in.HealthyThreshold, &out.HealthyThreshold + *out = new(float64) + **out = **in + } + if in.IntervalSeconds != nil { + in, out := &in.IntervalSeconds, &out.IntervalSeconds + *out = new(float64) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } + if in.TimeoutSeconds != nil { + in, out := &in.TimeoutSeconds, &out.TimeoutSeconds + *out = new(float64) + **out = **in + } + if in.URLPath != nil { + in, out := &in.URLPath, &out.URLPath + *out = new(string) + **out = **in + } + if in.UnhealthyThreshold != nil { + in, out := &in.UnhealthyThreshold, &out.UnhealthyThreshold + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheckConfigurationParameters. +func (in *HealthCheckConfigurationParameters) DeepCopy() *HealthCheckConfigurationParameters { + if in == nil { + return nil + } + out := new(HealthCheckConfigurationParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinksObservation) DeepCopyInto(out *LinksObservation) { + *out = *in + if in.Href != nil { + in, out := &in.Href, &out.Href + *out = new(string) + **out = **in + } + if in.Hrefs != nil { + in, out := &in.Hrefs, &out.Hrefs + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.Rel != nil { + in, out := &in.Rel, &out.Rel + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinksObservation. +func (in *LinksObservation) DeepCopy() *LinksObservation { + if in == nil { + return nil + } + out := new(LinksObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LinksParameters) DeepCopyInto(out *LinksParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LinksParameters. +func (in *LinksParameters) DeepCopy() *LinksParameters { + if in == nil { + return nil + } + out := new(LinksParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancer) DeepCopyInto(out *LoadBalancer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancer. +func (in *LoadBalancer) DeepCopy() *LoadBalancer { + if in == nil { + return nil + } + out := new(LoadBalancer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LoadBalancer) 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 *LoadBalancerList) DeepCopyInto(out *LoadBalancerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]LoadBalancer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerList. +func (in *LoadBalancerList) DeepCopy() *LoadBalancerList { + if in == nil { + return nil + } + out := new(LoadBalancerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *LoadBalancerList) 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 *LoadBalancerObservation) DeepCopyInto(out *LoadBalancerObservation) { + *out = *in + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.CreatedAt != nil { + in, out := &in.CreatedAt, &out.CreatedAt + *out = new(string) + **out = **in + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.DeploymentID != nil { + in, out := &in.DeploymentID, &out.DeploymentID + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ExternalID != nil { + in, out := &in.ExternalID, &out.ExternalID + *out = new(string) + **out = **in + } + if in.ExternalRegionID != nil { + in, out := &in.ExternalRegionID, &out.ExternalRegionID + *out = new(string) + **out = **in + } + if in.ExternalZoneID != nil { + in, out := &in.ExternalZoneID, &out.ExternalZoneID + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.InternetFacing != nil { + in, out := &in.InternetFacing, &out.InternetFacing + *out = new(bool) + **out = **in + } + if in.Links != nil { + in, out := &in.Links, &out.Links + *out = make([]LinksObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Nics != nil { + in, out := &in.Nics, &out.Nics + *out = make([]NicsObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.OrganizationID != nil { + in, out := &in.OrganizationID, &out.OrganizationID + *out = new(string) + **out = **in + } + if in.Owner != nil { + in, out := &in.Owner, &out.Owner + *out = new(string) + **out = **in + } + if in.ProjectID != nil { + in, out := &in.ProjectID, &out.ProjectID + *out = new(string) + **out = **in + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]RoutesObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]TagsObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetsObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.UpdatedAt != nil { + in, out := &in.UpdatedAt, &out.UpdatedAt + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerObservation. +func (in *LoadBalancerObservation) DeepCopy() *LoadBalancerObservation { + if in == nil { + return nil + } + out := new(LoadBalancerObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancerParameters) DeepCopyInto(out *LoadBalancerParameters) { + *out = *in + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.DeploymentID != nil { + in, out := &in.DeploymentID, &out.DeploymentID + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.InternetFacing != nil { + in, out := &in.InternetFacing, &out.InternetFacing + *out = new(bool) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Nics != nil { + in, out := &in.Nics, &out.Nics + *out = make([]NicsParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ProjectID != nil { + in, out := &in.ProjectID, &out.ProjectID + *out = new(string) + **out = **in + } + if in.ProjectIDRef != nil { + in, out := &in.ProjectIDRef, &out.ProjectIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ProjectIDSelector != nil { + in, out := &in.ProjectIDSelector, &out.ProjectIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.Routes != nil { + in, out := &in.Routes, &out.Routes + *out = make([]RoutesParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]TagsParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Targets != nil { + in, out := &in.Targets, &out.Targets + *out = make([]TargetsParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerParameters. +func (in *LoadBalancerParameters) DeepCopy() *LoadBalancerParameters { + if in == nil { + return nil + } + out := new(LoadBalancerParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSpec. +func (in *LoadBalancerSpec) DeepCopy() *LoadBalancerSpec { + if in == nil { + return nil + } + out := new(LoadBalancerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LoadBalancerStatus) DeepCopyInto(out *LoadBalancerStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerStatus. +func (in *LoadBalancerStatus) DeepCopy() *LoadBalancerStatus { + if in == nil { + return nil + } + out := new(LoadBalancerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NicsObservation) DeepCopyInto(out *NicsObservation) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(float64) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NetworkID != nil { + in, out := &in.NetworkID, &out.NetworkID + *out = new(string) + **out = **in + } + if in.SecurityGroupIds != nil { + in, out := &in.SecurityGroupIds, &out.SecurityGroupIds + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NicsObservation. +func (in *NicsObservation) DeepCopy() *NicsObservation { + if in == nil { + return nil + } + out := new(NicsObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NicsParameters) DeepCopyInto(out *NicsParameters) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.CustomProperties != nil { + in, out := &in.CustomProperties, &out.CustomProperties + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.DeviceIndex != nil { + in, out := &in.DeviceIndex, &out.DeviceIndex + *out = new(float64) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NetworkID != nil { + in, out := &in.NetworkID, &out.NetworkID + *out = new(string) + **out = **in + } + if in.SecurityGroupIds != nil { + in, out := &in.SecurityGroupIds, &out.SecurityGroupIds + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NicsParameters. +func (in *NicsParameters) DeepCopy() *NicsParameters { + if in == nil { + return nil + } + out := new(NicsParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoutesObservation) DeepCopyInto(out *RoutesObservation) { + *out = *in + if in.HealthCheckConfiguration != nil { + in, out := &in.HealthCheckConfiguration, &out.HealthCheckConfiguration + *out = make([]HealthCheckConfigurationObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MemberPort != nil { + in, out := &in.MemberPort, &out.MemberPort + *out = new(string) + **out = **in + } + if in.MemberProtocol != nil { + in, out := &in.MemberProtocol, &out.MemberProtocol + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoutesObservation. +func (in *RoutesObservation) DeepCopy() *RoutesObservation { + if in == nil { + return nil + } + out := new(RoutesObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RoutesParameters) DeepCopyInto(out *RoutesParameters) { + *out = *in + if in.HealthCheckConfiguration != nil { + in, out := &in.HealthCheckConfiguration, &out.HealthCheckConfiguration + *out = make([]HealthCheckConfigurationParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.MemberPort != nil { + in, out := &in.MemberPort, &out.MemberPort + *out = new(string) + **out = **in + } + if in.MemberProtocol != nil { + in, out := &in.MemberProtocol, &out.MemberProtocol + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(string) + **out = **in + } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RoutesParameters. +func (in *RoutesParameters) DeepCopy() *RoutesParameters { + if in == nil { + return nil + } + out := new(RoutesParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagsObservation) DeepCopyInto(out *TagsObservation) { + *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(string) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagsObservation. +func (in *TagsObservation) DeepCopy() *TagsObservation { + if in == nil { + return nil + } + out := new(TagsObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagsParameters) DeepCopyInto(out *TagsParameters) { + *out = *in + if in.Key != nil { + in, out := &in.Key, &out.Key + *out = new(string) + **out = **in + } + if in.Value != nil { + in, out := &in.Value, &out.Value + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagsParameters. +func (in *TagsParameters) DeepCopy() *TagsParameters { + if in == nil { + return nil + } + out := new(TagsParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetsObservation) DeepCopyInto(out *TargetsObservation) { + *out = *in + if in.MachineID != nil { + in, out := &in.MachineID, &out.MachineID + *out = new(string) + **out = **in + } + if in.NetworkInterfaceID != nil { + in, out := &in.NetworkInterfaceID, &out.NetworkInterfaceID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetsObservation. +func (in *TargetsObservation) DeepCopy() *TargetsObservation { + if in == nil { + return nil + } + out := new(TargetsObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TargetsParameters) DeepCopyInto(out *TargetsParameters) { + *out = *in + if in.MachineID != nil { + in, out := &in.MachineID, &out.MachineID + *out = new(string) + **out = **in + } + if in.NetworkInterfaceID != nil { + in, out := &in.NetworkInterfaceID, &out.NetworkInterfaceID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetsParameters. +func (in *TargetsParameters) DeepCopy() *TargetsParameters { + if in == nil { + return nil + } + out := new(TargetsParameters) + in.DeepCopyInto(out) + return out +} diff --git a/apis/loadbalancer/v1alpha1/zz_generated.managed.go b/apis/loadbalancer/v1alpha1/zz_generated.managed.go new file mode 100644 index 0000000..ac4a402 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_generated.managed.go @@ -0,0 +1,84 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + +// GetCondition of this LoadBalancer. +func (mg *LoadBalancer) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this LoadBalancer. +func (mg *LoadBalancer) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicy of this LoadBalancer. +func (mg *LoadBalancer) GetManagementPolicy() xpv1.ManagementPolicy { + return mg.Spec.ManagementPolicy +} + +// GetProviderConfigReference of this LoadBalancer. +func (mg *LoadBalancer) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this LoadBalancer. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *LoadBalancer) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this LoadBalancer. +func (mg *LoadBalancer) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this LoadBalancer. +func (mg *LoadBalancer) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this LoadBalancer. +func (mg *LoadBalancer) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this LoadBalancer. +func (mg *LoadBalancer) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicy of this LoadBalancer. +func (mg *LoadBalancer) SetManagementPolicy(r xpv1.ManagementPolicy) { + mg.Spec.ManagementPolicy = r +} + +// SetProviderConfigReference of this LoadBalancer. +func (mg *LoadBalancer) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this LoadBalancer. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *LoadBalancer) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this LoadBalancer. +func (mg *LoadBalancer) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this LoadBalancer. +func (mg *LoadBalancer) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/loadbalancer/v1alpha1/zz_generated.managedlist.go b/apis/loadbalancer/v1alpha1/zz_generated.managedlist.go new file mode 100644 index 0000000..780d693 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_generated.managedlist.go @@ -0,0 +1,17 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import resource "github.com/crossplane/crossplane-runtime/pkg/resource" + +// GetItems of this LoadBalancerList. +func (l *LoadBalancerList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} diff --git a/apis/loadbalancer/v1alpha1/zz_generated.resolvers.go b/apis/loadbalancer/v1alpha1/zz_generated.resolvers.go new file mode 100644 index 0000000..6c6d141 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_generated.resolvers.go @@ -0,0 +1,40 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + v1alpha1 "github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1" + reference "github.com/crossplane/crossplane-runtime/pkg/reference" + errors "github.com/pkg/errors" + client "sigs.k8s.io/controller-runtime/pkg/client" +) + +// ResolveReferences of this LoadBalancer. +func (mg *LoadBalancer) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ProjectID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.ProjectIDRef, + Selector: mg.Spec.ForProvider.ProjectIDSelector, + To: reference.To{ + List: &v1alpha1.ProjectList{}, + Managed: &v1alpha1.Project{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.ProjectID") + } + mg.Spec.ForProvider.ProjectID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.ProjectIDRef = rsp.ResolvedReference + + return nil +} diff --git a/apis/loadbalancer/v1alpha1/zz_generated_terraformed.go b/apis/loadbalancer/v1alpha1/zz_generated_terraformed.go new file mode 100755 index 0000000..baf478a --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_generated_terraformed.go @@ -0,0 +1,88 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "github.com/pkg/errors" + + "github.com/upbound/upjet/pkg/resource" + "github.com/upbound/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this LoadBalancer +func (mg *LoadBalancer) GetTerraformResourceType() string { + return "vra_load_balancer" +} + +// GetConnectionDetailsMapping for this LoadBalancer +func (tr *LoadBalancer) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this LoadBalancer +func (tr *LoadBalancer) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this LoadBalancer +func (tr *LoadBalancer) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this LoadBalancer +func (tr *LoadBalancer) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this LoadBalancer +func (tr *LoadBalancer) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this LoadBalancer +func (tr *LoadBalancer) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// LateInitialize this LoadBalancer using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *LoadBalancer) LateInitialize(attrs []byte) (bool, error) { + params := &LoadBalancerParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *LoadBalancer) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/loadbalancer/v1alpha1/zz_groupversion_info.go b/apis/loadbalancer/v1alpha1/zz_groupversion_info.go new file mode 100755 index 0000000..a7ea213 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_groupversion_info.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +// +kubebuilder:object:generate=true +// +groupName=loadbalancer.crossplane.io +// +versionName=v1alpha1 +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +// Package type metadata. +const ( + CRDGroup = "loadbalancer.crossplane.io" + CRDVersion = "v1alpha1" +) + +var ( + // CRDGroupVersion is the API Group Version used to register the objects + CRDGroupVersion = schema.GroupVersion{Group: CRDGroup, Version: CRDVersion} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: CRDGroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/apis/loadbalancer/v1alpha1/zz_loadbalancer_types.go b/apis/loadbalancer/v1alpha1/zz_loadbalancer_types.go new file mode 100755 index 0000000..309f8a4 --- /dev/null +++ b/apis/loadbalancer/v1alpha1/zz_loadbalancer_types.go @@ -0,0 +1,301 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type HealthCheckConfigurationObservation struct { + HealthyThreshold *float64 `json:"healthyThreshold,omitempty" tf:"healthy_threshold,omitempty"` + + IntervalSeconds *float64 `json:"intervalSeconds,omitempty" tf:"interval_seconds,omitempty"` + + Port *string `json:"port,omitempty" tf:"port,omitempty"` + + Protocol *string `json:"protocol,omitempty" tf:"protocol,omitempty"` + + TimeoutSeconds *float64 `json:"timeoutSeconds,omitempty" tf:"timeout_seconds,omitempty"` + + URLPath *string `json:"urlPath,omitempty" tf:"url_path,omitempty"` + + UnhealthyThreshold *float64 `json:"unhealthyThreshold,omitempty" tf:"unhealthy_threshold,omitempty"` +} + +type HealthCheckConfigurationParameters struct { + + // +kubebuilder:validation:Optional + HealthyThreshold *float64 `json:"healthyThreshold,omitempty" tf:"healthy_threshold,omitempty"` + + // +kubebuilder:validation:Optional + IntervalSeconds *float64 `json:"intervalSeconds,omitempty" tf:"interval_seconds,omitempty"` + + // +kubebuilder:validation:Required + Port *string `json:"port" tf:"port,omitempty"` + + // +kubebuilder:validation:Required + Protocol *string `json:"protocol" tf:"protocol,omitempty"` + + // +kubebuilder:validation:Optional + TimeoutSeconds *float64 `json:"timeoutSeconds,omitempty" tf:"timeout_seconds,omitempty"` + + // +kubebuilder:validation:Optional + URLPath *string `json:"urlPath,omitempty" tf:"url_path,omitempty"` + + // +kubebuilder:validation:Optional + UnhealthyThreshold *float64 `json:"unhealthyThreshold,omitempty" tf:"unhealthy_threshold,omitempty"` +} + +type LinksObservation struct { + Href *string `json:"href,omitempty" tf:"href,omitempty"` + + Hrefs []*string `json:"hrefs,omitempty" tf:"hrefs,omitempty"` + + Rel *string `json:"rel,omitempty" tf:"rel,omitempty"` +} + +type LinksParameters struct { +} + +type LoadBalancerObservation struct { + Address *string `json:"address,omitempty" tf:"address,omitempty"` + + CreatedAt *string `json:"createdAt,omitempty" tf:"created_at,omitempty"` + + CustomProperties map[string]*string `json:"customProperties,omitempty" tf:"custom_properties,omitempty"` + + DeploymentID *string `json:"deploymentId,omitempty" tf:"deployment_id,omitempty"` + + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + ExternalID *string `json:"externalId,omitempty" tf:"external_id,omitempty"` + + ExternalRegionID *string `json:"externalRegionId,omitempty" tf:"external_region_id,omitempty"` + + ExternalZoneID *string `json:"externalZoneId,omitempty" tf:"external_zone_id,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + InternetFacing *bool `json:"internetFacing,omitempty" tf:"internet_facing,omitempty"` + + Links []LinksObservation `json:"links,omitempty" tf:"links,omitempty"` + + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + Nics []NicsObservation `json:"nics,omitempty" tf:"nics,omitempty"` + + OrganizationID *string `json:"organizationId,omitempty" tf:"organization_id,omitempty"` + + Owner *string `json:"owner,omitempty" tf:"owner,omitempty"` + + ProjectID *string `json:"projectId,omitempty" tf:"project_id,omitempty"` + + Routes []RoutesObservation `json:"routes,omitempty" tf:"routes,omitempty"` + + Tags []TagsObservation `json:"tags,omitempty" tf:"tags,omitempty"` + + Targets []TargetsObservation `json:"targets,omitempty" tf:"targets,omitempty"` + + UpdatedAt *string `json:"updatedAt,omitempty" tf:"updated_at,omitempty"` +} + +type LoadBalancerParameters struct { + + // +kubebuilder:validation:Optional + CustomProperties map[string]*string `json:"customProperties,omitempty" tf:"custom_properties,omitempty"` + + // +kubebuilder:validation:Optional + DeploymentID *string `json:"deploymentId,omitempty" tf:"deployment_id,omitempty"` + + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // +kubebuilder:validation:Optional + InternetFacing *bool `json:"internetFacing,omitempty" tf:"internet_facing,omitempty"` + + // +kubebuilder:validation:Optional + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // +kubebuilder:validation:Optional + Nics []NicsParameters `json:"nics,omitempty" tf:"nics,omitempty"` + + // +crossplane:generate:reference:type=github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1.Project + // +kubebuilder:validation:Optional + ProjectID *string `json:"projectId,omitempty" tf:"project_id,omitempty"` + + // Reference to a Project in project to populate projectId. + // +kubebuilder:validation:Optional + ProjectIDRef *v1.Reference `json:"projectIdRef,omitempty" tf:"-"` + + // Selector for a Project in project to populate projectId. + // +kubebuilder:validation:Optional + ProjectIDSelector *v1.Selector `json:"projectIdSelector,omitempty" tf:"-"` + + // +kubebuilder:validation:Optional + Routes []RoutesParameters `json:"routes,omitempty" tf:"routes,omitempty"` + + // +kubebuilder:validation:Optional + Tags []TagsParameters `json:"tags,omitempty" tf:"tags,omitempty"` + + // +kubebuilder:validation:Optional + Targets []TargetsParameters `json:"targets,omitempty" tf:"targets,omitempty"` +} + +type NicsObservation struct { + Addresses []*string `json:"addresses,omitempty" tf:"addresses,omitempty"` + + CustomProperties map[string]*string `json:"customProperties,omitempty" tf:"custom_properties,omitempty"` + + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + DeviceIndex *float64 `json:"deviceIndex,omitempty" tf:"device_index,omitempty"` + + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + NetworkID *string `json:"networkId,omitempty" tf:"network_id,omitempty"` + + SecurityGroupIds []*string `json:"securityGroupIds,omitempty" tf:"security_group_ids,omitempty"` +} + +type NicsParameters struct { + + // +kubebuilder:validation:Optional + Addresses []*string `json:"addresses,omitempty" tf:"addresses,omitempty"` + + // +kubebuilder:validation:Optional + CustomProperties map[string]*string `json:"customProperties,omitempty" tf:"custom_properties,omitempty"` + + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // +kubebuilder:validation:Optional + DeviceIndex *float64 `json:"deviceIndex,omitempty" tf:"device_index,omitempty"` + + // +kubebuilder:validation:Optional + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // +kubebuilder:validation:Required + NetworkID *string `json:"networkId" tf:"network_id,omitempty"` + + // +kubebuilder:validation:Optional + SecurityGroupIds []*string `json:"securityGroupIds,omitempty" tf:"security_group_ids,omitempty"` +} + +type RoutesObservation struct { + HealthCheckConfiguration []HealthCheckConfigurationObservation `json:"healthCheckConfiguration,omitempty" tf:"health_check_configuration,omitempty"` + + MemberPort *string `json:"memberPort,omitempty" tf:"member_port,omitempty"` + + MemberProtocol *string `json:"memberProtocol,omitempty" tf:"member_protocol,omitempty"` + + Port *string `json:"port,omitempty" tf:"port,omitempty"` + + Protocol *string `json:"protocol,omitempty" tf:"protocol,omitempty"` +} + +type RoutesParameters struct { + + // +kubebuilder:validation:Optional + HealthCheckConfiguration []HealthCheckConfigurationParameters `json:"healthCheckConfiguration,omitempty" tf:"health_check_configuration,omitempty"` + + // +kubebuilder:validation:Required + MemberPort *string `json:"memberPort" tf:"member_port,omitempty"` + + // +kubebuilder:validation:Required + MemberProtocol *string `json:"memberProtocol" tf:"member_protocol,omitempty"` + + // +kubebuilder:validation:Required + Port *string `json:"port" tf:"port,omitempty"` + + // +kubebuilder:validation:Required + Protocol *string `json:"protocol" tf:"protocol,omitempty"` +} + +type TagsObservation struct { + Key *string `json:"key,omitempty" tf:"key,omitempty"` + + Value *string `json:"value,omitempty" tf:"value,omitempty"` +} + +type TagsParameters struct { + + // +kubebuilder:validation:Required + Key *string `json:"key" tf:"key,omitempty"` + + // +kubebuilder:validation:Required + Value *string `json:"value" tf:"value,omitempty"` +} + +type TargetsObservation struct { + MachineID *string `json:"machineId,omitempty" tf:"machine_id,omitempty"` + + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty" tf:"network_interface_id,omitempty"` +} + +type TargetsParameters struct { + + // +kubebuilder:validation:Required + MachineID *string `json:"machineId" tf:"machine_id,omitempty"` + + // +kubebuilder:validation:Optional + NetworkInterfaceID *string `json:"networkInterfaceId,omitempty" tf:"network_interface_id,omitempty"` +} + +// LoadBalancerSpec defines the desired state of LoadBalancer +type LoadBalancerSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider LoadBalancerParameters `json:"forProvider"` +} + +// LoadBalancerStatus defines the observed state of LoadBalancer. +type LoadBalancerStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider LoadBalancerObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// LoadBalancer is the Schema for the LoadBalancers API. +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,vra} +type LoadBalancer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'ObserveOnly' || has(self.forProvider.name)",message="name is a required parameter" + // +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'ObserveOnly' || has(self.forProvider.nics)",message="nics is a required parameter" + // +kubebuilder:validation:XValidation:rule="self.managementPolicy == 'ObserveOnly' || has(self.forProvider.routes)",message="routes is a required parameter" + Spec LoadBalancerSpec `json:"spec"` + Status LoadBalancerStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// LoadBalancerList contains a list of LoadBalancers +type LoadBalancerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []LoadBalancer `json:"items"` +} + +// Repository type metadata. +var ( + LoadBalancer_Kind = "LoadBalancer" + LoadBalancer_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: LoadBalancer_Kind}.String() + LoadBalancer_KindAPIVersion = LoadBalancer_Kind + "." + CRDGroupVersion.String() + LoadBalancer_GroupVersionKind = CRDGroupVersion.WithKind(LoadBalancer_Kind) +) + +func init() { + SchemeBuilder.Register(&LoadBalancer{}, &LoadBalancerList{}) +} diff --git a/apis/zz_register.go b/apis/zz_register.go index d905d99..d52897b 100755 --- a/apis/zz_register.go +++ b/apis/zz_register.go @@ -21,6 +21,7 @@ import ( v1alpha1flavorprofile "github.com/ankasoftco/upjet-provider-vra/apis/flavorprofile/v1alpha1" v1alpha1imageprofile "github.com/ankasoftco/upjet-provider-vra/apis/imageprofile/v1alpha1" v1alpha1integration "github.com/ankasoftco/upjet-provider-vra/apis/integration/v1alpha1" + v1alpha1loadbalancer "github.com/ankasoftco/upjet-provider-vra/apis/loadbalancer/v1alpha1" v1alpha1project "github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1" v1alpha1storage "github.com/ankasoftco/upjet-provider-vra/apis/storage/v1alpha1" v1alpha1apis "github.com/ankasoftco/upjet-provider-vra/apis/v1alpha1" @@ -41,6 +42,7 @@ func init() { v1alpha1flavorprofile.SchemeBuilder.AddToScheme, v1alpha1imageprofile.SchemeBuilder.AddToScheme, v1alpha1integration.SchemeBuilder.AddToScheme, + v1alpha1loadbalancer.SchemeBuilder.AddToScheme, v1alpha1project.SchemeBuilder.AddToScheme, v1alpha1storage.SchemeBuilder.AddToScheme, v1alpha1apis.SchemeBuilder.AddToScheme, diff --git a/config/external_name.go b/config/external_name.go index 8544755..6549ec4 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -30,6 +30,7 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "vra_catalog_item_entitlement": config.IdentifierFromProvider, "vra_content_source": config.IdentifierFromProvider, "vra_integration": config.IdentifierFromProvider, + "vra_load_balancer": config.IdentifierFromProvider, } // ExternalNameConfigurations applies all external name configs listed in the diff --git a/config/load_balancer/config.go b/config/load_balancer/config.go new file mode 100644 index 0000000..16e9a32 --- /dev/null +++ b/config/load_balancer/config.go @@ -0,0 +1,15 @@ +package loadBalancer + +import "github.com/upbound/upjet/pkg/config" + +// Configure configures individual resources by adding custom ResourceConfigurators. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("vra_load_balancer", func(r *config.Resource) { + r.ShortGroup = "loadbalancer" + r.Kind = "LoadBalancer" + r.Version = "v1alpha1" + r.References["project_id"] = config.Reference{ + Type: "github.com/ankasoftco/upjet-provider-vra/apis/project/v1alpha1.Project", + } + }) +} diff --git a/config/provider.go b/config/provider.go index d958802..e3c025a 100644 --- a/config/provider.go +++ b/config/provider.go @@ -18,6 +18,7 @@ import ( flavorProfile "github.com/ankasoftco/upjet-provider-vra/config/flavor_profile" imageProfile "github.com/ankasoftco/upjet-provider-vra/config/image_profile" integration "github.com/ankasoftco/upjet-provider-vra/config/integration" + loadBalancer "github.com/ankasoftco/upjet-provider-vra/config/load_balancer" project "github.com/ankasoftco/upjet-provider-vra/config/project" storage "github.com/ankasoftco/upjet-provider-vra/config/storage" ujconfig "github.com/upbound/upjet/pkg/config" @@ -58,6 +59,7 @@ func GetProvider() *ujconfig.Provider { catalogItemEntitlement.Configure, contentSource.Configure, integration.Configure, + loadBalancer.Configure, } { configure(pc) } diff --git a/examples/load_balancer/load_balancer.yaml b/examples/load_balancer/load_balancer.yaml new file mode 100644 index 0000000..6821a39 --- /dev/null +++ b/examples/load_balancer/load_balancer.yaml @@ -0,0 +1,18 @@ +apiVersion: loadbalancer.crossplane.io/v1alpha1 +kind: LoadBalancer +metadata: + name: test-load-balancer-2 +spec: + forProvider: + name: 'test-load-balancer-2' + description: 'test-load-balancer-2' + nics: + - networkId: '' + routes: + - memberPort: '' + memberProtocol: '' + port: '' + protocol: '' + + providerConfigRef: + name: vra-test diff --git a/internal/controller/loadbalancer/loadbalancer/zz_controller.go b/internal/controller/loadbalancer/loadbalancer/zz_controller.go new file mode 100755 index 0000000..80e1cec --- /dev/null +++ b/internal/controller/loadbalancer/loadbalancer/zz_controller.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 Upbound Inc. - ANKASOFT +*/ + +// Code generated by upjet. DO NOT EDIT. + +package loadbalancer + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/ankasoftco/upjet-provider-vra/apis/loadbalancer/v1alpha1" + features "github.com/ankasoftco/upjet-provider-vra/internal/features" +) + +// Setup adds a controller that reconciles LoadBalancer managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.LoadBalancer_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + } + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["vra_load_balancer"], tjcontroller.WithLogger(o.Logger), + tjcontroller.WithCallbackProvider(tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.LoadBalancer_GroupVersionKind))), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.Features.Enabled(features.EnableAlphaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.LoadBalancer_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1alpha1.LoadBalancer{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index fd3196f..44717a9 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -24,6 +24,7 @@ import ( profile "github.com/ankasoftco/upjet-provider-vra/internal/controller/flavorprofile/profile" profileimageprofile "github.com/ankasoftco/upjet-provider-vra/internal/controller/imageprofile/profile" integration "github.com/ankasoftco/upjet-provider-vra/internal/controller/integration/integration" + loadbalancer "github.com/ankasoftco/upjet-provider-vra/internal/controller/loadbalancer/loadbalancer" project "github.com/ankasoftco/upjet-provider-vra/internal/controller/project/project" providerconfig "github.com/ankasoftco/upjet-provider-vra/internal/controller/providerconfig" profilestorage "github.com/ankasoftco/upjet-provider-vra/internal/controller/storage/profile" @@ -51,6 +52,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { profile.Setup, profileimageprofile.Setup, integration.Setup, + loadbalancer.Setup, project.Setup, providerconfig.Setup, profilestorage.Setup, diff --git a/package/crds/loadbalancer.crossplane.io_loadbalancers.yaml b/package/crds/loadbalancer.crossplane.io_loadbalancers.yaml new file mode 100644 index 0000000..388be9e --- /dev/null +++ b/package/crds/loadbalancer.crossplane.io_loadbalancers.yaml @@ -0,0 +1,607 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.11.3 + creationTimestamp: null + name: loadbalancers.loadbalancer.crossplane.io +spec: + group: loadbalancer.crossplane.io + names: + categories: + - crossplane + - managed + - vra + kind: LoadBalancer + listKind: LoadBalancerList + plural: loadbalancers + singular: loadbalancer + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: LoadBalancer is the Schema for the LoadBalancers API. + 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: + description: LoadBalancerSpec defines the desired state of LoadBalancer + properties: + deletionPolicy: + default: Delete + description: 'DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. This field is planned to be deprecated + in favor of the ManagementPolicy field in a future release. Currently, + both could be set independently and non-default values would be + honored if the feature flag is enabled. See the design doc for more + information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223' + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + customProperties: + additionalProperties: + type: string + type: object + deploymentId: + type: string + description: + type: string + internetFacing: + type: boolean + name: + type: string + nics: + items: + properties: + addresses: + items: + type: string + type: array + customProperties: + additionalProperties: + type: string + type: object + description: + type: string + deviceIndex: + type: number + name: + type: string + networkId: + type: string + securityGroupIds: + items: + type: string + type: array + required: + - networkId + type: object + type: array + projectId: + type: string + projectIdRef: + description: Reference to a Project in project to populate projectId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + projectIdSelector: + description: Selector for a Project in project to populate projectId. + properties: + matchControllerRef: + description: MatchControllerRef ensures an object with the + same controller reference as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + routes: + items: + properties: + healthCheckConfiguration: + items: + properties: + healthyThreshold: + type: number + intervalSeconds: + type: number + port: + type: string + protocol: + type: string + timeoutSeconds: + type: number + unhealthyThreshold: + type: number + urlPath: + type: string + required: + - port + - protocol + type: object + type: array + memberPort: + type: string + memberProtocol: + type: string + port: + type: string + protocol: + type: string + required: + - memberPort + - memberProtocol + - port + - protocol + type: object + type: array + tags: + items: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: array + targets: + items: + properties: + machineId: + type: string + networkInterfaceId: + type: string + required: + - machineId + type: object + type: array + type: object + managementPolicy: + default: FullControl + description: 'THIS IS AN ALPHA FIELD. Do not use it in production. + It is not honored unless the relevant Crossplane feature flag is + enabled, and may be changed or removed without notice. ManagementPolicy + specifies the level of control Crossplane has over the managed external + resource. This field is planned to replace the DeletionPolicy field + in a future release. Currently, both could be set independently + and non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223' + enum: + - FullControl + - ObserveOnly + - OrphanOnDelete + type: string + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of this + reference is required. The default is 'Required', which + means the reconcile will fail if the reference cannot be + resolved. 'Optional' means this reference will be a no-op + if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will attempt + to resolve the reference only when the corresponding field + is not present. Use 'Always' to resolve the reference on + every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of this + reference is required. The default is 'Required', which + means the reconcile will fail if the reference cannot be + resolved. 'Optional' means this reference will be a no-op + if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will attempt + to resolve the reference only when the corresponding field + is not present. Use 'Always' to resolve the reference on + every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: PublishConnectionDetailsTo specifies the connection secret + config which contains a name, metadata and a reference to secret + store config to which any connection details for this managed resource + should be written. Connection details frequently include the endpoint, + username, and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: SecretStoreConfigRef specifies which secret store + config should be used for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: Annotations are the annotations to be added to + connection secret. - For Kubernetes secrets, this will be + used as "metadata.annotations". - It is up to Secret Store + implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: Labels are the labels/tags to be added to connection + secret. - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store + types. + type: object + type: + description: Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. This field is planned to be replaced in a future + release in favor of PublishConnectionDetailsTo. Currently, both + could be set independently and connection details would be published + to both without affecting each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: name is a required parameter + rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.name) + - message: nics is a required parameter + rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.nics) + - message: routes is a required parameter + rule: self.managementPolicy == 'ObserveOnly' || has(self.forProvider.routes) + status: + description: LoadBalancerStatus defines the observed state of LoadBalancer. + properties: + atProvider: + properties: + address: + type: string + createdAt: + type: string + customProperties: + additionalProperties: + type: string + type: object + deploymentId: + type: string + description: + type: string + externalId: + type: string + externalRegionId: + type: string + externalZoneId: + type: string + id: + type: string + internetFacing: + type: boolean + links: + items: + properties: + href: + type: string + hrefs: + items: + type: string + type: array + rel: + type: string + type: object + type: array + name: + type: string + nics: + items: + properties: + addresses: + items: + type: string + type: array + customProperties: + additionalProperties: + type: string + type: object + description: + type: string + deviceIndex: + type: number + name: + type: string + networkId: + type: string + securityGroupIds: + items: + type: string + type: array + type: object + type: array + organizationId: + type: string + owner: + type: string + projectId: + type: string + routes: + items: + properties: + healthCheckConfiguration: + items: + properties: + healthyThreshold: + type: number + intervalSeconds: + type: number + port: + type: string + protocol: + type: string + timeoutSeconds: + type: number + unhealthyThreshold: + type: number + urlPath: + type: string + type: object + type: array + memberPort: + type: string + memberProtocol: + type: string + port: + type: string + protocol: + type: string + type: object + type: array + tags: + items: + properties: + key: + type: string + value: + type: string + type: object + type: array + targets: + items: + properties: + machineId: + type: string + networkInterfaceId: + type: string + type: object + type: array + updatedAt: + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}