1
// Copyright 2014 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
7
"github.com/juju/errors"
9
"github.com/juju/juju/network"
10
"github.com/juju/juju/provider/common"
13
// globalFirewallName returns the name to use for the global firewall.
14
func (env *environ) globalFirewallName() string {
15
return common.EnvFullName(env)
18
// OpenPorts opens the given port ranges for the whole environment.
19
// Must only be used if the environment was setup with the
20
// FwGlobal firewall mode.
21
func (env *environ) OpenPorts(ports []network.PortRange) error {
22
err := env.gce.OpenPorts(env.globalFirewallName(), ports...)
23
return errors.Trace(err)
26
// ClosePorts closes the given port ranges for the whole environment.
27
// Must only be used if the environment was setup with the
28
// FwGlobal firewall mode.
29
func (env *environ) ClosePorts(ports []network.PortRange) error {
30
err := env.gce.ClosePorts(env.globalFirewallName(), ports...)
31
return errors.Trace(err)
34
// Ports returns the port ranges opened for the whole environment.
35
// Must only be used if the environment was setup with the
36
// FwGlobal firewall mode.
37
func (env *environ) Ports() ([]network.PortRange, error) {
38
ports, err := env.gce.Ports(env.globalFirewallName())
39
return ports, errors.Trace(err)