-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunning.go
44 lines (34 loc) · 1.27 KB
/
running.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package running
import (
"github.com/cloudfoundry/cli/cf/configuration/coreconfig"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/net"
. "github.com/cloudfoundry/cli/cf/api/securitygroups/defaults"
)
const urlPath = "/v2/config/running_security_groups"
//go:generate counterfeiter . RunningSecurityGroupsRepo
type RunningSecurityGroupsRepo interface {
BindToRunningSet(string) error
List() ([]models.SecurityGroupFields, error)
UnbindFromRunningSet(string) error
}
type cloudControllerRunningSecurityGroupRepo struct {
repoBase DefaultSecurityGroupsRepoBase
}
func NewRunningSecurityGroupsRepo(configRepo coreconfig.Reader, gateway net.Gateway) RunningSecurityGroupsRepo {
return &cloudControllerRunningSecurityGroupRepo{
repoBase: DefaultSecurityGroupsRepoBase{
ConfigRepo: configRepo,
Gateway: gateway,
},
}
}
func (repo *cloudControllerRunningSecurityGroupRepo) BindToRunningSet(groupGUID string) error {
return repo.repoBase.Bind(groupGUID, urlPath)
}
func (repo *cloudControllerRunningSecurityGroupRepo) List() ([]models.SecurityGroupFields, error) {
return repo.repoBase.List(urlPath)
}
func (repo *cloudControllerRunningSecurityGroupRepo) UnbindFromRunningSet(groupGUID string) error {
return repo.repoBase.Delete(groupGUID, urlPath)
}