本文整理匯總了Golang中github.com/juju/juju/state.Machine.SetAddresses方法的典型用法代碼示例。如果您正苦於以下問題:Golang Machine.SetAddresses方法的具體用法?Golang Machine.SetAddresses怎麽用?Golang Machine.SetAddresses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/juju/juju/state.Machine
的用法示例。
在下文中一共展示了Machine.SetAddresses方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setFakeMachineAddresses
func (s *commonMachineSuite) setFakeMachineAddresses(c *gc.C, machine *state.Machine) {
addrs := []network.Address{
network.NewAddress("0.1.2.3", network.ScopeUnknown),
}
err := machine.SetAddresses(addrs...)
c.Assert(err, gc.IsNil)
// Set the addresses in the environ instance as well so that if the instance poller
// runs it won't overwrite them.
instId, err := machine.InstanceId()
c.Assert(err, gc.IsNil)
insts, err := s.Environ.Instances([]instance.Id{instId})
c.Assert(err, gc.IsNil)
dummy.SetInstanceAddresses(insts[0], addrs)
}
示例2: setAddresses
func (s *SSHCommonSuite) setAddresses(m *state.Machine, c *gc.C) {
addrPub := network.NewAddress(fmt.Sprintf("dummyenv-%s.dns", m.Id()), network.ScopePublic)
addrPriv := network.NewAddress(fmt.Sprintf("dummyenv-%s.internal", m.Id()), network.ScopeCloudLocal)
err := m.SetAddresses(addrPub, addrPriv)
c.Assert(err, gc.IsNil)
}