github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/dns/v2/zones/doc.go (about) 1 /* 2 Package zones provides information and interaction with the zone API 3 resource for the OpenStack DNS service. 4 5 Example to List Zones 6 7 listOpts := zones.ListOpts{ 8 Email: "jdoe@example.com", 9 } 10 11 allPages, err := zones.List(dnsClient, listOpts).AllPages() 12 if err != nil { 13 panic(err) 14 } 15 16 allZones, err := zones.ExtractZones(allPages) 17 if err != nil { 18 panic(err) 19 } 20 21 for _, zone := range allZones { 22 fmt.Printf("%+v\n", zone) 23 } 24 25 Example to Create a Zone 26 27 createOpts := zones.CreateOpts{ 28 Name: "example.com.", 29 Email: "jdoe@example.com", 30 Type: "PRIMARY", 31 TTL: 7200, 32 Description: "This is a zone.", 33 } 34 35 zone, err := zones.Create(dnsClient, createOpts).Extract() 36 if err != nil { 37 panic(err) 38 } 39 40 Example to Delete a Zone 41 42 zoneID := "99d10f68-5623-4491-91a0-6daafa32b60e" 43 err := zones.Delete(dnsClient, zoneID).ExtractErr() 44 if err != nil { 45 panic(err) 46 } 47 */ 48 package zones