github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/fwaas/firewalls/doc.go (about) 1 /* 2 Package firewalls allows management and retrieval of firewalls from the 3 OpenStack Networking Service. 4 5 Example to List Firewalls 6 7 listOpts := firewalls.ListOpts{ 8 TenantID: "tenant-id", 9 } 10 11 allPages, err := firewalls.List(networkClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allFirewalls, err := firewalls.ExtractFirewalls(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, fw := range allFirewalls { 22 fmt.Printf("%+v\n", fw) 23 } 24 25 Example to Create a Firewall 26 27 createOpts := firewalls.CreateOpts{ 28 Name: "firewall_1", 29 Description: "A firewall", 30 PolicyID: "19ab8c87-4a32-4e6a-a74e-b77fffb89a0c", 31 AdminStateUp: golangsdk.Enabled, 32 } 33 34 firewall, err := firewalls.Create(networkClient, createOpts).Extract() 35 if err != nil { 36 panic(err) 37 } 38 39 Example to Update a Firewall 40 41 firewallID := "a6917946-38ab-4ffd-a55a-26c0980ce5ee" 42 43 updateOpts := firewalls.UpdateOpts{ 44 AdminStateUp: golangsdk.Disabled, 45 } 46 47 firewall, err := firewalls.Update(networkClient, firewallID, updateOpts).Extract() 48 if err != nil { 49 panic(err) 50 } 51 52 Example to Delete a Firewall 53 54 firewallID := "a6917946-38ab-4ffd-a55a-26c0980ce5ee" 55 err := firewalls.Delete(networkClient, firewallID).ExtractErr() 56 if err != nil { 57 panic(err) 58 } 59 */ 60 package firewalls