github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/cfnetworkingaction/cfnetworkingactionfakes/fake_networking_client.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package cfnetworkingactionfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cfnetworking-cli-api/cfnetworking/cfnetv1" 8 "code.cloudfoundry.org/cli/actor/cfnetworkingaction" 9 ) 10 11 type FakeNetworkingClient struct { 12 CreatePoliciesStub func([]cfnetv1.Policy) error 13 createPoliciesMutex sync.RWMutex 14 createPoliciesArgsForCall []struct { 15 arg1 []cfnetv1.Policy 16 } 17 createPoliciesReturns struct { 18 result1 error 19 } 20 createPoliciesReturnsOnCall map[int]struct { 21 result1 error 22 } 23 ListPoliciesStub func(...string) ([]cfnetv1.Policy, error) 24 listPoliciesMutex sync.RWMutex 25 listPoliciesArgsForCall []struct { 26 arg1 []string 27 } 28 listPoliciesReturns struct { 29 result1 []cfnetv1.Policy 30 result2 error 31 } 32 listPoliciesReturnsOnCall map[int]struct { 33 result1 []cfnetv1.Policy 34 result2 error 35 } 36 RemovePoliciesStub func([]cfnetv1.Policy) error 37 removePoliciesMutex sync.RWMutex 38 removePoliciesArgsForCall []struct { 39 arg1 []cfnetv1.Policy 40 } 41 removePoliciesReturns struct { 42 result1 error 43 } 44 removePoliciesReturnsOnCall map[int]struct { 45 result1 error 46 } 47 invocations map[string][][]interface{} 48 invocationsMutex sync.RWMutex 49 } 50 51 func (fake *FakeNetworkingClient) CreatePolicies(arg1 []cfnetv1.Policy) error { 52 var arg1Copy []cfnetv1.Policy 53 if arg1 != nil { 54 arg1Copy = make([]cfnetv1.Policy, len(arg1)) 55 copy(arg1Copy, arg1) 56 } 57 fake.createPoliciesMutex.Lock() 58 ret, specificReturn := fake.createPoliciesReturnsOnCall[len(fake.createPoliciesArgsForCall)] 59 fake.createPoliciesArgsForCall = append(fake.createPoliciesArgsForCall, struct { 60 arg1 []cfnetv1.Policy 61 }{arg1Copy}) 62 fake.recordInvocation("CreatePolicies", []interface{}{arg1Copy}) 63 fake.createPoliciesMutex.Unlock() 64 if fake.CreatePoliciesStub != nil { 65 return fake.CreatePoliciesStub(arg1) 66 } 67 if specificReturn { 68 return ret.result1 69 } 70 fakeReturns := fake.createPoliciesReturns 71 return fakeReturns.result1 72 } 73 74 func (fake *FakeNetworkingClient) CreatePoliciesCallCount() int { 75 fake.createPoliciesMutex.RLock() 76 defer fake.createPoliciesMutex.RUnlock() 77 return len(fake.createPoliciesArgsForCall) 78 } 79 80 func (fake *FakeNetworkingClient) CreatePoliciesCalls(stub func([]cfnetv1.Policy) error) { 81 fake.createPoliciesMutex.Lock() 82 defer fake.createPoliciesMutex.Unlock() 83 fake.CreatePoliciesStub = stub 84 } 85 86 func (fake *FakeNetworkingClient) CreatePoliciesArgsForCall(i int) []cfnetv1.Policy { 87 fake.createPoliciesMutex.RLock() 88 defer fake.createPoliciesMutex.RUnlock() 89 argsForCall := fake.createPoliciesArgsForCall[i] 90 return argsForCall.arg1 91 } 92 93 func (fake *FakeNetworkingClient) CreatePoliciesReturns(result1 error) { 94 fake.createPoliciesMutex.Lock() 95 defer fake.createPoliciesMutex.Unlock() 96 fake.CreatePoliciesStub = nil 97 fake.createPoliciesReturns = struct { 98 result1 error 99 }{result1} 100 } 101 102 func (fake *FakeNetworkingClient) CreatePoliciesReturnsOnCall(i int, result1 error) { 103 fake.createPoliciesMutex.Lock() 104 defer fake.createPoliciesMutex.Unlock() 105 fake.CreatePoliciesStub = nil 106 if fake.createPoliciesReturnsOnCall == nil { 107 fake.createPoliciesReturnsOnCall = make(map[int]struct { 108 result1 error 109 }) 110 } 111 fake.createPoliciesReturnsOnCall[i] = struct { 112 result1 error 113 }{result1} 114 } 115 116 func (fake *FakeNetworkingClient) ListPolicies(arg1 ...string) ([]cfnetv1.Policy, error) { 117 fake.listPoliciesMutex.Lock() 118 ret, specificReturn := fake.listPoliciesReturnsOnCall[len(fake.listPoliciesArgsForCall)] 119 fake.listPoliciesArgsForCall = append(fake.listPoliciesArgsForCall, struct { 120 arg1 []string 121 }{arg1}) 122 fake.recordInvocation("ListPolicies", []interface{}{arg1}) 123 fake.listPoliciesMutex.Unlock() 124 if fake.ListPoliciesStub != nil { 125 return fake.ListPoliciesStub(arg1...) 126 } 127 if specificReturn { 128 return ret.result1, ret.result2 129 } 130 fakeReturns := fake.listPoliciesReturns 131 return fakeReturns.result1, fakeReturns.result2 132 } 133 134 func (fake *FakeNetworkingClient) ListPoliciesCallCount() int { 135 fake.listPoliciesMutex.RLock() 136 defer fake.listPoliciesMutex.RUnlock() 137 return len(fake.listPoliciesArgsForCall) 138 } 139 140 func (fake *FakeNetworkingClient) ListPoliciesCalls(stub func(...string) ([]cfnetv1.Policy, error)) { 141 fake.listPoliciesMutex.Lock() 142 defer fake.listPoliciesMutex.Unlock() 143 fake.ListPoliciesStub = stub 144 } 145 146 func (fake *FakeNetworkingClient) ListPoliciesArgsForCall(i int) []string { 147 fake.listPoliciesMutex.RLock() 148 defer fake.listPoliciesMutex.RUnlock() 149 argsForCall := fake.listPoliciesArgsForCall[i] 150 return argsForCall.arg1 151 } 152 153 func (fake *FakeNetworkingClient) ListPoliciesReturns(result1 []cfnetv1.Policy, result2 error) { 154 fake.listPoliciesMutex.Lock() 155 defer fake.listPoliciesMutex.Unlock() 156 fake.ListPoliciesStub = nil 157 fake.listPoliciesReturns = struct { 158 result1 []cfnetv1.Policy 159 result2 error 160 }{result1, result2} 161 } 162 163 func (fake *FakeNetworkingClient) ListPoliciesReturnsOnCall(i int, result1 []cfnetv1.Policy, result2 error) { 164 fake.listPoliciesMutex.Lock() 165 defer fake.listPoliciesMutex.Unlock() 166 fake.ListPoliciesStub = nil 167 if fake.listPoliciesReturnsOnCall == nil { 168 fake.listPoliciesReturnsOnCall = make(map[int]struct { 169 result1 []cfnetv1.Policy 170 result2 error 171 }) 172 } 173 fake.listPoliciesReturnsOnCall[i] = struct { 174 result1 []cfnetv1.Policy 175 result2 error 176 }{result1, result2} 177 } 178 179 func (fake *FakeNetworkingClient) RemovePolicies(arg1 []cfnetv1.Policy) error { 180 var arg1Copy []cfnetv1.Policy 181 if arg1 != nil { 182 arg1Copy = make([]cfnetv1.Policy, len(arg1)) 183 copy(arg1Copy, arg1) 184 } 185 fake.removePoliciesMutex.Lock() 186 ret, specificReturn := fake.removePoliciesReturnsOnCall[len(fake.removePoliciesArgsForCall)] 187 fake.removePoliciesArgsForCall = append(fake.removePoliciesArgsForCall, struct { 188 arg1 []cfnetv1.Policy 189 }{arg1Copy}) 190 fake.recordInvocation("RemovePolicies", []interface{}{arg1Copy}) 191 fake.removePoliciesMutex.Unlock() 192 if fake.RemovePoliciesStub != nil { 193 return fake.RemovePoliciesStub(arg1) 194 } 195 if specificReturn { 196 return ret.result1 197 } 198 fakeReturns := fake.removePoliciesReturns 199 return fakeReturns.result1 200 } 201 202 func (fake *FakeNetworkingClient) RemovePoliciesCallCount() int { 203 fake.removePoliciesMutex.RLock() 204 defer fake.removePoliciesMutex.RUnlock() 205 return len(fake.removePoliciesArgsForCall) 206 } 207 208 func (fake *FakeNetworkingClient) RemovePoliciesCalls(stub func([]cfnetv1.Policy) error) { 209 fake.removePoliciesMutex.Lock() 210 defer fake.removePoliciesMutex.Unlock() 211 fake.RemovePoliciesStub = stub 212 } 213 214 func (fake *FakeNetworkingClient) RemovePoliciesArgsForCall(i int) []cfnetv1.Policy { 215 fake.removePoliciesMutex.RLock() 216 defer fake.removePoliciesMutex.RUnlock() 217 argsForCall := fake.removePoliciesArgsForCall[i] 218 return argsForCall.arg1 219 } 220 221 func (fake *FakeNetworkingClient) RemovePoliciesReturns(result1 error) { 222 fake.removePoliciesMutex.Lock() 223 defer fake.removePoliciesMutex.Unlock() 224 fake.RemovePoliciesStub = nil 225 fake.removePoliciesReturns = struct { 226 result1 error 227 }{result1} 228 } 229 230 func (fake *FakeNetworkingClient) RemovePoliciesReturnsOnCall(i int, result1 error) { 231 fake.removePoliciesMutex.Lock() 232 defer fake.removePoliciesMutex.Unlock() 233 fake.RemovePoliciesStub = nil 234 if fake.removePoliciesReturnsOnCall == nil { 235 fake.removePoliciesReturnsOnCall = make(map[int]struct { 236 result1 error 237 }) 238 } 239 fake.removePoliciesReturnsOnCall[i] = struct { 240 result1 error 241 }{result1} 242 } 243 244 func (fake *FakeNetworkingClient) Invocations() map[string][][]interface{} { 245 fake.invocationsMutex.RLock() 246 defer fake.invocationsMutex.RUnlock() 247 fake.createPoliciesMutex.RLock() 248 defer fake.createPoliciesMutex.RUnlock() 249 fake.listPoliciesMutex.RLock() 250 defer fake.listPoliciesMutex.RUnlock() 251 fake.removePoliciesMutex.RLock() 252 defer fake.removePoliciesMutex.RUnlock() 253 copiedInvocations := map[string][][]interface{}{} 254 for key, value := range fake.invocations { 255 copiedInvocations[key] = value 256 } 257 return copiedInvocations 258 } 259 260 func (fake *FakeNetworkingClient) recordInvocation(key string, args []interface{}) { 261 fake.invocationsMutex.Lock() 262 defer fake.invocationsMutex.Unlock() 263 if fake.invocations == nil { 264 fake.invocations = map[string][][]interface{}{} 265 } 266 if fake.invocations[key] == nil { 267 fake.invocations[key] = [][]interface{}{} 268 } 269 fake.invocations[key] = append(fake.invocations[key], args) 270 } 271 272 var _ cfnetworkingaction.NetworkingClient = new(FakeNetworkingClient)