(awsClient *awslib.Client, accessConfig *clusterconfig.AccessConfig, stacks clusterstate.ClusterStacks, outputType flags.OutputType, disallowPrompt bool)
| 884 | } |
| 885 | |
| 886 | func cmdInfo(awsClient *awslib.Client, accessConfig *clusterconfig.AccessConfig, stacks clusterstate.ClusterStacks, outputType flags.OutputType, disallowPrompt bool) { |
| 887 | clusterConfig := refreshCachedClusterConfig(awsClient, accessConfig, outputType == flags.PrettyOutputType) |
| 888 | |
| 889 | operatorLoadBalancer, err := getNLBLoadBalancer(accessConfig.ClusterName, OperatorLoadBalancer, awsClient) |
| 890 | if err != nil { |
| 891 | exit.Error(err) |
| 892 | } |
| 893 | operatorEndpoint := s.EnsurePrefix(*operatorLoadBalancer.DNSName, "https://") |
| 894 | |
| 895 | var apiEndpoint string |
| 896 | if clusterConfig.APILoadBalancerType == clusterconfig.NLBLoadBalancerType { |
| 897 | apiLoadBalancer, err := getNLBLoadBalancer(accessConfig.ClusterName, APILoadBalancer, awsClient) |
| 898 | if err != nil { |
| 899 | exit.Error(err) |
| 900 | } |
| 901 | apiEndpoint = *apiLoadBalancer.DNSName |
| 902 | } |
| 903 | if clusterConfig.APILoadBalancerType == clusterconfig.ELBLoadBalancerType { |
| 904 | apiLoadBalancer, err := getELBLoadBalancer(accessConfig.ClusterName, APILoadBalancer, awsClient) |
| 905 | if err != nil { |
| 906 | exit.Error(err) |
| 907 | } |
| 908 | apiEndpoint = *apiLoadBalancer.DNSName |
| 909 | } |
| 910 | |
| 911 | if outputType == flags.JSONOutputType || outputType == flags.YAMLOutputType { |
| 912 | infoResponse, err := getInfoOperatorResponse(operatorEndpoint) |
| 913 | if err != nil { |
| 914 | exit.Error(err) |
| 915 | } |
| 916 | infoResponse.ClusterConfig.Config = clusterConfig |
| 917 | |
| 918 | infoInterface := map[string]interface{}{ |
| 919 | "cluster_config": infoResponse.ClusterConfig.Config, |
| 920 | "cluster_metadata": infoResponse.ClusterConfig.OperatorMetadata, |
| 921 | "worker_node_infos": infoResponse.WorkerNodeInfos, |
| 922 | "operator_node_infos": infoResponse.OperatorNodeInfos, |
| 923 | "endpoint_operator": operatorEndpoint, |
| 924 | "endpoint_api": apiEndpoint, |
| 925 | } |
| 926 | |
| 927 | var outputBytes []byte |
| 928 | if outputType == flags.JSONOutputType { |
| 929 | outputBytes, err = libjson.Marshal(infoInterface) |
| 930 | } else { |
| 931 | outputBytes, err = yaml.Marshal(infoInterface) |
| 932 | } |
| 933 | if err != nil { |
| 934 | exit.Error(err) |
| 935 | } |
| 936 | fmt.Println(string(outputBytes)) |
| 937 | } |
| 938 | if outputType == flags.PrettyOutputType { |
| 939 | fmt.Println(console.Bold("endpoints:")) |
| 940 | fmt.Println("operator: ", operatorEndpoint) |
| 941 | fmt.Println("api load balancer:", apiEndpoint) |
| 942 | fmt.Println() |
| 943 |
no test coverage detected