doc.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Package domains manages and retrieves Domains in the OpenStack Identity Service.
  3. Example to List Domains
  4. var iTrue bool = true
  5. listOpts := domains.ListOpts{
  6. Enabled: &iTrue,
  7. }
  8. allPages, err := domains.List(identityClient, listOpts).AllPages()
  9. if err != nil {
  10. panic(err)
  11. }
  12. allDomains, err := domains.ExtractDomains(allPages)
  13. if err != nil {
  14. panic(err)
  15. }
  16. for _, domain := range allDomains {
  17. fmt.Printf("%+v\n", domain)
  18. }
  19. Example to Create a Domain
  20. createOpts := domains.CreateOpts{
  21. Name: "domain name",
  22. Description: "Test domain",
  23. }
  24. domain, err := domains.Create(identityClient, createOpts).Extract()
  25. if err != nil {
  26. panic(err)
  27. }
  28. Example to Update a Domain
  29. domainID := "0fe36e73809d46aeae6705c39077b1b3"
  30. var iFalse bool = false
  31. updateOpts := domains.UpdateOpts{
  32. Enabled: &iFalse,
  33. }
  34. domain, err := domains.Update(identityClient, domainID, updateOpts).Extract()
  35. if err != nil {
  36. panic(err)
  37. }
  38. Example to Delete a Domain
  39. domainID := "0fe36e73809d46aeae6705c39077b1b3"
  40. err := domains.Delete(identityClient, domainID).ExtractErr()
  41. if err != nil {
  42. panic(err)
  43. }
  44. */
  45. package domains