github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/fwaas_v2/routerinsertion/requests.go (about) 1 package routerinsertion 2 3 import ( 4 "github.com/huaweicloud/golangsdk/openstack/networking/v2/extensions/fwaas_v2/firewall_groups" 5 ) 6 7 // CreateOptsExt adds a PortIDs option to the base CreateOpts. 8 type CreateOptsExt struct { 9 firewall_groups.CreateOptsBuilder 10 PortIDs []string `json:"ports"` 11 } 12 13 // ToFirewallGroupCreateMap adds ports to the base firewall creation options. 14 func (opts CreateOptsExt) ToFirewallGroupCreateMap() (map[string]interface{}, error) { 15 base, err := opts.CreateOptsBuilder.ToFirewallGroupCreateMap() 16 if err != nil { 17 return nil, err 18 } 19 20 firewallMap := base["firewall_group"].(map[string]interface{}) 21 firewallMap["ports"] = opts.PortIDs 22 23 return base, nil 24 } 25 26 // UpdateOptsExt updates a PortIDs option to the base UpdateOpts. 27 type UpdateOptsExt struct { 28 firewall_groups.UpdateOptsBuilder 29 PortIDs []string `json:"ports"` 30 } 31 32 // ToFirewallGroupUpdateMap adds ports to the base firewall update options. 33 func (opts UpdateOptsExt) ToFirewallGroupUpdateMap() (map[string]interface{}, error) { 34 base, err := opts.UpdateOptsBuilder.ToFirewallGroupUpdateMap() 35 if err != nil { 36 return nil, err 37 } 38 39 firewallMap := base["firewall_group"].(map[string]interface{}) 40 firewallMap["ports"] = opts.PortIDs 41 42 return base, nil 43 }