forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
staging.go
44 lines (34 loc) · 1.24 KB
/
staging.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 staging
import (
"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
"code.cloudfoundry.org/cli/cf/models"
"code.cloudfoundry.org/cli/cf/net"
. "code.cloudfoundry.org/cli/cf/api/securitygroups/defaults"
)
const urlPath = "/v2/config/staging_security_groups"
//go:generate counterfeiter . SecurityGroupsRepo
type SecurityGroupsRepo interface {
BindToStagingSet(string) error
List() ([]models.SecurityGroupFields, error)
UnbindFromStagingSet(string) error
}
type cloudControllerStagingSecurityGroupRepo struct {
repoBase DefaultSecurityGroupsRepoBase
}
func NewSecurityGroupsRepo(configRepo coreconfig.Reader, gateway net.Gateway) SecurityGroupsRepo {
return &cloudControllerStagingSecurityGroupRepo{
repoBase: DefaultSecurityGroupsRepoBase{
ConfigRepo: configRepo,
Gateway: gateway,
},
}
}
func (repo *cloudControllerStagingSecurityGroupRepo) BindToStagingSet(groupGUID string) error {
return repo.repoBase.Bind(groupGUID, urlPath)
}
func (repo *cloudControllerStagingSecurityGroupRepo) List() ([]models.SecurityGroupFields, error) {
return repo.repoBase.List(urlPath)
}
func (repo *cloudControllerStagingSecurityGroupRepo) UnbindFromStagingSet(groupGUID string) error {
return repo.repoBase.Delete(groupGUID, urlPath)
}