github.com/rakutentech/cli@v6.12.5-0.20151006231303-24468b65536e+incompatible/cf/api/fakes/fake_service_key_repo.go (about) 1 package fakes 2 3 import ( 4 "github.com/cloudfoundry/cli/cf/models" 5 ) 6 7 type FakeServiceKeyRepo struct { 8 CreateServiceKeyMethod CreateServiceKeyType 9 ListServiceKeysMethod ListServiceKeysType 10 GetServiceKeyMethod GetServiceKeyType 11 DeleteServiceKeyMethod DeleteServiceKeyType 12 } 13 14 type CreateServiceKeyType struct { 15 InstanceGuid string 16 KeyName string 17 Params map[string]interface{} 18 19 Error error 20 } 21 22 type ListServiceKeysType struct { 23 InstanceGuid string 24 25 ServiceKeys []models.ServiceKey 26 Error error 27 } 28 29 type GetServiceKeyType struct { 30 InstanceGuid string 31 KeyName string 32 33 ServiceKey models.ServiceKey 34 Error error 35 } 36 37 type DeleteServiceKeyType struct { 38 Guid string 39 40 Error error 41 } 42 43 func NewFakeServiceKeyRepo() *FakeServiceKeyRepo { 44 return &FakeServiceKeyRepo{ 45 CreateServiceKeyMethod: CreateServiceKeyType{}, 46 ListServiceKeysMethod: ListServiceKeysType{}, 47 GetServiceKeyMethod: GetServiceKeyType{}, 48 DeleteServiceKeyMethod: DeleteServiceKeyType{}, 49 } 50 } 51 52 func (f *FakeServiceKeyRepo) CreateServiceKey(instanceGuid string, serviceKeyName string, params map[string]interface{}) error { 53 f.CreateServiceKeyMethod.InstanceGuid = instanceGuid 54 f.CreateServiceKeyMethod.KeyName = serviceKeyName 55 f.CreateServiceKeyMethod.Params = params 56 57 return f.CreateServiceKeyMethod.Error 58 } 59 60 func (f *FakeServiceKeyRepo) ListServiceKeys(instanceGuid string) ([]models.ServiceKey, error) { 61 f.ListServiceKeysMethod.InstanceGuid = instanceGuid 62 63 return f.ListServiceKeysMethod.ServiceKeys, f.ListServiceKeysMethod.Error 64 } 65 66 func (f *FakeServiceKeyRepo) GetServiceKey(instanceGuid string, serviceKeyName string) (models.ServiceKey, error) { 67 f.GetServiceKeyMethod.InstanceGuid = instanceGuid 68 69 return f.GetServiceKeyMethod.ServiceKey, f.GetServiceKeyMethod.Error 70 } 71 72 func (f *FakeServiceKeyRepo) DeleteServiceKey(serviceKeyGuid string) error { 73 f.DeleteServiceKeyMethod.Guid = serviceKeyGuid 74 75 return f.DeleteServiceKeyMethod.Error 76 }