github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/networking/v2/extensions/external/doc.go (about) 1 /* 2 Package external provides information and interaction with the external 3 extension for the OpenStack Networking service. 4 5 Example to List Networks with External Information 6 7 iTrue := true 8 networkListOpts := networks.ListOpts{} 9 listOpts := external.ListOptsExt{ 10 ListOptsBuilder: networkListOpts, 11 External: &iTrue, 12 } 13 14 type NetworkWithExternalExt struct { 15 networks.Network 16 external.NetworkExternalExt 17 } 18 19 var allNetworks []NetworkWithExternalExt 20 21 allPages, err := networks.List(networkClient, listOpts).AllPages() 22 if err != nil { 23 panic(err) 24 } 25 26 err = networks.ExtractNetworksInto(allPages, &allNetworks) 27 if err != nil { 28 panic(err) 29 } 30 31 for _, network := range allNetworks { 32 fmt.Println("%+v\n", network) 33 } 34 35 Example to Create a Network with External Information 36 37 iTrue := true 38 networkCreateOpts := networks.CreateOpts{ 39 Name: "private", 40 AdminStateUp: &iTrue, 41 } 42 43 createOpts := external.CreateOptsExt{ 44 networkCreateOpts, 45 &iTrue, 46 } 47 48 network, err := networks.Create(networkClient, createOpts).Extract() 49 if err != nil { 50 panic(err) 51 } 52 */ 53 package external