// NewClient creates a new client for accessing the metricsmanager api func NewClient(apiCaller base.APICaller) (*Client, error) { envTag, err := apiCaller.EnvironTag() if err != nil { return nil, errors.Trace(err) } facade := base.NewFacadeCaller(apiCaller, "MetricsManager") return &Client{ envTag: envTag, facade: facade, }, nil }
// NewAPI returns a new API client for the Singular facade. It exposes methods // for claiming and observing administration responsibility for the apiCaller's // model, on behalf of the supplied controller machine. func NewAPI(apiCaller base.APICaller, controllerTag names.MachineTag) (*API, error) { controllerId := controllerTag.Id() if !names.IsValidMachine(controllerId) { return nil, errors.NotValidf("controller tag") } modelTag, err := apiCaller.EnvironTag() if err != nil { return nil, errors.Trace(err) } facadeCaller := base.NewFacadeCaller(apiCaller, "Singular") return &API{ modelTag: modelTag, controllerTag: controllerTag, facadeCaller: facadeCaller, }, nil }