From 668fc56d786ad7fd975683385fe810a06a7131cc Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 14 Feb 2024 13:56:19 +0100 Subject: [PATCH] Simpler naming --- api/models/v1_firewall_egress_rule.go | 8 ++++---- api/models/v1_firewall_ingress_rule.go | 16 ++++++++-------- metal-api.json | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/api/models/v1_firewall_egress_rule.go b/api/models/v1_firewall_egress_rule.go index fb5a0ea..8a3150f 100644 --- a/api/models/v1_firewall_egress_rule.go +++ b/api/models/v1_firewall_egress_rule.go @@ -33,7 +33,7 @@ type V1FirewallEgressRule struct { // the cidrs affected by this rule // Required: true - ToCidrs []string `json:"to_cidrs" yaml:"to_cidrs"` + To []string `json:"to" yaml:"to"` } // Validate validates this v1 firewall egress rule @@ -48,7 +48,7 @@ func (m *V1FirewallEgressRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateToCidrs(formats); err != nil { + if err := m.validateTo(formats); err != nil { res = append(res, err) } @@ -109,9 +109,9 @@ func (m *V1FirewallEgressRule) validateProtocol(formats strfmt.Registry) error { return nil } -func (m *V1FirewallEgressRule) validateToCidrs(formats strfmt.Registry) error { +func (m *V1FirewallEgressRule) validateTo(formats strfmt.Registry) error { - if err := validate.Required("to_cidrs", "body", m.ToCidrs); err != nil { + if err := validate.Required("to", "body", m.To); err != nil { return err } diff --git a/api/models/v1_firewall_ingress_rule.go b/api/models/v1_firewall_ingress_rule.go index 0535959..eb837ed 100644 --- a/api/models/v1_firewall_ingress_rule.go +++ b/api/models/v1_firewall_ingress_rule.go @@ -25,7 +25,7 @@ type V1FirewallIngressRule struct { // the cidrs affected by this rule // Required: true - FromCidrs []string `json:"from_cidrs" yaml:"from_cidrs"` + From []string `json:"from" yaml:"from"` // the ports affected by this rule // Required: true @@ -37,14 +37,14 @@ type V1FirewallIngressRule struct { // the cidrs affected by this rule // Required: true - ToCidrs []string `json:"to_cidrs" yaml:"to_cidrs"` + To []string `json:"to" yaml:"to"` } // Validate validates this v1 firewall ingress rule func (m *V1FirewallIngressRule) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateFromCidrs(formats); err != nil { + if err := m.validateFrom(formats); err != nil { res = append(res, err) } @@ -56,7 +56,7 @@ func (m *V1FirewallIngressRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateToCidrs(formats); err != nil { + if err := m.validateTo(formats); err != nil { res = append(res, err) } @@ -66,9 +66,9 @@ func (m *V1FirewallIngressRule) Validate(formats strfmt.Registry) error { return nil } -func (m *V1FirewallIngressRule) validateFromCidrs(formats strfmt.Registry) error { +func (m *V1FirewallIngressRule) validateFrom(formats strfmt.Registry) error { - if err := validate.Required("from_cidrs", "body", m.FromCidrs); err != nil { + if err := validate.Required("from", "body", m.From); err != nil { return err } @@ -126,9 +126,9 @@ func (m *V1FirewallIngressRule) validateProtocol(formats strfmt.Registry) error return nil } -func (m *V1FirewallIngressRule) validateToCidrs(formats strfmt.Registry) error { +func (m *V1FirewallIngressRule) validateTo(formats strfmt.Registry) error { - if err := validate.Required("to_cidrs", "body", m.ToCidrs); err != nil { + if err := validate.Required("to", "body", m.To); err != nil { return err } diff --git a/metal-api.json b/metal-api.json index 4715303..c8f86ca 100644 --- a/metal-api.json +++ b/metal-api.json @@ -1135,7 +1135,7 @@ ], "type": "string" }, - "to_cidrs": { + "to": { "description": "the cidrs affected by this rule", "items": { "type": "string" @@ -1145,7 +1145,7 @@ }, "required": [ "ports", - "to_cidrs" + "to" ] }, "v1.FirewallFindRequest": { @@ -1336,7 +1336,7 @@ "description": "an optional comment describing what this rule is used for", "type": "string" }, - "from_cidrs": { + "from": { "description": "the cidrs affected by this rule", "items": { "type": "string" @@ -1359,7 +1359,7 @@ ], "type": "string" }, - "to_cidrs": { + "to": { "description": "the cidrs affected by this rule", "items": { "type": "string" @@ -1368,9 +1368,9 @@ } }, "required": [ - "from_cidrs", + "from", "ports", - "to_cidrs" + "to" ] }, "v1.FirewallResponse": {