github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/api/controller/mongo.go (about)

     1  // Copyright 2012-2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package controller
     5  
     6  import (
     7  	"github.com/juju/errors"
     8  	"github.com/juju/juju/apiserver/params"
     9  )
    10  
    11  // MongoVersion returns the mongo version associated with the state session.
    12  func (c *Client) MongoVersion() (string, error) {
    13  	if c.BestAPIVersion() < 6 {
    14  		return "", errors.NotSupportedf("MongoVersion not supported by this version of Juju")
    15  	}
    16  	var result params.StringResult
    17  	err := c.facade.FacadeCall("MongoVersion", nil, &result)
    18  	if err != nil {
    19  		return "", errors.Trace(err)
    20  	}
    21  	if result.Error != nil {
    22  		return "", result.Error
    23  	}
    24  	return result.Result, nil
    25  }