// GetStateSummaryFromCluster will return the current state summary of one of the cluster nodes.
329988
func (c *Client) GetStateSummaryFromCluster() (*State, error) {
	resp, err := c.GetHTTPResponseFromCluster(c.GetURLForStateSummaryFile)
	return c.parseStateResponse(resp, err)
}
527310
func GetCluster(tx ReadTx, id string) *api.Cluster {
	n := tx.get(tableCluster, id)
	if n == nil {
		return nil
	}
	return n.(*api.Cluster)
}
168801
func (c *RESTClientset) GetCluster(name string) (*kops.Cluster, error) {
	namespace := restNamespaceForClusterName(name)
	return c.KopsClient.Clusters(namespace).Get(name, metav1.GetOptions{})
}
597265
func (c *client) ClusterStatus() (*pb.ClusterStatus, error) {
	pbmsg, err := c.SendRPC(hrpc.NewClusterStatus())
	if err != nil {
		return nil, err
	}

	r, ok := pbmsg.(*pb.GetClusterStatusResponse)
	if !ok {
		return nil, fmt.Errorf("sendRPC returned not a ClusterStatusResponse")
	}

	return r.GetClusterStatus(), nil
}
949320
func (s *APIServer) getRemoteCluster(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
	cluster, err := auth.GetRemoteCluster(p.ByName("cluster"))
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return rawMessage(services.MarshalRemoteCluster(cluster, services.WithVersion(version), services.PreserveResourceID()))
}
579114
func (c *MockAWSCloud) FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error) {
	etcdStatus, err := findEtcdStatus(c, cluster)
	if err != nil {
		return nil, err
	}
	return &kops.ClusterStatus{
		EtcdClusters: etcdStatus,
	}, nil
}
501136
func (c *Client) GetRemoteCluster(clusterName string) (services.RemoteCluster, error) {
	if clusterName == "" {
		return nil, trace.BadParameter("missing cluster name")
	}
	out, err := c.Get(c.Endpoint("remoteclusters", clusterName), url.Values{})
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return services.UnmarshalRemoteCluster(out.Bytes(), services.SkipValidation())
}
229148
func calculateCurrentSummary(mctx libkb.MetaContext, team *Team) (summary *boxPublicSummary, err error) {
	defer mctx.TraceTimed(fmt.Sprintf("calculateCurrentSummary(%s)", team.ID), func() error { return err })()

	currentRoot, err := mctx.G().GetMerkleClient().FetchRootFromServer(mctx, 5*time.Minute)
	if err != nil {
		return nil, err
	}
	if currentRoot.Seqno() == nil {
		return nil, fmt.Errorf("got nil current merkle root")
	}
	return calculateSummaryAtMerkleSeqno(mctx, team, *currentRoot.Seqno(), false)
}
1282609
func getCgroupStats(cadvisor cadvisor.Interface, containerName string, updateStats bool) (*cadvisorapiv2.ContainerStats, error) {
	info, err := getCgroupInfo(cadvisor, containerName, updateStats)
	if err != nil {
		return nil, err
	}
	stats, found := latestContainerStats(info)
	if !found {
		return nil, fmt.Errorf("failed to get latest stats from container info for %q", containerName)
	}
	return stats, nil
}
238743
func (c *cluster) determineClusterState() (clusterState string) {
	if c.state == ClusterStateResizing {
		return ClusterStateResizing
	}
	if c.haveTopologyAgreement() && c.allNodesReady() {
		return ClusterStateNormal
	}
	if len(c.Topology.nodeIDs)-len(c.nodeIDs()) < c.ReplicaN && c.allNodesReady() {
		return ClusterStateDegraded
	}
	return ClusterStateStarting
}
730449
func (q *lockBasedQueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, error) {
	return q.helper.getStateMetadata(namespace, key)
}
1099918
func getEndpointsFromState(state zkservice.State, reportImports, reportExports bool) []applicationendpoint.ApplicationEndpoint {
	var endpoints []applicationendpoint.ApplicationEndpoint
	if reportImports {
		for _, ep := range state.Imports {
			endpoint := applicationendpoint.ApplicationEndpoint{
				ServiceID:      state.ServiceID,
				Application:    ep.Application,
				Purpose:        ep.Purpose,
				ContainerID:    state.ContainerID,
				ContainerIP:    state.PrivateIP,
				ContainerPort:  ep.PortNumber,
				HostID:         state.HostID,
				VirtualAddress: ep.VirtualAddress,
				InstanceID:     state.InstanceID,
			}
			endpoints = append(endpoints, endpoint)
		}
	}

	if reportExports {
		for _, ep := range state.Exports {
			endpoint := applicationendpoint.ApplicationEndpoint{
				ServiceID:     state.ServiceID,
				Application:   ep.Application,
				Protocol:      ep.Protocol,
				Purpose:       "export",
				ContainerID:   state.ContainerID,
				ContainerIP:   state.PrivateIP,
				ContainerPort: ep.PortNumber,
				HostID:        state.HostID,
				HostIP:        state.HostIP,
				InstanceID:    state.InstanceID,
			}
			endpoints = append(endpoints, endpoint)
		}
	}

	return endpoints
}
340967
func GetClusterFromKubeConfig(config *clientcmdapi.Config) *clientcmdapi.Cluster {
	// If there is an unnamed cluster object, use it
	if config.Clusters[""] != nil {
		return config.Clusters[""]
	}
	if config.Contexts[config.CurrentContext] != nil {
		return config.Clusters[config.Contexts[config.CurrentContext].Cluster]
	}
	return nil
}
1070094
func (client *Client) GetSpaceSummary(spaceGUID string) (SpaceSummary, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetSpaceSummaryRequest,
		URIParams:   Params{"space_guid": spaceGUID},
	})
	if err != nil {
		return SpaceSummary{}, nil, err
	}

	var spaceSummary SpaceSummary
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &spaceSummary,
	}

	err = client.connection.Make(request, &response)
	return spaceSummary, response.Warnings, err
}
1344804
func (c *VFSClientset) GetCluster(name string) (*kops.Cluster, error) {
	return c.clusters().Get(name, metav1.GetOptions{})
}
580616
func (c *mockGCECloud) FindClusterStatus(cluster *kops.Cluster) (*kops.ClusterStatus, error) {
	return nil, fmt.Errorf("mockGCECloud::FindClusterStatus not implemented")
}
276863
func (c *Client) GetURLForStateSummaryFilePid(pid Pid) url.URL {
	return c.getURLForFilePid(pid, "state-summary")
}