github.com/IBM-Cloud/bluemix-go@v0.0.0-20240423071914-9e96525baef4/api/container/containerv2/dedicated_host_pool.go (about) 1 package containerv2 2 3 import ( 4 "fmt" 5 6 "github.com/IBM-Cloud/bluemix-go/client" 7 ) 8 9 // CreateDedicatedHostPoolRequest provides dedicated host pool data for create call 10 // swagger:model 11 type CreateDedicatedHostPoolRequest struct { 12 FlavorClass string `json:"flavorClass" description:""` 13 Metro string `json:"metro" description:""` 14 Name string `json:"name" description:""` 15 } 16 17 // CreateDedicatedHostPoolResponse provides dedicated host pool id from create call 18 // swagger:model 19 type CreateDedicatedHostPoolResponse struct { 20 ID string `json:"id"` 21 } 22 23 // GetDedicatedHostPoolResponse provides dedicated host pool data from get call 24 // swagger:model 25 type GetDedicatedHostPoolResponse struct { 26 FlavorClass string `json:"flavorClass"` 27 HostCount int64 `json:"hostCount"` 28 ID string `json:"id"` 29 Metro string `json:"metro"` 30 Name string `json:"name"` 31 State string `json:"state"` 32 WorkerPools []DedicatedHostPoolWorkerPool `json:"workerPools"` 33 Zones []DedicatedHostZoneResources `json:"zones"` 34 } 35 36 // DedicatedHostPoolWorkerPool ... 37 type DedicatedHostPoolWorkerPool struct { 38 ClusterID string `json:"clusterID"` 39 WorkerPoolID string `json:"workerPoolID"` 40 } 41 42 // DedicatedHostZoneResources ... 43 type DedicatedHostZoneResources struct { 44 Capacity DedicatedHostResource `json:"capacity"` 45 HostCount int64 `json:"hostCount"` 46 Zone string `json:"zone"` 47 } 48 49 // RemoveDedicatedHostPoolRequest provides dedicated host pool data for remove call 50 // swagger:model 51 type RemoveDedicatedHostPoolRequest struct { 52 HostPoolID string `json:"hostPool" description:""` 53 } 54 55 //DedicatedHostPool ... 56 type DedicatedHostPool interface { 57 CreateDedicatedHostPool(dedicatedHostPoolReq CreateDedicatedHostPoolRequest, target ClusterTargetHeader) (CreateDedicatedHostPoolResponse, error) 58 GetDedicatedHostPool(dedicatedHostPoolID string, target ClusterTargetHeader) (GetDedicatedHostPoolResponse, error) 59 ListDedicatedHostPools(target ClusterTargetHeader) ([]GetDedicatedHostPoolResponse, error) 60 RemoveDedicatedHostPool(dedicatedHostPoolReq RemoveDedicatedHostPoolRequest, target ClusterTargetHeader) error 61 } 62 63 type dedicatedhostpool struct { 64 client *client.Client 65 } 66 67 func newDedicatedHostPoolAPI(c *client.Client) DedicatedHostPool { 68 return &dedicatedhostpool{ 69 client: c, 70 } 71 } 72 73 // GetDedicatedHostPool calls the API to list dedicated host pools 74 func (w *dedicatedhostpool) ListDedicatedHostPools(target ClusterTargetHeader) ([]GetDedicatedHostPoolResponse, error) { 75 successV := []GetDedicatedHostPoolResponse{} 76 _, err := w.client.Get("/v2/getDedicatedHostPools", &successV, target.ToMap()) 77 return successV, err 78 } 79 80 // GetDedicatedHostPool calls the API to get a dedicated host pool 81 func (w *dedicatedhostpool) GetDedicatedHostPool(dedicatedHostPoolID string, target ClusterTargetHeader) (GetDedicatedHostPoolResponse, error) { 82 var successV GetDedicatedHostPoolResponse 83 _, err := w.client.Get(fmt.Sprintf("/v2/getDedicatedHostPool?dedicatedhostpool=%s", dedicatedHostPoolID), &successV, target.ToMap()) 84 return successV, err 85 } 86 87 // CreateDedicatedHostPool calls the API to create a dedicated host pool 88 func (w *dedicatedhostpool) CreateDedicatedHostPool(createDedicatedHostPoolReq CreateDedicatedHostPoolRequest, target ClusterTargetHeader) (CreateDedicatedHostPoolResponse, error) { 89 var successV CreateDedicatedHostPoolResponse 90 _, err := w.client.Post("/v2/createDedicatedHostPool", createDedicatedHostPoolReq, &successV, target.ToMap()) 91 return successV, err 92 } 93 94 // RemoveDedicatedHostPool calls the API to remove a dedicated host pool 95 func (w *dedicatedhostpool) RemoveDedicatedHostPool(removeDedicatedHostPoolReq RemoveDedicatedHostPoolRequest, target ClusterTargetHeader) error { 96 // Make the request, don't care about return value 97 _, err := w.client.Post("/v2/removeDedicatedHostPool", removeDedicatedHostPoolReq, nil, target.ToMap()) 98 return err 99 }