本文整理匯總了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)
}