forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
staging.go
42 lines (33 loc) · 1.21 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
package staging
import (
"github.com/cloudfoundry/cli/cf/configuration"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/net"
. "github.com/cloudfoundry/cli/cf/api/security_groups/defaults"
)
const urlPath = "/v2/config/staging_security_groups"
type StagingSecurityGroupsRepo interface {
BindToStagingSet(string) error
List() ([]models.SecurityGroupFields, error)
UnbindFromStagingSet(string) error
}
type cloudControllerStagingSecurityGroupRepo struct {
repoBase DefaultSecurityGroupsRepoBase
}
func NewStagingSecurityGroupsRepo(configRepo configuration.Reader, gateway net.Gateway) StagingSecurityGroupsRepo {
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)
}