本文整理汇总了Golang中github.com/juju/core/state/api.State.Client方法的典型用法代码示例。如果您正苦于以下问题:Golang State.Client方法的具体用法?Golang State.Client怎么用?Golang State.Client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/juju/core/state/api.State
的用法示例。
在下文中一共展示了State.Client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: opClientServiceDeployWithNetworks
func opClientServiceDeployWithNetworks(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().ServiceDeployWithNetworks("mad:bad/url-1", "x", 1, "", constraints.Value{}, "", nil, nil)
if err.Error() == `charm URL has invalid schema: "mad:bad/url-1"` {
err = nil
}
return func() {}, err
}
示例2: opClientServiceUnexpose
func opClientServiceUnexpose(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().ServiceUnexpose("wordpress")
if err != nil {
return func() {}, err
}
return func() {}, nil
}
示例3: opClientServiceSetCharm
func opClientServiceSetCharm(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().ServiceSetCharm("nosuch", "local:quantal/wordpress", false)
if params.IsCodeNotFound(err) {
err = nil
}
return func() {}, err
}
示例4: opClientEnvironmentGet
func opClientEnvironmentGet(c *gc.C, st *api.State, mst *state.State) (func(), error) {
_, err := st.Client().EnvironmentGet()
if err != nil {
return func() {}, err
}
return func() {}, nil
}
示例5: opClientServiceSetYAML
func opClientServiceSetYAML(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().ServiceSetYAML("wordpress", `"wordpress": {"blog-title": "foo"}`)
if err != nil {
return func() {}, err
}
return resetBlogTitle(c, st), nil
}
示例6: opClientAddServiceUnits
func opClientAddServiceUnits(c *gc.C, st *api.State, mst *state.State) (func(), error) {
_, err := st.Client().AddServiceUnits("nosuch", 1, "")
if params.IsCodeNotFound(err) {
err = nil
}
return func() {}, err
}
示例7: opClientDestroyServiceUnits
func opClientDestroyServiceUnits(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().DestroyServiceUnits("wordpress/99")
if err != nil && strings.HasPrefix(err.Error(), "no units were destroyed") {
err = nil
}
return func() {}, err
}
示例8: opClientServiceDestroy
func opClientServiceDestroy(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().ServiceDestroy("non-existent")
if params.IsCodeNotFound(err) {
err = nil
}
return func() {}, err
}
示例9: opClientDestroyRelation
func opClientDestroyRelation(c *gc.C, st *api.State, mst *state.State) (func(), error) {
err := st.Client().DestroyRelation("nosuch1", "nosuch2")
if params.IsCodeNotFound(err) {
err = nil
}
return func() {}, err
}
示例10: opClientWatchAll
func opClientWatchAll(c *gc.C, st *api.State, mst *state.State) (func(), error) {
watcher, err := st.Client().WatchAll()
if err == nil {
watcher.Stop()
}
return func() {}, err
}
示例11: opClientSetServiceConstraints
func opClientSetServiceConstraints(c *gc.C, st *api.State, mst *state.State) (func(), error) {
nullConstraints := constraints.Value{}
err := st.Client().SetServiceConstraints("wordpress", nullConstraints)
if err != nil {
return func() {}, err
}
return func() {}, nil
}
示例12: resetBlogTitle
func resetBlogTitle(c *gc.C, st *api.State) func() {
return func() {
err := st.Client().ServiceSet("wordpress", map[string]string{
"blog-title": "",
})
c.Assert(err, gc.IsNil)
}
}
示例13: opClientSetEnvironmentConstraints
func opClientSetEnvironmentConstraints(c *gc.C, st *api.State, mst *state.State) (func(), error) {
nullConstraints := constraints.Value{}
err := st.Client().SetEnvironmentConstraints(nullConstraints)
if err != nil {
return func() {}, err
}
return func() {}, nil
}
示例14: opClientGetAnnotations
func opClientGetAnnotations(c *gc.C, st *api.State, mst *state.State) (func(), error) {
ann, err := st.Client().GetAnnotations("service-wordpress")
if err != nil {
return func() {}, err
}
c.Assert(ann, gc.DeepEquals, make(map[string]string))
return func() {}, nil
}
示例15: opClientStatus
func opClientStatus(c *gc.C, st *api.State, mst *state.State) (func(), error) {
status, err := st.Client().Status(nil)
if err != nil {
c.Check(status, gc.IsNil)
return func() {}, err
}
c.Assert(status, jc.DeepEquals, scenarioStatus)
return func() {}, nil
}