• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang params.ErrorResults类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Remove

// Remove removes the unit from state, calling EnsureDead first, then Remove.
// It will fail if the unit is not present.
func (u *Unit) Remove() error {
	var result params.ErrorResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: u.tag}},
	}
	err := u.st.call("Remove", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:13,代码来源:unit.go


示例2: DestroyAllSubordinates

// DestroyAllSubordinates destroys all subordinates of the unit.
func (u *Unit) DestroyAllSubordinates() error {
	var result params.ErrorResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: u.tag}},
	}
	err := u.st.call("DestroyAllSubordinates", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:12,代码来源:unit.go


示例3: EnsureDead

// EnsureDead sets the machine lifecycle to Dead if it is Alive or
// Dying. It does nothing otherwise.
func (m *Machine) EnsureDead() error {
	var result params.ErrorResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: m.tag}},
	}
	err := m.st.call("EnsureDead", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:13,代码来源:machine.go


示例4: SetPassword

// SetPassword sets the unit's password.
func (u *Unit) SetPassword(password string) error {
	var result params.ErrorResults
	args := params.EntityPasswords{
		Changes: []params.EntityPassword{
			{Tag: u.tag, Password: password},
		},
	}
	err := u.st.call("SetPasswords", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:14,代码来源:unit.go


示例5: SetStatus

// SetStatus sets the status of the unit.
func (u *Unit) SetStatus(status params.Status, info string, data params.StatusData) error {
	var result params.ErrorResults
	args := params.SetStatus{
		Entities: []params.EntityStatus{
			{Tag: u.tag, Status: status, Info: info, Data: data},
		},
	}
	err := u.st.call("SetStatus", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:14,代码来源:unit.go


示例6: ClosePort

// ClosePort sets the policy of the port with protocol and number to
// be closed.
//
// TODO: We should really be opening and closing ports on machines,
// rather than units.
func (u *Unit) ClosePort(protocol string, number int) error {
	var result params.ErrorResults
	args := params.EntitiesPorts{
		Entities: []params.EntityPort{
			{Tag: u.tag, Protocol: protocol, Port: number},
		},
	}
	err := u.st.call("ClosePort", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:18,代码来源:unit.go


示例7: SetMachineAddresses

// SetMachineAddresses sets the machine determined addresses of the machine.
func (m *Machine) SetMachineAddresses(addresses []instance.Address) error {
	var result params.ErrorResults
	args := params.SetMachinesAddresses{
		MachineAddresses: []params.MachineAddresses{
			{Tag: m.Tag(), Addresses: addresses},
		},
	}
	err := m.st.call("SetMachineAddresses", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:14,代码来源:machine.go


示例8: LeaveScope

// LeaveScope signals that the unit has left its scope in the relation.
// After the unit has left its relation scope, it is no longer a member
// of the relation; if the relation is dying when its last member unit
// leaves, it is removed immediately. It is not an error to leave a scope
// that the unit is not, or never was, a member of.
func (ru *RelationUnit) LeaveScope() error {
	var result params.ErrorResults
	args := params.RelationUnits{
		RelationUnits: []params.RelationUnit{{
			Relation: ru.relation.tag,
			Unit:     ru.unit.tag,
		}},
	}
	err := ru.st.call("LeaveScope", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:19,代码来源:relationunit.go


示例9: SetPassword

// SetPassword sets the password associated with the agent's entity.
func (m *Entity) SetPassword(password string) error {
	var results params.ErrorResults
	args := params.EntityPasswords{
		Changes: []params.EntityPassword{{
			Tag:      m.tag,
			Password: password,
		}},
	}
	err := m.st.caller.Call("Agent", "", "SetPasswords", args, &results)
	if err != nil {
		return err
	}
	return results.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:15,代码来源:state.go


示例10: SetCharmURL

// SetCharmURL marks the unit as currently using the supplied charm URL.
// An error will be returned if the unit is dead, or the charm URL not known.
func (u *Unit) SetCharmURL(curl *charm.URL) error {
	if curl == nil {
		return fmt.Errorf("charm URL cannot be nil")
	}
	var result params.ErrorResults
	args := params.EntitiesCharmURL{
		Entities: []params.EntityCharmURL{
			{Tag: u.tag, CharmURL: curl.String()},
		},
	}
	err := u.st.call("SetCharmURL", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:18,代码来源:unit.go


示例11: SetInstanceInfo

// SetInstanceInfo sets the provider specific instance id, nonce,
// metadata, networks and interfaces for this machine. Once set, the
// instance id cannot be changed.
func (m *Machine) SetInstanceInfo(
	id instance.Id, nonce string, characteristics *instance.HardwareCharacteristics,
	networks []params.Network, interfaces []params.NetworkInterface,
) error {
	var result params.ErrorResults
	args := params.InstancesInfo{
		Machines: []params.InstanceInfo{{
			Tag:             m.tag,
			InstanceId:      id,
			Nonce:           nonce,
			Characteristics: characteristics,
			Networks:        networks,
			Interfaces:      interfaces,
		}},
	}
	err := m.st.call("SetInstanceInfo", args, &result)
	if err != nil {
		return err
	}
	return result.OneError()
}
开发者ID:jkary,项目名称:core,代码行数:24,代码来源:machine.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang common.Authorizer类代码示例发布时间:2022-05-23
下一篇:
Golang api.State类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap