// SetStatus sets the status of the unit. func (u *Unit) SetStatus(unitStatus status.Status, info string, data map[string]interface{}) error { var result params.ErrorResults args := params.SetStatus{ Entities: []params.EntityStatusArgs{ {Tag: u.tag.String(), Status: unitStatus.String(), Info: info, Data: data}, }, } err := u.st.facade.FacadeCall("SetStatus", args, &result) if err != nil { return err } return result.OneError() }
// SetUnitStatus sets the status of the unit. func (u *Unit) SetUnitStatus(unitStatus status.Status, info string, data map[string]interface{}) error { if u.st.facade.BestAPIVersion() < 2 { return errors.NotImplementedf("SetUnitStatus") } var result params.ErrorResults args := params.SetStatus{ Entities: []params.EntityStatusArgs{ {Tag: u.tag.String(), Status: unitStatus.String(), Info: info, Data: data}, }, } err := u.st.facade.FacadeCall("SetUnitStatus", args, &result) if err != nil { return errors.Trace(err) } return result.OneError() }
// SetAgentStatus sets the status of the unit agent. func (u *Unit) SetAgentStatus(agentStatus status.Status, info string, data map[string]interface{}) error { var result params.ErrorResults args := params.SetStatus{ Entities: []params.EntityStatusArgs{ {Tag: u.tag.String(), Status: agentStatus.String(), Info: info, Data: data}, }, } setStatusFacadeCall := "SetAgentStatus" if u.st.facade.BestAPIVersion() < 2 { setStatusFacadeCall = "SetStatus" } err := u.st.facade.FacadeCall(setStatusFacadeCall, args, &result) if err != nil { return err } return result.OneError() }
// SetStatus sets the status of the service if the passed unitName, // corresponding to the calling unit, is of the leader. func (s *Application) SetStatus(unitName string, serviceStatus status.Status, info string, data map[string]interface{}) error { tag := names.NewUnitTag(unitName) var result params.ErrorResults args := params.SetStatus{ Entities: []params.EntityStatusArgs{ { Tag: tag.String(), Status: serviceStatus.String(), Info: info, Data: data, }, }, } err := s.st.facade.FacadeCall("SetApplicationStatus", args, &result) if err != nil { return errors.Trace(err) } return result.OneError() }
// SetInstanceStatus sets the status for the provider instance. func (m *Machine) SetInstanceStatus(status status.Status, message string, data map[string]interface{}) error { var result params.ErrorResults args := params.SetStatus{Entities: []params.EntityStatusArgs{ {Tag: m.tag.String(), Status: status.String(), Info: message, Data: data}, }} err := m.st.facade.FacadeCall("SetInstanceStatus", args, &result) if err != nil { return err } return result.OneError() }
// SetStatus sets the status of the model. func (c *Client) SetStatus(status status.Status, message string, data map[string]interface{}) error { args := params.SetStatus{ Entities: []params.EntityStatusArgs{ {c.modelTag.String(), status.String(), message, data}, }, } var results params.ErrorResults if err := c.caller.FacadeCall("SetStatus", args, &results); err != nil { return errors.Trace(err) } if len(results.Results) != 1 { return errors.Errorf("expected 1 result, got %d", len(results.Results)) } if results.Results[0].Error != nil { return errors.Trace(results.Results[0].Error) } return nil }