本文整理匯總了Golang中github.com/flaviamissi/go-elb/elb.CreateLoadBalancer.Scheme方法的典型用法代碼示例。如果您正苦於以下問題:Golang CreateLoadBalancer.Scheme方法的具體用法?Golang CreateLoadBalancer.Scheme怎麽用?Golang CreateLoadBalancer.Scheme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/flaviamissi/go-elb/elb.CreateLoadBalancer
的用法示例。
在下文中一共展示了CreateLoadBalancer.Scheme方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AddBackend
func (r elbRouter) AddBackend(name string) error {
var err error
options := elb.CreateLoadBalancer{
Name: name,
Listeners: []elb.Listener{
{
InstancePort: 80,
InstanceProtocol: "HTTP",
LoadBalancerPort: 80,
Protocol: "HTTP",
},
},
}
vpc, _ := config.GetBool("juju:elb-use-vpc")
if vpc {
options.Subnets, err = config.GetList("juju:elb-vpc-subnets")
if err != nil {
return err
}
options.SecurityGroups, err = config.GetList("juju:elb-vpc-secgroups")
if err != nil {
return err
}
options.Scheme = "internal"
} else {
options.AvailZones, err = config.GetList("juju:elb-avail-zones")
if err != nil {
return err
}
}
_, err = r.elb().CreateLoadBalancer(&options)
return router.Store(name, name)
}
示例2: Create
// Create creates a new Elastic Load Balancing instance for the given app. The
// name of the instance will be the same as the name of the app.
func (m *ELBManager) Create(app provision.Named) error {
options := elb.CreateLoadBalancer{
Name: app.GetName(),
Listeners: []elb.Listener{
{
InstancePort: 80,
InstanceProtocol: "HTTP",
LoadBalancerPort: 80,
Protocol: "HTTP",
},
},
}
var err error
if m.vpc() {
options.Subnets, err = config.GetList("juju:elb-vpc-subnets")
if err != nil {
log.Fatal(err)
}
options.SecurityGroups, err = config.GetList("juju:elb-vpc-secgroups")
if err != nil {
log.Fatal(err)
}
options.Scheme = "internal"
} else {
options.AvailZones, err = config.GetList("juju:elb-avail-zones")
if err != nil {
log.Fatal(err)
}
}
resp, err := m.elb().CreateLoadBalancer(&options)
if err != nil {
return err
}
lb := loadBalancer{Name: app.GetName(), DNSName: resp.DNSName}
conn, collection := m.collection()
defer conn.Close()
return collection.Insert(lb)
}