github.com/IBM-Cloud/bluemix-go@v0.0.0-20240423071914-9e96525baef4/examples/container/V2containers/GetAlbClusterHealthCheckConfigV2/main.go (about) 1 package main 2 3 import ( 4 "flag" 5 "fmt" 6 "log" 7 "os" 8 9 bluemix "github.com/IBM-Cloud/bluemix-go" 10 "github.com/IBM-Cloud/bluemix-go/session" 11 "github.com/IBM-Cloud/bluemix-go/trace" 12 13 v2 "github.com/IBM-Cloud/bluemix-go/api/container/containerv2" 14 ) 15 16 func main() { 17 18 var clusterID string 19 flag.StringVar(&clusterID, "clusterNameOrID", "", "cluster name or ID") 20 flag.Parse() 21 22 trace.Logger = trace.NewLogger("true") 23 24 if clusterID == "" { 25 flag.Usage() 26 os.Exit(1) 27 } 28 29 c := new(bluemix.Config) 30 31 sess, err := session.New(c) 32 if err != nil { 33 log.Fatal(err) 34 } 35 36 if err != nil { 37 log.Fatal(err) 38 } 39 40 target := v2.ClusterTargetHeader{} 41 42 clusterClient, err := v2.New(sess) 43 if err != nil { 44 log.Fatal(err) 45 } 46 47 albAPI := clusterClient.Albs() 48 49 albHCConfig, getErr := albAPI.GetAlbClusterHealthCheckConfig(clusterID, target) 50 fmt.Println("err: ", getErr) 51 fmt.Printf("albHCConfig.Enable: %+v\n", albHCConfig.Enable) 52 }