本文整理汇总了Golang中github.com/juju/names.UserTag.String方法的典型用法代码示例。如果您正苦于以下问题:Golang UserTag.String方法的具体用法?Golang UserTag.String怎么用?Golang UserTag.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/names.UserTag
的用法示例。
在下文中一共展示了UserTag.String方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createArgs
func (s *modelManagerSuite) createArgs(c *gc.C, owner names.UserTag) params.ModelCreateArgs {
return params.ModelCreateArgs{
OwnerTag: owner.String(),
Account: make(map[string]interface{}),
Config: map[string]interface{}{
"name": "test-model",
"authorized-keys": "ssh-key",
// And to make it a valid dummy config
"state-server": false,
},
}
}
示例2: modifyAccess
func (s *modelManagerSuite) modifyAccess(c *gc.C, user names.UserTag, action params.ModelAction, access params.ModelAccessPermission, model names.ModelTag) error {
args := params.ModifyModelAccessRequest{
Changes: []params.ModifyModelAccess{{
UserTag: user.String(),
Action: action,
Access: access,
ModelTag: model.String(),
}}}
result, err := s.modelmanager.ModifyModelAccess(args)
c.Assert(err, jc.ErrorIsNil)
return result.OneError()
}
示例3: addTestingService
func addTestingService(c *gc.C, st *State, series, name string, ch *Charm, owner names.UserTag, bindings map[string]string, storage map[string]StorageConstraints) *Service {
c.Assert(ch, gc.NotNil)
service, err := st.AddService(AddServiceArgs{
Name: name,
Series: series,
Owner: owner.String(),
Charm: ch,
EndpointBindings: bindings,
Storage: storage,
})
c.Assert(err, jc.ErrorIsNil)
return service
}
示例4: CreateLocalLoginMacaroon
// CreateLocalLoginMacaroon creates a local login macaroon for the
// authenticated user.
func (c *Client) CreateLocalLoginMacaroon(tag names.UserTag) (*macaroon.Macaroon, error) {
args := params.Entities{Entities: []params.Entity{{tag.String()}}}
var results params.MacaroonResults
if err := c.facade.FacadeCall("CreateLocalLoginMacaroon", args, &results); err != nil {
return nil, errors.Trace(err)
}
if n := len(results.Results); n != 1 {
logger.Errorf("expected 1 result, got %#v", results)
return nil, errors.Errorf("expected 1 result, got %d", n)
}
result := results.Results[0]
if result.Error != nil {
return nil, errors.Trace(result.Error)
}
return result.Result, nil
}
示例5: addTestingService
func addTestingService(c *gc.C, st *State, name string, ch *Charm, owner names.UserTag, networks []string, storage map[string]StorageConstraints) *Service {
c.Assert(ch, gc.NotNil)
service, err := st.AddService(name, owner.String(), ch, networks, storage)
c.Assert(err, jc.ErrorIsNil)
return service
}
示例6: AddTestingServiceWithNetworks
func AddTestingServiceWithNetworks(c *gc.C, st *State, name string, ch *Charm, owner names.UserTag, networks []string) *Service {
c.Assert(ch, gc.NotNil)
service, err := st.AddService(name, owner.String(), ch, networks)
c.Assert(err, gc.IsNil)
return service
}