-
Notifications
You must be signed in to change notification settings - Fork 1
/
policies.go
57 lines (44 loc) · 1.23 KB
/
policies.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
45
46
47
48
49
50
51
52
53
54
55
56
57
package chef
import (
"context"
"github.com/go-chef/chef"
)
type PolicyGroup struct {
chef.PolicyGroup
}
func (s Service) GetPolicies(ctx context.Context) (chef.PoliciesGetResponse, error) {
policies, err := s.client.Policies.List()
if err != nil {
return policies, err
}
return policies, nil
}
func (s Service) GetPolicy(ctx context.Context, name string) (chef.PolicyGetResponse, error) {
policy, err := s.client.Policies.Get(name)
if err != nil {
return policy, err
}
return policy, nil
}
func (s Service) GetPolicyRevision(ctx context.Context, name string, revision string) (chef.RevisionDetailsResponse, error) {
policyRevision, err := s.client.Policies.GetRevisionDetails(name, revision)
if err != nil {
return policyRevision, err
}
return policyRevision, nil
}
func (s Service) GetPolicyGroups(ctx context.Context) (chef.PolicyGroupGetResponse, error) {
policyGroups, err := s.client.PolicyGroups.List()
if err != nil {
return policyGroups, err
}
return policyGroups, nil
}
func (s Service) GetPolicyGroup(ctx context.Context, name string) (PolicyGroup, error) {
policyGroup, err := s.client.PolicyGroups.Get(name)
resp := PolicyGroup{policyGroup}
if err != nil {
return resp, err
}
return resp, nil
}