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