IBM-Cloud / bluemix-go

Go library for accessing the Bluemix API
Apache License 2.0
37 stars 88 forks source link

extend sdk with dedicated host operations #356

Closed z0za closed 2 years ago

z0za commented 2 years ago

example execution logs:

$ CreateDedicatedHostPool % go run main.go -flavorclass bx2d -metro dal -name tf-dhostpool
...
Create dedicated hostpool response: {<dedicated host pool id>} 

$ ibmcloud ks dedicated pool ls
ID                        Name                        Metro   Flavor Class   Hosts   State
...
<dedicated host pool id>   tf-dhostpool                dal     bx2d           0       created

$ CreateDedicatedHost % go run main.go -flavor bx2d.host.152x608 -zone us-south-1 -hostpoolid <dedicated host pool id>
...
Create dedicated host response: {<dedicated host id>}

$ ibmcloud ks dedicated host ls --pool <dedicated host pool id>
ID                    Zone         Flavor              CPU Capacity   CPU Allocation   State            Status                           Placement
<dedicated host id>   us-south-1   bx2d.host.152x608   152            0                create_pending   Registering the dedicated host   yes

$ UpdateDedicatedHostPlacement % go run main.go -hostpoolid <dedicated host pool id> -hostid <dedicated host id>
...
DisableDedicatedHostPlacement was successful

$ ibmcloud ks dedicated host ls --pool <dedicated host pool id>
ID                    Zone         Flavor              CPU Capacity   CPU Allocation   State     Status                                 Placement
<dedicated host id>   us-south-1   bx2d.host.152x608   152            0                created   Disable placement request successful   no

$ UpdateDedicatedHostPlacement % go run main.go -hostpoolid <dedicated host pool id> -hostid <dedicated host id> -enableplacement
...
EnableDedicatedHostPlacement was successful

$ ibmcloud ks dedicated host ls --pool <dedicated host pool id>
ID                    Zone         Flavor              CPU Capacity   CPU Allocation   State     Status                                Placement
<dedicated host id>   us-south-1   bx2d.host.152x608   152            0                created   Enable placement request successful   yes

$ CreateCluster % go run main.go -vpcid <vpc id> -subnetid <subnet id> -name tf-dhosttest -hostpoolid <dedicated host pool id>
...
out= {<cluster id>}

$ ibmcloud ks dedicated host ls --pool <dedicated host pool id>
ID                    Zone         Flavor              CPU Capacity   CPU Allocation   State     Status                                Placement
<dedicated host id>   us-south-1   bx2d.host.152x608   152            16               created   Enable placement request successful   yes

$ DeleteDedicatedHost % go run main.go -hostpoolid <dedicated host pool id> -hostid <dedicated host id>
Remove dedicated host was successful 

$ ibmcloud ks dedicated host ls --pool <dedicated host pool id>
ID                    Zone         Flavor              CPU Capacity   CPU Allocation   State      Status                        Placement
<dedicated host id>   us-south-1   bx2d.host.152x608   152            0                deleting   Deleting the dedicated host   no

$ DeleteDedicatedHostPool % go run main.go -hostpoolid <dedicated host pool id>
...
Remove dedicated hostpool was successful

$ ibmcloud ks dedicated pool ls
ID                        Name                  Metro   Flavor Class   Hosts   State
...
<dedicated host pool id>   tf-dhostpool    dal     bx2d           0       deleting

$ ListDedicatedHostFlavors % go run main.go -zone us-south-1
...
ListDedicatedHostFlavors was successful: [{bx2d.host.152x608 bx2d us-south us-south-1 false 152 0 [{2 3200}]}] 
hkantare commented 2 years ago

Fix the conflcit also