github.com/go-chef/chef@v0.30.1/stats.go (about)

     1  package chef
     2  
     3  type StatsService struct {
     4  	client *Client
     5  }
     6  
     7  // Stats: represents the body of the returned information.
     8  type Stats []map[string]interface{}
     9  
    10  // Stat gets the frontend & backend server information.
    11  //
    12  // https://docs.chef.io/api_chef_server/
    13  //
    14  // ?format = text or json or nothing, text is supposed to work but returns a 406
    15  // This module only implements the json option. using a struct for the parse
    16  // out data will force JSON output.
    17  func (e *StatsService) Get(user string, password string) (data Stats, err error) {
    18  	format := "json"
    19  	err = e.client.basicRequestDecoder("GET", "_stats?format="+format, nil, &data, user, password)
    20  	return
    21  }