Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(541)

Side by Side Diff: state/api/client.go

Issue 92390050: Add output for ensure-availability command. (Closed)
Patch Set: Add output for ensure-availability command. Created 10 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package api 4 package api
5 5
6 import ( 6 import (
7 "crypto/tls" 7 "crypto/tls"
8 "encoding/json" 8 "encoding/json"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 // APIHostPorts returns a slice of instance.HostPort for each API server. 722 // APIHostPorts returns a slice of instance.HostPort for each API server.
723 func (c *Client) APIHostPorts() ([][]instance.HostPort, error) { 723 func (c *Client) APIHostPorts() ([][]instance.HostPort, error) {
724 var result params.APIHostPortsResult 724 var result params.APIHostPortsResult
725 if err := c.call("APIHostPorts", nil, &result); err != nil { 725 if err := c.call("APIHostPorts", nil, &result); err != nil {
726 return nil, err 726 return nil, err
727 } 727 }
728 return result.Servers, nil 728 return result.Servers, nil
729 } 729 }
730 730
731 // EnsureAvailability ensures the availability of Juju state servers. 731 // EnsureAvailability ensures the availability of Juju state servers.
732 func (c *Client) EnsureAvailability(numStateServers int, cons constraints.Value, series string) error { 732 func (c *Client) EnsureAvailability(numStateServers int,
733 » cons constraints.Value,
734 » series string) (params.EnsureAvailabilityResult, error) {
735 » var result params.EnsureAvailabilityResult
733 args := params.EnsureAvailability{ 736 args := params.EnsureAvailability{
734 NumStateServers: numStateServers, 737 NumStateServers: numStateServers,
735 Constraints: cons, 738 Constraints: cons,
736 Series: series, 739 Series: series,
737 } 740 }
738 » return c.call("EnsureAvailability", args, nil) 741 » if err := c.call("EnsureAvailability", args, &result); err != nil {
742 » » return params.EnsureAvailabilityResult{}, err
743 » }
744 » return result, nil
739 } 745 }
740 746
741 // AgentVersion reports the version number of the api server. 747 // AgentVersion reports the version number of the api server.
742 func (c *Client) AgentVersion() (version.Number, error) { 748 func (c *Client) AgentVersion() (version.Number, error) {
743 var result params.AgentVersionResult 749 var result params.AgentVersionResult
744 if err := c.call("AgentVersion", nil, &result); err != nil { 750 if err := c.call("AgentVersion", nil, &result); err != nil {
745 return version.Number{}, err 751 return version.Number{}, err
746 } 752 }
747 return result.Version, nil 753 return result.Version, nil
748 } 754 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 var errResult params.ErrorResult 855 var errResult params.ErrorResult
850 err = json.Unmarshal(line, &errResult) 856 err = json.Unmarshal(line, &errResult)
851 if err != nil { 857 if err != nil {
852 return nil, fmt.Errorf("unable to unmarshal initial response: %v ", err) 858 return nil, fmt.Errorf("unable to unmarshal initial response: %v ", err)
853 } 859 }
854 if errResult.Error != nil { 860 if errResult.Error != nil {
855 return nil, errResult.Error 861 return nil, errResult.Error
856 } 862 }
857 return connection, nil 863 return connection, nil
858 } 864 }
OLDNEW
« state/addmachine.go ('K') | « state/addmachine.go ('k') | state/api/params/params.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b