當前位置: 首頁>>代碼示例>>Golang>>正文


Golang api.State類代碼示例

本文整理匯總了Golang中launchpad/net/juju-core/state/api.State的典型用法代碼示例。如果您正苦於以下問題:Golang State類的具體用法?Golang State怎麽用?Golang State使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了State類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: APIEntity

func (a *MachineAgent) APIEntity(st *api.State) (AgentAPIState, error) {
	m, err := st.MachineAgent().Machine(a.Tag())
	if err != nil {
		return nil, err
	}
	// TODO(rog) move the CheckProvisioned test into
	// this method when it's implemented in the API
	return m, nil
}
開發者ID:rif,項目名稱:golang-stuff,代碼行數:9,代碼來源:machine.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: 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


注:本文中的launchpad/net/juju-core/state/api.State類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。