diff --git a/cloud/requests.go b/cloud/requests.go index 1698e9a..f0a5ecb 100644 --- a/cloud/requests.go +++ b/cloud/requests.go @@ -435,7 +435,6 @@ type CreateVNCProxyRequest struct { // CreateSecurityGroupRequest is the request body for POST /cloud/security-group. type CreateSecurityGroupRequest struct { Template string `json:"template"` - Name string `json:"name"` } // CloneSecurityGroupRequest is the request body for POST /cloud/security-group/{sg}/clone. diff --git a/cloud/service_sg.go b/cloud/service_sg.go index 25a37f7..dac8853 100644 --- a/cloud/service_sg.go +++ b/cloud/service_sg.go @@ -29,7 +29,7 @@ func (s SecurityGroupService) SecurityGroup(ctx context.Context, id int) (*Secur return &resp, nil } -// SecurityGroups returns information about all images. +// SecurityGroups returns information about all security groups. func (s SecurityGroupService) SecurityGroups(ctx context.Context) (*SecurityGroupsResponse, error) { var resp SecurityGroupsResponse diff --git a/cloud/sg.go b/cloud/sg.go index 2369b44..806a0a6 100644 --- a/cloud/sg.go +++ b/cloud/sg.go @@ -24,8 +24,13 @@ type SecurityGroupTemplate struct { // SecurityGroupRule is the API payload based on the legacy xmlrpc backend. type SecurityGroupRule struct { - Protocol string `json:"protocol" yaml:"protocol"` - RuleType string `json:"rule_type" yaml:"rule_type"` + ICMPType string `json:"icmp_type" yaml:"icmp_type"` + IP string `json:"ip" yaml:"ip"` + NetworkID string `json:"network_id" yaml:"network_id"` + Protocol string `json:"protocol" yaml:"protocol"` + Range string `json:"range" yaml:"range"` + RuleType string `json:"rule_type" yaml:"rule_type"` + Size string `json:"size" yaml:"size"` } // ParseTemplate returns a structured subset of the nested key x value pair map. @@ -64,6 +69,14 @@ func newSecurityGroupRule(m map[string]any) *SecurityGroupRule { r.Protocol = v case "RULE_TYPE": r.RuleType = v + case "IP": + r.IP = v + case "RANGE": + r.Range = v + case "ICMP_TYPE": + r.ICMPType = v + case "NETWORK_ID": + r.NetworkID = v } } }