当前位置: 首页>>代码示例>>Golang>>正文


Golang State.Client方法代码示例

本文整理汇总了Golang中launchpad/net/juju-core/state/api.State.Client方法的典型用法代码示例。如果您正苦于以下问题:Golang State.Client方法的具体用法?Golang State.Client怎么用?Golang State.Client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launchpad/net/juju-core/state/api.State的用法示例。


在下文中一共展示了State.Client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: opClientServiceSetCharm

func opClientServiceSetCharm(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceSetCharm("nosuch", "local:series/wordpress", false)
	if params.ErrCode(err) == params.CodeNotFound {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例2: opClientAddServiceUnits

func opClientAddServiceUnits(c *C, st *api.State, mst *state.State) (func(), error) {
	_, err := st.Client().AddServiceUnits("nosuch", 1)
	if params.ErrCode(err) == params.CodeNotFound {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例3: opClientServiceUnexpose

func opClientServiceUnexpose(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceUnexpose("wordpress")
	if err != nil {
		return func() {}, err
	}
	return func() {}, nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例4: opClientDestroyServiceUnits

func opClientDestroyServiceUnits(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().DestroyServiceUnits([]string{"wordpress/99"})
	if err != nil && strings.HasPrefix(err.Error(), "no units were destroyed") {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例5: opClientServiceSetYAML

func opClientServiceSetYAML(c *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
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例6: opClientServiceDestroy

func opClientServiceDestroy(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceDestroy("non-existent")
	if params.ErrCode(err) == params.CodeNotFound {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例7: opClientDestroyRelation

func opClientDestroyRelation(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().DestroyRelation("nosuch1", "nosuch2")
	if params.ErrCode(err) == params.CodeNotFound {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例8: opClientServiceDeploy

func opClientServiceDeploy(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceDeploy("mad:bad/url-1", "x", 1, "", constraints.Value{})
	if err.Error() == `charm URL has invalid schema: "mad:bad/url-1"` {
		err = nil
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例9: opClientWatchAll

func opClientWatchAll(c *C, st *api.State, mst *state.State) (func(), error) {
	watcher, err := st.Client().WatchAll()
	if err == nil {
		watcher.Stop()
	}
	return func() {}, err
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:7,代码来源:perm_test.go

示例10: resetBlogTitle

func resetBlogTitle(c *C, st *api.State) func() {
	return func() {
		err := st.Client().ServiceSet("wordpress", map[string]string{
			"blog-title": "",
		})
		c.Assert(err, IsNil)
	}
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:8,代码来源:perm_test.go

示例11: opClientGetAnnotations

func opClientGetAnnotations(c *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, DeepEquals, make(map[string]string))
	return func() {}, nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:8,代码来源:perm_test.go

示例12: opClientSetServiceConstraints

func opClientSetServiceConstraints(c *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
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:8,代码来源:perm_test.go

示例13: opClientStatus

func opClientStatus(c *C, st *api.State, mst *state.State) (func(), error) {
	status, err := st.Client().Status()
	if err != nil {
		c.Check(status, IsNil)
		return func() {}, err
	}
	c.Assert(status, DeepEquals, scenarioStatus)
	return func() {}, nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:9,代码来源:perm_test.go

示例14: opClientServiceSet

func opClientServiceSet(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceSet("wordpress", map[string]string{
		"blog-title": "foo",
	})
	if err != nil {
		return func() {}, err
	}
	return resetBlogTitle(c, st), nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:9,代码来源:perm_test.go

示例15: opClientServiceExpose

func opClientServiceExpose(c *C, st *api.State, mst *state.State) (func(), error) {
	err := st.Client().ServiceExpose("wordpress")
	if err != nil {
		return func() {}, err
	}
	return func() {
		svc, err := mst.Service("wordpress")
		c.Assert(err, IsNil)
		svc.ClearExposed()
	}, nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:11,代码来源:perm_test.go


注:本文中的launchpad/net/juju-core/state/api.State.Client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。