This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
accessrule.go
115 lines (97 loc) · 3.55 KB
/
accessrule.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// +build !production
package fakeclient
import "github.com/secrethub/secrethub-go/internals/api"
// AccessRuleService is a mock of the AccessRuleService interface.
type AccessRuleService struct {
Deleter *AccessRuleDeleter
Getter *AccessRuleGetter
Lister *AccessRuleLister
LevelLister *AccessLevelLister
Setter AccessRuleSetter
}
// Delete implements the AccessRuleService interface Delete function.
func (s *AccessRuleService) Delete(path string, accountName string) error {
return s.Deleter.Delete(path, accountName)
}
// Get implements the AccessRuleService interface Get function.
func (s *AccessRuleService) Get(path string, accountName string) (*api.AccessRule, error) {
return s.Getter.Get(path, accountName)
}
// ListLevels implements the AccessRuleService interface ListLevels function.
func (s *AccessRuleService) ListLevels(path string) ([]*api.AccessLevel, error) {
return s.LevelLister.ListLevels(path)
}
// List implements the AccessRuleService interface List function.
func (s *AccessRuleService) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {
return s.Lister.List(path, depth, ancestors)
}
// Set implements the AccessRuleService interface Set function.
func (s *AccessRuleService) Set(path string, permission string, accountName string) (*api.AccessRule, error) {
return s.Setter.Set(path, permission, accountName)
}
// AccessRuleDeleter mocks the Delete function.
type AccessRuleDeleter struct {
ArgPath string
ArgAccountName string
Err error
}
// Delete saves the arguments it was called with and returns the mocked response.
func (d *AccessRuleDeleter) Delete(path string, accountName string) error {
d.ArgPath = path
d.ArgAccountName = accountName
return d.Err
}
// AccessRuleGetter mocks the Get function.
type AccessRuleGetter struct {
ArgPath string
ArgAccountName string
ReturnsAccessRule *api.AccessRule
Err error
}
// Get saves the arguments it was called with and returns the mocked response.
func (g *AccessRuleGetter) Get(path string, accountName string) (*api.AccessRule, error) {
g.ArgPath = path
g.ArgAccountName = accountName
return g.ReturnsAccessRule, g.Err
}
// AccessLevelLister mocks the ListLevels function.
type AccessLevelLister struct {
ArgPath string
ReturnsAccessLevels []*api.AccessLevel
Err error
}
// ListLevels saves the arguments it was called with and returns the mocked response.
func (l *AccessLevelLister) ListLevels(path string) ([]*api.AccessLevel, error) {
l.ArgPath = path
return l.ReturnsAccessLevels, l.Err
}
// AccessRuleSetter mocks the Set function.
type AccessRuleSetter struct {
ArgPath string
ArgPermission string
ArgName string
ReturnsAccessRule *api.AccessRule
Err error
}
// Set saves the arguments it was called with and returns the mocked response.
func (s *AccessRuleSetter) Set(path string, permission string, name string) (*api.AccessRule, error) {
s.ArgPath = path
s.ArgPermission = permission
s.ArgName = name
return s.ReturnsAccessRule, s.Err
}
// AccessRuleLister mocks the List function.
type AccessRuleLister struct {
ArgPath string
ArgDepth int
ArgAncestors bool
ReturnsAccessRules []*api.AccessRule
Err error
}
// List saves the arguments it was called with and returns the mocked response.
func (s *AccessRuleLister) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {
s.ArgPath = path
s.ArgDepth = depth
s.ArgAncestors = ancestors
return s.ReturnsAccessRules, s.Err
}