github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/apifakes/fake_service_key_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeServiceKeyRepository struct { 12 CreateServiceKeyStub func(string, string, map[string]interface{}) error 13 createServiceKeyMutex sync.RWMutex 14 createServiceKeyArgsForCall []struct { 15 arg1 string 16 arg2 string 17 arg3 map[string]interface{} 18 } 19 createServiceKeyReturns struct { 20 result1 error 21 } 22 createServiceKeyReturnsOnCall map[int]struct { 23 result1 error 24 } 25 DeleteServiceKeyStub func(string) error 26 deleteServiceKeyMutex sync.RWMutex 27 deleteServiceKeyArgsForCall []struct { 28 arg1 string 29 } 30 deleteServiceKeyReturns struct { 31 result1 error 32 } 33 deleteServiceKeyReturnsOnCall map[int]struct { 34 result1 error 35 } 36 GetServiceKeyStub func(string, string) (models.ServiceKey, error) 37 getServiceKeyMutex sync.RWMutex 38 getServiceKeyArgsForCall []struct { 39 arg1 string 40 arg2 string 41 } 42 getServiceKeyReturns struct { 43 result1 models.ServiceKey 44 result2 error 45 } 46 getServiceKeyReturnsOnCall map[int]struct { 47 result1 models.ServiceKey 48 result2 error 49 } 50 ListServiceKeysStub func(string) ([]models.ServiceKey, error) 51 listServiceKeysMutex sync.RWMutex 52 listServiceKeysArgsForCall []struct { 53 arg1 string 54 } 55 listServiceKeysReturns struct { 56 result1 []models.ServiceKey 57 result2 error 58 } 59 listServiceKeysReturnsOnCall map[int]struct { 60 result1 []models.ServiceKey 61 result2 error 62 } 63 invocations map[string][][]interface{} 64 invocationsMutex sync.RWMutex 65 } 66 67 func (fake *FakeServiceKeyRepository) CreateServiceKey(arg1 string, arg2 string, arg3 map[string]interface{}) error { 68 fake.createServiceKeyMutex.Lock() 69 ret, specificReturn := fake.createServiceKeyReturnsOnCall[len(fake.createServiceKeyArgsForCall)] 70 fake.createServiceKeyArgsForCall = append(fake.createServiceKeyArgsForCall, struct { 71 arg1 string 72 arg2 string 73 arg3 map[string]interface{} 74 }{arg1, arg2, arg3}) 75 fake.recordInvocation("CreateServiceKey", []interface{}{arg1, arg2, arg3}) 76 fake.createServiceKeyMutex.Unlock() 77 if fake.CreateServiceKeyStub != nil { 78 return fake.CreateServiceKeyStub(arg1, arg2, arg3) 79 } 80 if specificReturn { 81 return ret.result1 82 } 83 fakeReturns := fake.createServiceKeyReturns 84 return fakeReturns.result1 85 } 86 87 func (fake *FakeServiceKeyRepository) CreateServiceKeyCallCount() int { 88 fake.createServiceKeyMutex.RLock() 89 defer fake.createServiceKeyMutex.RUnlock() 90 return len(fake.createServiceKeyArgsForCall) 91 } 92 93 func (fake *FakeServiceKeyRepository) CreateServiceKeyCalls(stub func(string, string, map[string]interface{}) error) { 94 fake.createServiceKeyMutex.Lock() 95 defer fake.createServiceKeyMutex.Unlock() 96 fake.CreateServiceKeyStub = stub 97 } 98 99 func (fake *FakeServiceKeyRepository) CreateServiceKeyArgsForCall(i int) (string, string, map[string]interface{}) { 100 fake.createServiceKeyMutex.RLock() 101 defer fake.createServiceKeyMutex.RUnlock() 102 argsForCall := fake.createServiceKeyArgsForCall[i] 103 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 104 } 105 106 func (fake *FakeServiceKeyRepository) CreateServiceKeyReturns(result1 error) { 107 fake.createServiceKeyMutex.Lock() 108 defer fake.createServiceKeyMutex.Unlock() 109 fake.CreateServiceKeyStub = nil 110 fake.createServiceKeyReturns = struct { 111 result1 error 112 }{result1} 113 } 114 115 func (fake *FakeServiceKeyRepository) CreateServiceKeyReturnsOnCall(i int, result1 error) { 116 fake.createServiceKeyMutex.Lock() 117 defer fake.createServiceKeyMutex.Unlock() 118 fake.CreateServiceKeyStub = nil 119 if fake.createServiceKeyReturnsOnCall == nil { 120 fake.createServiceKeyReturnsOnCall = make(map[int]struct { 121 result1 error 122 }) 123 } 124 fake.createServiceKeyReturnsOnCall[i] = struct { 125 result1 error 126 }{result1} 127 } 128 129 func (fake *FakeServiceKeyRepository) DeleteServiceKey(arg1 string) error { 130 fake.deleteServiceKeyMutex.Lock() 131 ret, specificReturn := fake.deleteServiceKeyReturnsOnCall[len(fake.deleteServiceKeyArgsForCall)] 132 fake.deleteServiceKeyArgsForCall = append(fake.deleteServiceKeyArgsForCall, struct { 133 arg1 string 134 }{arg1}) 135 fake.recordInvocation("DeleteServiceKey", []interface{}{arg1}) 136 fake.deleteServiceKeyMutex.Unlock() 137 if fake.DeleteServiceKeyStub != nil { 138 return fake.DeleteServiceKeyStub(arg1) 139 } 140 if specificReturn { 141 return ret.result1 142 } 143 fakeReturns := fake.deleteServiceKeyReturns 144 return fakeReturns.result1 145 } 146 147 func (fake *FakeServiceKeyRepository) DeleteServiceKeyCallCount() int { 148 fake.deleteServiceKeyMutex.RLock() 149 defer fake.deleteServiceKeyMutex.RUnlock() 150 return len(fake.deleteServiceKeyArgsForCall) 151 } 152 153 func (fake *FakeServiceKeyRepository) DeleteServiceKeyCalls(stub func(string) error) { 154 fake.deleteServiceKeyMutex.Lock() 155 defer fake.deleteServiceKeyMutex.Unlock() 156 fake.DeleteServiceKeyStub = stub 157 } 158 159 func (fake *FakeServiceKeyRepository) DeleteServiceKeyArgsForCall(i int) string { 160 fake.deleteServiceKeyMutex.RLock() 161 defer fake.deleteServiceKeyMutex.RUnlock() 162 argsForCall := fake.deleteServiceKeyArgsForCall[i] 163 return argsForCall.arg1 164 } 165 166 func (fake *FakeServiceKeyRepository) DeleteServiceKeyReturns(result1 error) { 167 fake.deleteServiceKeyMutex.Lock() 168 defer fake.deleteServiceKeyMutex.Unlock() 169 fake.DeleteServiceKeyStub = nil 170 fake.deleteServiceKeyReturns = struct { 171 result1 error 172 }{result1} 173 } 174 175 func (fake *FakeServiceKeyRepository) DeleteServiceKeyReturnsOnCall(i int, result1 error) { 176 fake.deleteServiceKeyMutex.Lock() 177 defer fake.deleteServiceKeyMutex.Unlock() 178 fake.DeleteServiceKeyStub = nil 179 if fake.deleteServiceKeyReturnsOnCall == nil { 180 fake.deleteServiceKeyReturnsOnCall = make(map[int]struct { 181 result1 error 182 }) 183 } 184 fake.deleteServiceKeyReturnsOnCall[i] = struct { 185 result1 error 186 }{result1} 187 } 188 189 func (fake *FakeServiceKeyRepository) GetServiceKey(arg1 string, arg2 string) (models.ServiceKey, error) { 190 fake.getServiceKeyMutex.Lock() 191 ret, specificReturn := fake.getServiceKeyReturnsOnCall[len(fake.getServiceKeyArgsForCall)] 192 fake.getServiceKeyArgsForCall = append(fake.getServiceKeyArgsForCall, struct { 193 arg1 string 194 arg2 string 195 }{arg1, arg2}) 196 fake.recordInvocation("GetServiceKey", []interface{}{arg1, arg2}) 197 fake.getServiceKeyMutex.Unlock() 198 if fake.GetServiceKeyStub != nil { 199 return fake.GetServiceKeyStub(arg1, arg2) 200 } 201 if specificReturn { 202 return ret.result1, ret.result2 203 } 204 fakeReturns := fake.getServiceKeyReturns 205 return fakeReturns.result1, fakeReturns.result2 206 } 207 208 func (fake *FakeServiceKeyRepository) GetServiceKeyCallCount() int { 209 fake.getServiceKeyMutex.RLock() 210 defer fake.getServiceKeyMutex.RUnlock() 211 return len(fake.getServiceKeyArgsForCall) 212 } 213 214 func (fake *FakeServiceKeyRepository) GetServiceKeyCalls(stub func(string, string) (models.ServiceKey, error)) { 215 fake.getServiceKeyMutex.Lock() 216 defer fake.getServiceKeyMutex.Unlock() 217 fake.GetServiceKeyStub = stub 218 } 219 220 func (fake *FakeServiceKeyRepository) GetServiceKeyArgsForCall(i int) (string, string) { 221 fake.getServiceKeyMutex.RLock() 222 defer fake.getServiceKeyMutex.RUnlock() 223 argsForCall := fake.getServiceKeyArgsForCall[i] 224 return argsForCall.arg1, argsForCall.arg2 225 } 226 227 func (fake *FakeServiceKeyRepository) GetServiceKeyReturns(result1 models.ServiceKey, result2 error) { 228 fake.getServiceKeyMutex.Lock() 229 defer fake.getServiceKeyMutex.Unlock() 230 fake.GetServiceKeyStub = nil 231 fake.getServiceKeyReturns = struct { 232 result1 models.ServiceKey 233 result2 error 234 }{result1, result2} 235 } 236 237 func (fake *FakeServiceKeyRepository) GetServiceKeyReturnsOnCall(i int, result1 models.ServiceKey, result2 error) { 238 fake.getServiceKeyMutex.Lock() 239 defer fake.getServiceKeyMutex.Unlock() 240 fake.GetServiceKeyStub = nil 241 if fake.getServiceKeyReturnsOnCall == nil { 242 fake.getServiceKeyReturnsOnCall = make(map[int]struct { 243 result1 models.ServiceKey 244 result2 error 245 }) 246 } 247 fake.getServiceKeyReturnsOnCall[i] = struct { 248 result1 models.ServiceKey 249 result2 error 250 }{result1, result2} 251 } 252 253 func (fake *FakeServiceKeyRepository) ListServiceKeys(arg1 string) ([]models.ServiceKey, error) { 254 fake.listServiceKeysMutex.Lock() 255 ret, specificReturn := fake.listServiceKeysReturnsOnCall[len(fake.listServiceKeysArgsForCall)] 256 fake.listServiceKeysArgsForCall = append(fake.listServiceKeysArgsForCall, struct { 257 arg1 string 258 }{arg1}) 259 fake.recordInvocation("ListServiceKeys", []interface{}{arg1}) 260 fake.listServiceKeysMutex.Unlock() 261 if fake.ListServiceKeysStub != nil { 262 return fake.ListServiceKeysStub(arg1) 263 } 264 if specificReturn { 265 return ret.result1, ret.result2 266 } 267 fakeReturns := fake.listServiceKeysReturns 268 return fakeReturns.result1, fakeReturns.result2 269 } 270 271 func (fake *FakeServiceKeyRepository) ListServiceKeysCallCount() int { 272 fake.listServiceKeysMutex.RLock() 273 defer fake.listServiceKeysMutex.RUnlock() 274 return len(fake.listServiceKeysArgsForCall) 275 } 276 277 func (fake *FakeServiceKeyRepository) ListServiceKeysCalls(stub func(string) ([]models.ServiceKey, error)) { 278 fake.listServiceKeysMutex.Lock() 279 defer fake.listServiceKeysMutex.Unlock() 280 fake.ListServiceKeysStub = stub 281 } 282 283 func (fake *FakeServiceKeyRepository) ListServiceKeysArgsForCall(i int) string { 284 fake.listServiceKeysMutex.RLock() 285 defer fake.listServiceKeysMutex.RUnlock() 286 argsForCall := fake.listServiceKeysArgsForCall[i] 287 return argsForCall.arg1 288 } 289 290 func (fake *FakeServiceKeyRepository) ListServiceKeysReturns(result1 []models.ServiceKey, result2 error) { 291 fake.listServiceKeysMutex.Lock() 292 defer fake.listServiceKeysMutex.Unlock() 293 fake.ListServiceKeysStub = nil 294 fake.listServiceKeysReturns = struct { 295 result1 []models.ServiceKey 296 result2 error 297 }{result1, result2} 298 } 299 300 func (fake *FakeServiceKeyRepository) ListServiceKeysReturnsOnCall(i int, result1 []models.ServiceKey, result2 error) { 301 fake.listServiceKeysMutex.Lock() 302 defer fake.listServiceKeysMutex.Unlock() 303 fake.ListServiceKeysStub = nil 304 if fake.listServiceKeysReturnsOnCall == nil { 305 fake.listServiceKeysReturnsOnCall = make(map[int]struct { 306 result1 []models.ServiceKey 307 result2 error 308 }) 309 } 310 fake.listServiceKeysReturnsOnCall[i] = struct { 311 result1 []models.ServiceKey 312 result2 error 313 }{result1, result2} 314 } 315 316 func (fake *FakeServiceKeyRepository) Invocations() map[string][][]interface{} { 317 fake.invocationsMutex.RLock() 318 defer fake.invocationsMutex.RUnlock() 319 fake.createServiceKeyMutex.RLock() 320 defer fake.createServiceKeyMutex.RUnlock() 321 fake.deleteServiceKeyMutex.RLock() 322 defer fake.deleteServiceKeyMutex.RUnlock() 323 fake.getServiceKeyMutex.RLock() 324 defer fake.getServiceKeyMutex.RUnlock() 325 fake.listServiceKeysMutex.RLock() 326 defer fake.listServiceKeysMutex.RUnlock() 327 copiedInvocations := map[string][][]interface{}{} 328 for key, value := range fake.invocations { 329 copiedInvocations[key] = value 330 } 331 return copiedInvocations 332 } 333 334 func (fake *FakeServiceKeyRepository) recordInvocation(key string, args []interface{}) { 335 fake.invocationsMutex.Lock() 336 defer fake.invocationsMutex.Unlock() 337 if fake.invocations == nil { 338 fake.invocations = map[string][][]interface{}{} 339 } 340 if fake.invocations[key] == nil { 341 fake.invocations[key] = [][]interface{}{} 342 } 343 fake.invocations[key] = append(fake.invocations[key], args) 344 } 345 346 var _ api.ServiceKeyRepository = new(FakeServiceKeyRepository)