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


Golang names.ActionTag类代码示例

本文整理汇总了Golang中github.com/juju/names.ActionTag的典型用法代码示例。如果您正苦于以下问题:Golang ActionTag类的具体用法?Golang ActionTag怎么用?Golang ActionTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: actionIdFromTag

// actionIdFromTag converts an ActionTag to an actionId
func actionIdFromTag(tag names.ActionTag) string {
	ptag := tag.PrefixTag()
	if ptag == nil {
		return ""
	}
	return fmt.Sprintf("%s%d", ensureActionMarker(ptag.Id()), tag.Sequence())
}
开发者ID:kapilt,项目名称:juju,代码行数:8,代码来源:action.go

示例2: ActionFinish

// ActionFinish captures the structured output of an action.
func (st *State) ActionFinish(tag names.ActionTag, status string, results map[string]interface{}, message string) error {
	var outcome params.ErrorResults

	args := params.ActionExecutionResults{
		Results: []params.ActionExecutionResult{
			{
				ActionTag: tag.String(),
				Status:    status,
				Results:   results,
				Message:   message,
			},
		},
	}

	err := st.facade.FacadeCall("FinishActions", args, &outcome)
	if err != nil {
		return err
	}
	if len(outcome.Results) != 1 {
		return fmt.Errorf("expected 1 result, got %d", len(outcome.Results))
	}
	result := outcome.Results[0]
	if result.Error != nil {
		return result.Error
	}
	return nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:28,代码来源:uniter.go

示例3: getOneAction

// getOneAction retrieves a single Action from the state server.
func (st *State) getOneAction(tag *names.ActionTag) (params.ActionsQueryResult, error) {
	nothing := params.ActionsQueryResult{}

	args := params.Entities{
		Entities: []params.Entity{
			{Tag: tag.String()},
		},
	}

	var results params.ActionsQueryResults
	err := st.facade.FacadeCall("Actions", args, &results)
	if err != nil {
		return nothing, err
	}

	if len(results.Results) > 1 {
		return nothing, fmt.Errorf("expected only 1 action query result, got %d", len(results.Results))
	}

	// handle server errors
	result := results.Results[0]
	if err := result.Error; err != nil {
		return nothing, err
	}

	return result, nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:28,代码来源:uniter.go

示例4: ActionBegin

// ActionBegin marks an action as running.
func (c *Client) ActionBegin(tag names.ActionTag) error {
	var results params.ErrorResults

	args := params.Entities{
		Entities: []params.Entity{{Tag: tag.String()}},
	}

	err := c.facade.FacadeCall("BeginActions", args, &results)
	if err != nil {
		return errors.Trace(err)
	}

	return results.OneError()
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:15,代码来源:machineactions.go

示例5: ActionFinish

// ActionFinish captures the structured output of an action.
func (c *Client) ActionFinish(tag names.ActionTag, status string, actionResults map[string]interface{}, message string) error {
	var results params.ErrorResults

	args := params.ActionExecutionResults{
		Results: []params.ActionExecutionResult{{
			ActionTag: tag.String(),
			Status:    status,
			Results:   actionResults,
			Message:   message,
		}},
	}

	err := c.facade.FacadeCall("FinishActions", args, &results)
	if err != nil {
		return errors.Trace(err)
	}

	return results.OneError()
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:20,代码来源:machineactions.go

示例6: ActionBegin

// ActionBegin marks an action as running.
func (st *State) ActionBegin(tag names.ActionTag) error {
	var outcome params.ErrorResults

	args := params.Entities{
		Entities: []params.Entity{
			{Tag: tag.String()},
		},
	}

	err := st.facade.FacadeCall("BeginActions", args, &outcome)
	if err != nil {
		return err
	}
	if len(outcome.Results) != 1 {
		return fmt.Errorf("expected 1 result, got %d", len(outcome.Results))
	}
	result := outcome.Results[0]
	if result.Error != nil {
		return result.Error
	}
	return nil
}
开发者ID:pmatulis,项目名称:juju,代码行数:23,代码来源:uniter.go

示例7: getOneAction

func (c *Client) getOneAction(tag names.ActionTag) (params.ActionResult, error) {
	nothing := params.ActionResult{}

	args := params.Entities{
		Entities: []params.Entity{{Tag: tag.String()}},
	}

	var results params.ActionResults
	err := c.facade.FacadeCall("Actions", args, &results)
	if err != nil {
		return nothing, errors.Trace(err)
	}

	if len(results.Results) > 1 {
		return nothing, errors.Errorf("expected only 1 action query result, got %d", len(results.Results))
	}

	result := results.Results[0]
	if result.Error != nil {
		return nothing, errors.Trace(result.Error)
	}

	return result, nil
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:24,代码来源:machineactions.go

示例8: ActionFail

// ActionFail captures the action tag and error of a failed action.
func (st *State) ActionFail(tag names.ActionTag, err string) error {
	var result params.BoolResult
	args := params.ActionResult{ActionTag: tag.String(), Message: err, Failed: true}
	return st.facade.FacadeCall("ActionFinish", args, &result)
}
开发者ID:kapilt,项目名称:juju,代码行数:6,代码来源:uniter.go

示例9: ActionComplete

// ActionComplete captures the structured output of an action.
func (st *State) ActionComplete(tag names.ActionTag, results map[string]interface{}) error {
	var result params.BoolResult
	args := params.ActionResult{ActionTag: tag.String(), Results: results}
	return st.facade.FacadeCall("ActionFinish", args, &result)
}
开发者ID:kapilt,项目名称:juju,代码行数:6,代码来源:uniter.go

示例10: ActionFail

func (st *State) ActionFail(tag names.ActionTag, errorMessage string) error {
	var result params.BoolResult
	args := params.ActionResult{ActionTag: tag.String(), Output: errorMessage}
	return st.call("ActionFail", args, &result)
}
开发者ID:jiasir,项目名称:juju,代码行数:5,代码来源:uniter.go

示例11: ActionComplete

func (st *State) ActionComplete(tag names.ActionTag, output string) error {
	var result params.BoolResult
	args := params.ActionResult{ActionTag: tag.String(), Output: output}
	return st.call("ActionComplete", args, &result)
}
开发者ID:jiasir,项目名称:juju,代码行数:5,代码来源:uniter.go

示例12: ActionByTag

// ActionByTag returns an Action given an ActionTag.
func (st *State) ActionByTag(tag names.ActionTag) (Action, error) {
	return st.Action(tag.Id())
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:4,代码来源:action.go

示例13: actionIdFromTag

// actionIdFromTag converts an ActionTag to an actionId
func actionIdFromTag(tag names.ActionTag) string {
	prefix := actionPrefixFromUnitId(tag.UnitTag().Id())
	return actionId(prefix, tag.Sequence())
}
开发者ID:,项目名称:,代码行数:5,代码来源:


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