本文整理汇总了Golang中github.com/juju/juju/api.State.EnvironTag方法的典型用法代码示例。如果您正苦于以下问题:Golang State.EnvironTag方法的具体用法?Golang State.EnvironTag怎么用?Golang State.EnvironTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/juju/api.State
的用法示例。
在下文中一共展示了State.EnvironTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: assertRemoteEnvironment
func (s *loginSuite) assertRemoteEnvironment(c *gc.C, st *api.State, expected names.EnvironTag) {
// Look at what the api thinks it has.
tag, err := st.EnvironTag()
c.Assert(err, jc.ErrorIsNil)
c.Assert(tag, gc.Equals, expected)
// Look at what the api Client thinks it has.
client := st.Client()
// EnvironmentUUID looks at the env tag on the api state connection.
c.Assert(client.EnvironmentUUID(), gc.Equals, expected.Id())
// EnvironmentInfo calls a remote method that looks up the environment.
info, err := client.EnvironmentInfo()
c.Assert(err, jc.ErrorIsNil)
c.Assert(info.UUID, gc.Equals, expected.Id())
}
示例2: envEndpoint
// envEndpoint returns "/environment/<env-uuid>/<destination>"
func envEndpoint(c *gc.C, apiState *api.State, destination string) string {
envTag, err := apiState.EnvironTag()
c.Assert(err, jc.ErrorIsNil)
return path.Join("/environment", envTag.Id(), destination)
}