当前位置: 首页>>代码示例>>Golang>>正文


Golang status.Status类代码示例

本文整理汇总了Golang中github.com/juju/juju/status.Status的典型用法代码示例。如果您正苦于以下问题:Golang Status类的具体用法?Golang Status怎么用?Golang Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Status类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: SetStatus

// 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()
}
开发者ID:bac,项目名称:juju,代码行数:14,代码来源:unit.go

示例2: matchAgentStatus

func matchAgentStatus(patterns []string, agentStatus status.Status) (bool, bool, error) {
	oneValidStatus := false
	for _, p := range patterns {
		// If the pattern isn't a known status, ignore it.
		ps := status.Status(p)
		if !ps.KnownAgentStatus() {
			continue
		}

		oneValidStatus = true
		if agentStatus.Matches(ps) {
			return true, true, nil
		}
	}
	return false, oneValidStatus, nil
}
开发者ID:bac,项目名称:juju,代码行数:16,代码来源:filtering.go

示例3: SetUnitStatus

// 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()
}
开发者ID:bac,项目名称:juju,代码行数:17,代码来源:unit.go

示例4: SetAgentStatus

// 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()
}
开发者ID:bac,项目名称:juju,代码行数:18,代码来源:unit.go

示例5: matchWorkloadStatus

func matchWorkloadStatus(patterns []string, workloadStatus status.Status, agentStatus status.Status) (bool, bool, error) {
	oneValidStatus := false
	for _, p := range patterns {
		// If the pattern isn't a known status, ignore it.
		ps := status.Status(p)
		if !ps.KnownWorkloadStatus() {
			continue
		}

		oneValidStatus = true
		// To preserve current expected behaviour, we only report on workload status
		// if the agent itself is not in error.
		if agentStatus != status.Error && workloadStatus.WorkloadMatches(ps) {
			return true, true, nil
		}
	}
	return false, oneValidStatus, nil
}
开发者ID:bac,项目名称:juju,代码行数:18,代码来源:filtering.go

示例6: SetStatus

// 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()
}
开发者ID:bac,项目名称:juju,代码行数:21,代码来源:application.go

示例7: SetInstanceStatus

// 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()
}
开发者ID:bac,项目名称:juju,代码行数:12,代码来源:machine.go

示例8: SetStatus

// 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
}
开发者ID:bac,项目名称:juju,代码行数:19,代码来源:undertaker.go


注:本文中的github.com/juju/juju/status.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。