github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/dns/v2/recordsets/doc.go (about) 1 /* 2 Package recordsets provides information and interaction with the zone API 3 resource for the OpenStack DNS service. 4 5 Example to List RecordSets by Zone 6 7 listOpts := recordsets.ListOpts{ 8 Type: "A", 9 } 10 11 zoneID := "fff121f5-c506-410a-a69e-2d73ef9cbdbd" 12 13 allPages, err := recordsets.ListByZone(dnsClient, zoneID, listOpts).AllPages() 14 if err != nil { 15 panic(err) 16 } 17 18 allRRs, err := recordsets.ExtractRecordSets(allPages) 19 if err != nil { 20 panic(err) 21 } 22 23 for _, rr := range allRRs { 24 fmt.Printf("%+v\n", rr) 25 } 26 27 Example to Create a RecordSet 28 29 createOpts := recordsets.CreateOpts{ 30 Name: "example.com.", 31 Type: "A", 32 TTL: 3600, 33 Description: "This is a recordset.", 34 Records: []string{"10.1.0.2"}, 35 } 36 37 zoneID := "fff121f5-c506-410a-a69e-2d73ef9cbdbd" 38 39 rr, err := recordsets.Create(dnsClient, zoneID, createOpts).Extract() 40 if err != nil { 41 panic(err) 42 } 43 44 Example to Delete a RecordSet 45 46 zoneID := "fff121f5-c506-410a-a69e-2d73ef9cbdbd" 47 recordsetID := "d96ed01a-b439-4eb8-9b90-7a9f71017f7b" 48 49 err := recordsets.Delete(dnsClient, zoneID, recordsetID).ExtractErr() 50 if err != nil { 51 panic(err) 52 } 53 */ 54 package recordsets