From 639e30ccbdf2fac905486e42bde5a72af603ebde Mon Sep 17 00:00:00 2001 From: powervs-ibm Date: Tue, 27 Aug 2024 22:05:51 +0000 Subject: [PATCH] Generated Swagger client from service-broker commit 4a6fb79d2076748aedcfcfa65b727fc413e8a7df --- .../models/network_security_group_add_rule.go | 69 ------------------- power/models/network_security_group_rule.go | 17 ----- .../network_security_group_rule_port.go | 45 +++++++++++- 3 files changed, 43 insertions(+), 88 deletions(-) diff --git a/power/models/network_security_group_add_rule.go b/power/models/network_security_group_add_rule.go index 69b9bcd4..2d4037c8 100644 --- a/power/models/network_security_group_add_rule.go +++ b/power/models/network_security_group_add_rule.go @@ -28,15 +28,6 @@ type NetworkSecurityGroupAddRule struct { // destination ports DestinationPorts *NetworkSecurityGroupRulePort `json:"destinationPorts,omitempty"` - // The direction of the network traffic - // Required: true - // Enum: ["inbound","outbound"] - Direction *string `json:"direction"` - - // The unique name of the Network Security Group rule - // Required: true - Name *string `json:"name"` - // protocol // Required: true Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` @@ -61,14 +52,6 @@ func (m *NetworkSecurityGroupAddRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateDirection(formats); err != nil { - res = append(res, err) - } - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - if err := m.validateProtocol(formats); err != nil { res = append(res, err) } @@ -149,58 +132,6 @@ func (m *NetworkSecurityGroupAddRule) validateDestinationPorts(formats strfmt.Re return nil } -var networkSecurityGroupAddRuleTypeDirectionPropEnum []interface{} - -func init() { - var res []string - if err := json.Unmarshal([]byte(`["inbound","outbound"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - networkSecurityGroupAddRuleTypeDirectionPropEnum = append(networkSecurityGroupAddRuleTypeDirectionPropEnum, v) - } -} - -const ( - - // NetworkSecurityGroupAddRuleDirectionInbound captures enum value "inbound" - NetworkSecurityGroupAddRuleDirectionInbound string = "inbound" - - // NetworkSecurityGroupAddRuleDirectionOutbound captures enum value "outbound" - NetworkSecurityGroupAddRuleDirectionOutbound string = "outbound" -) - -// prop value enum -func (m *NetworkSecurityGroupAddRule) validateDirectionEnum(path, location string, value string) error { - if err := validate.EnumCase(path, location, value, networkSecurityGroupAddRuleTypeDirectionPropEnum, true); err != nil { - return err - } - return nil -} - -func (m *NetworkSecurityGroupAddRule) validateDirection(formats strfmt.Registry) error { - - if err := validate.Required("direction", "body", m.Direction); err != nil { - return err - } - - // value enum - if err := m.validateDirectionEnum("direction", "body", *m.Direction); err != nil { - return err - } - - return nil -} - -func (m *NetworkSecurityGroupAddRule) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - func (m *NetworkSecurityGroupAddRule) validateProtocol(formats strfmt.Registry) error { if err := validate.Required("protocol", "body", m.Protocol); err != nil { diff --git a/power/models/network_security_group_rule.go b/power/models/network_security_group_rule.go index 58901232..a1be84f9 100644 --- a/power/models/network_security_group_rule.go +++ b/power/models/network_security_group_rule.go @@ -32,10 +32,6 @@ type NetworkSecurityGroupRule struct { // Required: true ID *string `json:"id"` - // The unique name of the Network Security Group rule - // Required: true - Name *string `json:"name"` - // protocol // Required: true Protocol *NetworkSecurityGroupRuleProtocol `json:"protocol"` @@ -64,10 +60,6 @@ func (m *NetworkSecurityGroupRule) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - if err := m.validateProtocol(formats); err != nil { res = append(res, err) } @@ -157,15 +149,6 @@ func (m *NetworkSecurityGroupRule) validateID(formats strfmt.Registry) error { return nil } -func (m *NetworkSecurityGroupRule) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - func (m *NetworkSecurityGroupRule) validateProtocol(formats strfmt.Registry) error { if err := validate.Required("protocol", "body", m.Protocol); err != nil { diff --git a/power/models/network_security_group_rule_port.go b/power/models/network_security_group_rule_port.go index bb8cc5f5..296b98ab 100644 --- a/power/models/network_security_group_rule_port.go +++ b/power/models/network_security_group_rule_port.go @@ -8,8 +8,10 @@ package models import ( "context" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // NetworkSecurityGroupRulePort network security group rule port @@ -17,15 +19,54 @@ import ( // swagger:model NetworkSecurityGroupRulePort type NetworkSecurityGroupRulePort struct { - // The end of the port range, if applicable, If values are not present then all ports are in the range + // The end of the port range, if applicable. If the value is not present then the default value of 65535 will be the maximum port number. + // Maximum: 65535 Maximum int64 `json:"maximum,omitempty"` - // The start of the port range, if applicable. If values are not present then all ports are in the range + // The start of the port range, if applicable. If the value is not present then the default value of 1 will be the minimum port number. + // Minimum: 1 Minimum int64 `json:"minimum,omitempty"` } // Validate validates this network security group rule port func (m *NetworkSecurityGroupRulePort) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximum(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMinimum(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMaximum(formats strfmt.Registry) error { + if swag.IsZero(m.Maximum) { // not required + return nil + } + + if err := validate.MaximumInt("maximum", "body", m.Maximum, 65535, false); err != nil { + return err + } + + return nil +} + +func (m *NetworkSecurityGroupRulePort) validateMinimum(formats strfmt.Registry) error { + if swag.IsZero(m.Minimum) { // not required + return nil + } + + if err := validate.MinimumInt("minimum", "body", m.Minimum, 1, false); err != nil { + return err + } + return nil }