// APIVersion returns the version info for the cluster.
775946
func (k *kubernetesClient) APIVersion() (string, error) {
	body, err := k.client().CoreV1().RESTClient().Get().AbsPath("/version").Do().Raw()
	if err != nil {
		return "", err
	}
	var info apimachineryversion.Info
	err = json.Unmarshal(body, &info)
	if err != nil {
		return "", errors.Annotatef(err, "got '%s' querying API version", string(body))
	}
	version := info.GitVersion
	// git version is "vX.Y.Z", strip the "v"
	version = strings.Trim(version, "v")
	return version, nil
}
803761
func (s *DeleteTemplateService) Version(version int) *DeleteTemplateService {
	s.version = &version
	return s
}
832995
func (c *AppPackageListCall) Version(version string) *AppPackageListCall {
	c.urlParams_.Set("version", version)
	return c
}
962885
func (r *Docker) Version() (string, error) {
	// Note: the server daemon has to be running, for this call to return successfully
	ver, err := r.Runner.CombinedOutput("docker version --format '{{.Server.Version}}'")
	if err != nil {
		return "", err
	}

	return strings.Split(ver, "\n")[0], nil
}
79761
func StatusReleaseVersion(version int32) StatusOption {
	return func(opts *options) {
		opts.statusReq.Version = version
	}
}
1251015
func (c *Client) Version() (vers map[string]string, err error) {
	// Variants: Version
	// Request : MUST NOT key, value, extras
	// Response: MUST NOT key, extras; MUST value

	// value is the version as a string in form "X.Y.Z"
	m := &msg{
		header: header{
			Op: opVersion,
		},
	}

	vers = make(map[string]string)
	for _, s := range c.servers {
		if s.isAlive {
			err = s.perform(m)
			if err == nil {
				vers[s.address] = m.val
			}
		}
	}

	return
}
790935
func (b *UpdateService) Version(version int64) *UpdateService {
	b.version = &version
	return b
}
286252
func (wc *WhisperClient) GetVersion(ctx *Context) (version string, _ error) {
	return wc.client.Version(ctx.context)
}
392222
func (n *Node) GetVersion() *api.Version {
	n.stopMu.RLock()
	defer n.stopMu.RUnlock()

	if !n.IsMember() {
		return nil
	}

	status := n.Status()
	return &api.Version{Index: status.Commit}
}
134003
func (b *Broker) ApiVersions(request *ApiVersionsRequest) (*ApiVersionsResponse, error) {
	response := new(ApiVersionsResponse)

	err := b.sendAndReceive(request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
945987
func IPVersion(b []byte) int {
	// Length must be at least offset+length of version field.
	if len(b) < versIHL+1 {
		return -1
	}
	return int(b[versIHL] >> 4)
}
1013878
func VersionFromContext(ctx context.Context) string {
	if ctx == nil {
		return ""
	}

	if val := ctx.Value(APIVersionKey{}); val != nil {
		return val.(string)
	}

	return ""
}
761773
func (ds *dockerService) Version(_ context.Context, r *runtimeapi.VersionRequest) (*runtimeapi.VersionResponse, error) {
	v, err := ds.getDockerVersion()
	if err != nil {
		return nil, err
	}
	return &runtimeapi.VersionResponse{
		Version:           kubeAPIVersion,
		RuntimeName:       dockerRuntimeName,
		RuntimeVersion:    v.Version,
		RuntimeApiVersion: v.APIVersion,
	}, nil
}
1288211
func (s *Status) Version(args *structs.GenericRequest, reply *structs.VersionResponse) error {
	if done, err := s.srv.forward("Status.Version", args, args, reply); done {
		return err
	}

	conf := s.srv.config
	reply.Build = conf.Build
	reply.Versions = map[string]int{
		structs.ProtocolVersion: int(conf.ProtocolVersion),
		structs.APIMajorVersion: structs.ApiMajorVersion,
		structs.APIMinorVersion: structs.ApiMinorVersion,
	}
	return nil
}
1061966
func (c *Client) Version(ctx context.Context) (string, error) {
	version, _, err := c.pingTimeout(ctx)
	return version, err
}
694281
func (c *Client) MongoVersion() (string, error) {
	if c.BestAPIVersion() < 6 {
		return "", errors.NotSupportedf("MongoVersion not supported by this version of Juju")
	}
	var result params.StringResult
	err := c.facade.FacadeCall("MongoVersion", nil, &result)
	if err != nil {
		return "", errors.Trace(err)
	}
	if result.Error != nil {
		return "", result.Error
	}
	return result.Result, nil
}
1133045
func (g *KubeVersionGetter) ClusterVersion() (string, *versionutil.Version, error) {
	clusterVersionInfo, err := g.client.Discovery().ServerVersion()
	if err != nil {
		return "", nil, errors.Wrap(err, "Couldn't fetch cluster version from the API Server")
	}
	fmt.Fprintf(g.w, "[upgrade/versions] Cluster version: %s\n", clusterVersionInfo.String())

	clusterVersion, err := versionutil.ParseSemantic(clusterVersionInfo.String())
	if err != nil {
		return "", nil, errors.Wrap(err, "Couldn't parse cluster version")
	}
	return clusterVersionInfo.String(), clusterVersion, nil
}