本文整理汇总了Golang中github.com/juju/juju/state.Unit.Resolved方法的典型用法代码示例。如果您正苦于以下问题:Golang Unit.Resolved方法的具体用法?Golang Unit.Resolved怎么用?Golang Unit.Resolved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.Unit
的用法示例。
在下文中一共展示了Unit.Resolved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Resolved
// Resolved returns the current resolved setting for each given unit.
func (u *UniterAPIV3) Resolved(args params.Entities) (params.ResolvedModeResults, error) {
result := params.ResolvedModeResults{
Results: make([]params.ResolvedModeResult, len(args.Entities)),
}
canAccess, err := u.accessUnit()
if err != nil {
return params.ResolvedModeResults{}, err
}
for i, entity := range args.Entities {
tag, err := names.ParseUnitTag(entity.Tag)
if err != nil {
result.Results[i].Error = common.ServerError(common.ErrPerm)
continue
}
err = common.ErrPerm
if canAccess(tag) {
var unit *state.Unit
unit, err = u.getUnit(tag)
if err == nil {
result.Results[i].Mode = params.ResolvedMode(unit.Resolved())
}
}
result.Results[i].Error = common.ServerError(err)
}
return result, nil
}
示例2: assertResolved
func (s *clientSuite) assertResolved(c *gc.C, u *state.Unit) {
err := s.APIState.Client().Resolved("wordpress/0", false)
c.Assert(err, jc.ErrorIsNil)
// Freshen the unit's state.
err = u.Refresh()
c.Assert(err, jc.ErrorIsNil)
// And now the actual test assertions: we set the unit as resolved via
// the API so it should have a resolved mode set.
mode := u.Resolved()
c.Assert(mode, gc.Equals, state.ResolvedRetryHooks)
}