doc.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. Package clusters provides information and interaction with the clusters through
  3. the OpenStack Clustering service.
  4. Example to Create a cluster
  5. createOpts := clusters.CreateOpts{
  6. Name: "test-cluster",
  7. DesiredCapacity: 1,
  8. ProfileUUID: "b7b870ee-d3c5-4a93-b9d7-846c53b2c2da",
  9. }
  10. cluster, err := clusters.Create(serviceClient, createOpts).Extract()
  11. if err != nil {
  12. panic(err)
  13. }
  14. Example to Get Clusters
  15. clusterName := "cluster123"
  16. cluster, err := clusters.Get(serviceClient, clusterName).Extract()
  17. if err != nil {
  18. panic(err)
  19. }
  20. fmt.Printf("%+v\n", cluster)
  21. Example to List Clusters
  22. listOpts := clusters.ListOpts{
  23. Name: "testcluster",
  24. }
  25. allPages, err := clusters.ListDetail(serviceClient, listOpts).AllPages()
  26. if err != nil {
  27. panic(err)
  28. }
  29. allClusters, err := clusters.ExtractClusters(allPages)
  30. if err != nil {
  31. panic(err)
  32. }
  33. for _, cluster := range allClusters {
  34. fmt.Printf("%+v\n", cluster)
  35. }
  36. Example to Update a cluster
  37. updateOpts := clusters.UpdateOpts{
  38. Name: "testcluster",
  39. ProfileID: "b7b870ee-d3c5-4a93-b9d7-846c53b2c2da",
  40. }
  41. clusterID := "7d85f602-a948-4a30-afd4-e84f47471c15"
  42. cluster, err := clusters.Update(serviceClient, clusterName, clusters.UpdateOpts{Name: newClusterName}).Extract()
  43. if err != nil {
  44. panic(err)
  45. }
  46. fmt.Printf("%+v\n", cluster)
  47. Example to Delete a cluster
  48. clusterID := "dc6d336e3fc4c0a951b5698cd1236ee"
  49. err := clusters.Delete(serviceClient, clusterID).ExtractErr()
  50. if err != nil {
  51. panic(err)
  52. }
  53. */
  54. package clusters