github.com/kyma-project/kyma-environment-broker@v0.0.1/common/director/fake.go (about)

     1  package director
     2  
     3  import "fmt"
     4  
     5  type FakeClient struct {
     6  	labels map[string]string
     7  }
     8  
     9  func NewFakeClient() *FakeClient {
    10  	return &FakeClient{
    11  		labels: make(map[string]string),
    12  	}
    13  }
    14  
    15  func (f *FakeClient) SetLabel(accountID, runtimeID, key, value string) error {
    16  	f.labels[f.labelKey(accountID, runtimeID, key)] = value
    17  	return nil
    18  }
    19  
    20  func (f *FakeClient) GetLabel(accountID, runtimeID, key string) (string, bool) {
    21  	k := f.labelKey(accountID, runtimeID, key)
    22  	value, found := f.labels[k]
    23  	return value, found
    24  }
    25  
    26  func (f *FakeClient) labelKey(accountID, runtimeID, key string) string {
    27  	return fmt.Sprintf("%s/%s/%s", accountID, runtimeID, key)
    28  }