本文整理汇总了Golang中github.com/juju/names.ServiceTag.Id方法的典型用法代码示例。如果您正苦于以下问题:Golang ServiceTag.Id方法的具体用法?Golang ServiceTag.Id怎么用?Golang ServiceTag.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/names.ServiceTag
的用法示例。
在下文中一共展示了ServiceTag.Id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: BlockUntilLeadershipReleased
// BlockUntilLeadershipReleased implements the LeadershipService interface.
func (m *leadershipService) BlockUntilLeadershipReleased(serviceTag names.ServiceTag) (params.ErrorResult, error) {
if !m.authMember(serviceTag) {
return params.ErrorResult{Error: common.ServerError(common.ErrPerm)}, nil
}
if err := m.claimer.BlockUntilLeadershipReleased(serviceTag.Id()); err != nil {
return params.ErrorResult{Error: common.ServerError(err)}, nil
}
return params.ErrorResult{}, nil
}
示例2: BlockUntilLeadershipReleased
// BlockUntilLeadershipReleased implements the LeadershipService interface.
func (m *leadershipService) BlockUntilLeadershipReleased(serviceTag names.ServiceTag) (params.ErrorResult, error) {
if !m.authorizer.AuthUnitAgent() {
return params.ErrorResult{Error: common.ServerError(common.ErrPerm)}, nil
}
if err := m.LeadershipManager.BlockUntilLeadershipReleased(serviceTag.Id()); err != nil {
return params.ErrorResult{Error: common.ServerError(err)}, nil
}
return params.ErrorResult{}, nil
}
示例3: authMember
func (m *leadershipService) authMember(serviceTag names.ServiceTag) bool {
ownerTag := m.authorizer.GetAuthTag()
unitTag, ok := ownerTag.(names.UnitTag)
if !ok {
return false
}
unitId := unitTag.Id()
requireServiceId, err := names.UnitService(unitId)
if err != nil {
return false
}
return serviceTag.Id() == requireServiceId
}
示例4: getService
func (u *UniterAPI) getService(tag names.ServiceTag) (*state.Service, error) {
return u.st.Service(tag.Id())
}
示例5: HandleLatest
// HandleLatest implements apiserver/charmrevisionupdater.LatestCharmHandler
// by storing the charm's resources in state.
func (handler LatestCharmHandler) HandleLatest(serviceID names.ServiceTag, info charmstore.CharmInfo) error {
if err := handler.store.SetCharmStoreResources(serviceID.Id(), info.LatestResources, info.Timestamp); err != nil {
return errors.Trace(err)
}
return nil
}