github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/old_fake_service_key_repo.go (about)

     1  package apifakes
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/cf/models"
     5  )
     6  
     7  type OldFakeServiceKeyRepo 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() *OldFakeServiceKeyRepo {
    44  	return &OldFakeServiceKeyRepo{
    45  		CreateServiceKeyMethod: CreateServiceKeyType{},
    46  		ListServiceKeysMethod:  ListServiceKeysType{},
    47  		GetServiceKeyMethod:    GetServiceKeyType{},
    48  		DeleteServiceKeyMethod: DeleteServiceKeyType{},
    49  	}
    50  }
    51  
    52  func (f *OldFakeServiceKeyRepo) 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 *OldFakeServiceKeyRepo) 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 *OldFakeServiceKeyRepo) 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 *OldFakeServiceKeyRepo) DeleteServiceKey(serviceKeyGUID string) error {
    73  	f.DeleteServiceKeyMethod.GUID = serviceKeyGUID
    74  
    75  	return f.DeleteServiceKeyMethod.Error
    76  }