Rwname firewallrule to firewallpolicy

This commit is contained in:
2025-04-20 21:17:46 +02:00
parent 92ee1eeade
commit 5468aac185
20 changed files with 917 additions and 924 deletions

View File

@@ -3,7 +3,6 @@ package v1beta1
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// FirewallRuleSpec defines the desired state of FirewallRule.
type NamedUnifiResource struct {
Name string `json:"name,omitempty"`
ID string `json:"id,omitempty"`
@@ -22,7 +21,7 @@ type FirewallZoneEntry struct {
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
}
type FirewallRuleEntry struct {
type FirewallPolicyEntry struct {
Namespace string `json:"namespace,omitempty"`
Name string `json:"name,omitempty"`
}

View File

@@ -41,7 +41,7 @@ type FirewallGroupSpec struct {
ManualPorts []string `json:"manualPorts,omitempty"`
ManualServices []ServiceEntry `json:"manual_services,omitempty"`
AutoCreatedFrom FirewallRuleEntry `json:"auto_created_from,omitempty"`
AutoCreatedFrom FirewallPolicyEntry `json:"auto_created_from,omitempty"`
// AutoIncludeSelector defines which services to extract addresses from
// +optional

View File

@@ -23,7 +23,7 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// FirewallRuleSpec defines the desired state of FirewallRule.
// FirewallPolicySpec defines the desired state of FirewallPolicy.
// type ServiceSpec struct {
// Namespace string `json:"namespace,omitempty"`
// Name string `json:"name,omitempty"`
@@ -39,7 +39,7 @@ import (
// Services []ServiceSpec `json:"service,omitempty"`
//}
type FirewallRuleSpec struct {
type FirewallPolicySpec struct {
Name string `json:"name"`
Source FirewallSource `json:"source"`
Destination FirewallDestination `json:"destination"`
@@ -47,17 +47,17 @@ type FirewallRuleSpec struct {
MatchServicesInAllNamespaces bool `json:"match_services_in_all_namespaces,omitempty"`
}
// FirewallRuleStatus defines the observed state of FirewallRule.
type FirewallRuleStatus struct {
ResourcesManaged *FirewallRuleResourcesManaged `json:"resources_managed,omitempty"`
// FirewallPolicyStatus defines the observed state of FirewallPolicy.
type FirewallPolicyStatus struct {
ResourcesManaged *FirewallPolicyResourcesManaged `json:"resources_managed,omitempty"`
}
type FirewallRuleResourcesManaged struct {
UnifiFirewallRules []UnifiFirewallRuleEntry `json:"firewall_rules_managed,omitempty"`
FirewallGroups []FirewallGroupEntry `json:"firewall_groups_managed,omitempty"`
type FirewallPolicyResourcesManaged struct {
UnifiFirewallPolicies []UnifiFirewallPolicyEntry `json:"firewall_policies_managed,omitempty"`
FirewallGroups []FirewallGroupEntry `json:"firewall_groups_managed,omitempty"`
}
type UnifiFirewallRuleEntry struct {
type UnifiFirewallPolicyEntry struct {
From string `json:"from"`
To string `json:"to"`
TcpIpv4ID string `json:"tcpipv4_id"`
@@ -69,24 +69,24 @@ type UnifiFirewallRuleEntry struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// FirewallRule is the Schema for the firewallrules API.
type FirewallRule struct {
// FirewallPolicy is the Schema for the firewallpolicies API.
type FirewallPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec FirewallRuleSpec `json:"spec,omitempty"`
Status FirewallRuleStatus `json:"status,omitempty"`
Spec FirewallPolicySpec `json:"spec,omitempty"`
Status FirewallPolicyStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// FirewallRuleList contains a list of FirewallRule.
type FirewallRuleList struct {
// FirewallPolicyList contains a list of FirewallPolicy.
type FirewallPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []FirewallRule `json:"items"`
Items []FirewallPolicy `json:"items"`
}
func init() {
SchemeBuilder.Register(&FirewallRule{}, &FirewallRuleList{})
SchemeBuilder.Register(&FirewallPolicy{}, &FirewallPolicyList{})
}

View File

@@ -240,7 +240,7 @@ func (in *FirewallGroupStatus) DeepCopy() *FirewallGroupStatus {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRule) DeepCopyInto(out *FirewallRule) {
func (in *FirewallPolicy) DeepCopyInto(out *FirewallPolicy) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
@@ -248,18 +248,18 @@ func (in *FirewallRule) DeepCopyInto(out *FirewallRule) {
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRule.
func (in *FirewallRule) DeepCopy() *FirewallRule {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicy.
func (in *FirewallPolicy) DeepCopy() *FirewallPolicy {
if in == nil {
return nil
}
out := new(FirewallRule)
out := new(FirewallPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FirewallRule) DeepCopyObject() runtime.Object {
func (in *FirewallPolicy) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@@ -267,46 +267,46 @@ func (in *FirewallRule) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRuleEntry) DeepCopyInto(out *FirewallRuleEntry) {
func (in *FirewallPolicyEntry) DeepCopyInto(out *FirewallPolicyEntry) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleEntry.
func (in *FirewallRuleEntry) DeepCopy() *FirewallRuleEntry {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicyEntry.
func (in *FirewallPolicyEntry) DeepCopy() *FirewallPolicyEntry {
if in == nil {
return nil
}
out := new(FirewallRuleEntry)
out := new(FirewallPolicyEntry)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRuleList) DeepCopyInto(out *FirewallRuleList) {
func (in *FirewallPolicyList) DeepCopyInto(out *FirewallPolicyList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]FirewallRule, len(*in))
*out = make([]FirewallPolicy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleList.
func (in *FirewallRuleList) DeepCopy() *FirewallRuleList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicyList.
func (in *FirewallPolicyList) DeepCopy() *FirewallPolicyList {
if in == nil {
return nil
}
out := new(FirewallRuleList)
out := new(FirewallPolicyList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FirewallRuleList) DeepCopyObject() runtime.Object {
func (in *FirewallPolicyList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@@ -314,11 +314,11 @@ func (in *FirewallRuleList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRuleResourcesManaged) DeepCopyInto(out *FirewallRuleResourcesManaged) {
func (in *FirewallPolicyResourcesManaged) DeepCopyInto(out *FirewallPolicyResourcesManaged) {
*out = *in
if in.UnifiFirewallRules != nil {
in, out := &in.UnifiFirewallRules, &out.UnifiFirewallRules
*out = make([]UnifiFirewallRuleEntry, len(*in))
if in.UnifiFirewallPolicies != nil {
in, out := &in.UnifiFirewallPolicies, &out.UnifiFirewallPolicies
*out = make([]UnifiFirewallPolicyEntry, len(*in))
copy(*out, *in)
}
if in.FirewallGroups != nil {
@@ -328,49 +328,49 @@ func (in *FirewallRuleResourcesManaged) DeepCopyInto(out *FirewallRuleResourcesM
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleResourcesManaged.
func (in *FirewallRuleResourcesManaged) DeepCopy() *FirewallRuleResourcesManaged {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicyResourcesManaged.
func (in *FirewallPolicyResourcesManaged) DeepCopy() *FirewallPolicyResourcesManaged {
if in == nil {
return nil
}
out := new(FirewallRuleResourcesManaged)
out := new(FirewallPolicyResourcesManaged)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRuleSpec) DeepCopyInto(out *FirewallRuleSpec) {
func (in *FirewallPolicySpec) DeepCopyInto(out *FirewallPolicySpec) {
*out = *in
in.Source.DeepCopyInto(&out.Source)
in.Destination.DeepCopyInto(&out.Destination)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleSpec.
func (in *FirewallRuleSpec) DeepCopy() *FirewallRuleSpec {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicySpec.
func (in *FirewallPolicySpec) DeepCopy() *FirewallPolicySpec {
if in == nil {
return nil
}
out := new(FirewallRuleSpec)
out := new(FirewallPolicySpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FirewallRuleStatus) DeepCopyInto(out *FirewallRuleStatus) {
func (in *FirewallPolicyStatus) DeepCopyInto(out *FirewallPolicyStatus) {
*out = *in
if in.ResourcesManaged != nil {
in, out := &in.ResourcesManaged, &out.ResourcesManaged
*out = new(FirewallRuleResourcesManaged)
*out = new(FirewallPolicyResourcesManaged)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleStatus.
func (in *FirewallRuleStatus) DeepCopy() *FirewallRuleStatus {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallPolicyStatus.
func (in *FirewallPolicyStatus) DeepCopy() *FirewallPolicyStatus {
if in == nil {
return nil
}
out := new(FirewallRuleStatus)
out := new(FirewallPolicyStatus)
in.DeepCopyInto(out)
return out
}
@@ -698,16 +698,16 @@ func (in *ServiceEntry) DeepCopy() *ServiceEntry {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UnifiFirewallRuleEntry) DeepCopyInto(out *UnifiFirewallRuleEntry) {
func (in *UnifiFirewallPolicyEntry) DeepCopyInto(out *UnifiFirewallPolicyEntry) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnifiFirewallRuleEntry.
func (in *UnifiFirewallRuleEntry) DeepCopy() *UnifiFirewallRuleEntry {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UnifiFirewallPolicyEntry.
func (in *UnifiFirewallPolicyEntry) DeepCopy() *UnifiFirewallPolicyEntry {
if in == nil {
return nil
}
out := new(UnifiFirewallRuleEntry)
out := new(UnifiFirewallPolicyEntry)
in.DeepCopyInto(out)
return out
}