本文整理汇总了Golang中github.com/juju/juju/state.State.Resources方法的典型用法代码示例。如果您正苦于以下问题:Golang State.Resources方法的具体用法?Golang State.Resources怎么用?Golang State.Resources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/state.State
的用法示例。
在下文中一共展示了State.Resources方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: newHookContextFacade
func (r resources) newHookContextFacade(st *corestate.State, unit *corestate.Unit) (interface{}, error) {
res, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
return internalserver.NewUnitFacade(&resourcesUnitDataStore{res, unit}), nil
}
示例2: NewLatestCharmHandler
// NewLatestCharmHandler returns a LatestCharmHandler that uses the
// given Juju state.
func NewLatestCharmHandler(st *state.State) (charmrevisionupdater.LatestCharmHandler, error) {
resources, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
handler := workers.NewLatestCharmHandler(resources)
return handler, nil
}
示例3: newPublicFacade
// newPublicFacade is passed into common.RegisterStandardFacade
// in registerPublicFacade.
func (resources) newPublicFacade(st *corestate.State, _ *common.Resources, authorizer common.Authorizer) (*server.Facade, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
rst, err := st.Resources()
//rst, err := state.NewState(&resourceState{raw: st})
if err != nil {
return nil, errors.Trace(err)
}
return server.NewFacade(rst), nil
}
示例4: NewPublicFacade
// NewPublicFacade provides the public API facade for resources. It is
// passed into common.RegisterStandardFacade.
func NewPublicFacade(st *corestate.State, _ *common.Resources, authorizer common.Authorizer) (*server.Facade, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
rst, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
newClient := func() (server.CharmStore, error) {
return newCharmStoreClient(st)
}
facade, err := server.NewFacade(rst, newClient)
if err != nil {
return nil, errors.Trace(err)
}
return facade, nil
}
示例5: NewPublicFacade
// NewPublicFacade provides the public API facade for resources. It is
// passed into common.RegisterStandardFacade.
func NewPublicFacade(st *corestate.State, _ *common.Resources, authorizer common.Authorizer) (*server.Facade, error) {
if !authorizer.AuthClient() {
return nil, common.ErrPerm
}
rst, err := st.Resources()
if err != nil {
return nil, errors.Trace(err)
}
newClient := func(cURL *charm.URL, csMac *macaroon.Macaroon) (server.CharmStore, error) {
opener := newCharmstoreOpener(cURL, csMac)
return opener.newClient(), nil
}
facade, err := server.NewFacade(rst, newClient)
if err != nil {
return nil, errors.Trace(err)
}
return facade, nil
}