From 28ded186e376f43eadde63364e87b1d883d23909 Mon Sep 17 00:00:00 2001 From: Maciej Winnicki Date: Mon, 25 Jun 2018 17:33:09 +0200 Subject: [PATCH] Cleanup Services interfaces (#469) --- .gitignore | 2 +- event/service.go | 4 ++-- function/service.go | 6 +++--- httpapi/httpapi.go | 10 +++++----- httpapi/httpapi_test.go | 20 +++++++++---------- libkv/cors.go | 4 ++-- libkv/cors_test.go | 8 ++++---- libkv/eventtype.go | 6 +++--- libkv/eventtype_test.go | 8 ++++---- libkv/function.go | 10 +++++----- libkv/function_test.go | 14 ++++++------- libkv/subscription.go | 4 ++-- libkv/subscription_test.go | 6 +++--- mock/cors.go | 12 ++++++------ mock/eventtype.go | 12 ++++++------ mock/function.go | 38 ++++++++++++++++++------------------ mock/subscription.go | 12 ++++++------ subscription/cors/service.go | 4 ++-- subscription/service.go | 4 ++-- 19 files changed, 92 insertions(+), 92 deletions(-) diff --git a/.gitignore b/.gitignore index dd5987f..b21b3dc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ vendor *.swp *.swo *.db -default.etcd/ +default.etcd* coverage.txt profile.out tests/testing.etcd* diff --git a/event/service.go b/event/service.go index 888f50b..77e19c2 100644 --- a/event/service.go +++ b/event/service.go @@ -2,9 +2,9 @@ package event // Service represents service for managing event types. type Service interface { - CreateEventType(eventType *Type) (*Type, error) GetEventType(space string, name TypeName) (*Type, error) - GetEventTypes(space string) (Types, error) + ListEventTypes(space string) (Types, error) + CreateEventType(eventType *Type) (*Type, error) UpdateEventType(newEventType *Type) (*Type, error) DeleteEventType(space string, name TypeName) error } diff --git a/function/service.go b/function/service.go index ac59125..da8224c 100644 --- a/function/service.go +++ b/function/service.go @@ -2,9 +2,9 @@ package function // Service represents service for managing functions. type Service interface { - RegisterFunction(fn *Function) (*Function, error) - UpdateFunction(fn *Function) (*Function, error) GetFunction(space string, id ID) (*Function, error) - GetFunctions(space string) (Functions, error) + ListFunctions(space string) (Functions, error) + CreateFunction(fn *Function) (*Function, error) + UpdateFunction(fn *Function) (*Function, error) DeleteFunction(space string, id ID) error } diff --git a/httpapi/httpapi.go b/httpapi/httpapi.go index f0d211f..1e0ad91 100644 --- a/httpapi/httpapi.go +++ b/httpapi/httpapi.go @@ -97,7 +97,7 @@ func (h HTTPAPI) listEventTypes(w http.ResponseWriter, r *http.Request, params h encoder := json.NewEncoder(w) space := params.ByName("space") - types, err := h.EventTypes.GetEventTypes(space) + types, err := h.EventTypes.ListEventTypes(space) if err != nil { w.WriteHeader(http.StatusInternalServerError) encoder.Encode(&Response{Errors: []Error{{Message: err.Error()}}}) @@ -232,7 +232,7 @@ func (h HTTPAPI) listFunctions(w http.ResponseWriter, r *http.Request, params ht encoder := json.NewEncoder(w) space := params.ByName("space") - fns, err := h.Functions.GetFunctions(space) + fns, err := h.Functions.ListFunctions(space) if err != nil { w.WriteHeader(http.StatusInternalServerError) encoder.Encode(&Response{Errors: []Error{{Message: err.Error()}}}) @@ -258,7 +258,7 @@ func (h HTTPAPI) createFunction(w http.ResponseWriter, r *http.Request, params h } fn.Space = params.ByName("space") - output, err := h.Functions.RegisterFunction(fn) + output, err := h.Functions.CreateFunction(fn) if err != nil { if _, ok := err.(*function.ErrFunctionValidation); ok { w.WriteHeader(http.StatusBadRequest) @@ -343,7 +343,7 @@ func (h HTTPAPI) listSubscriptions(w http.ResponseWriter, r *http.Request, param encoder := json.NewEncoder(w) space := params.ByName("space") - subs, err := h.Subscriptions.GetSubscriptions(space) + subs, err := h.Subscriptions.ListSubscriptions(space) if err != nil { w.WriteHeader(http.StatusInternalServerError) encoder.Encode(&Response{Errors: []Error{{Message: err.Error()}}}) @@ -484,7 +484,7 @@ func (h HTTPAPI) listCORS(w http.ResponseWriter, r *http.Request, params httprou encoder := json.NewEncoder(w) space := params.ByName("space") - configs, err := h.CORSes.GetCORSes(space) + configs, err := h.CORSes.ListCORS(space) if err != nil { w.WriteHeader(http.StatusInternalServerError) encoder.Encode(&Response{Errors: []Error{{Message: err.Error()}}}) diff --git a/httpapi/httpapi_test.go b/httpapi/httpapi_test.go index ea63d21..63620dd 100644 --- a/httpapi/httpapi_test.go +++ b/httpapi/httpapi_test.go @@ -76,7 +76,7 @@ func TestGetEventTypes(t *testing.T) { Space: "default", Name: event.TypeName("test.event"), }} - eventTypes.EXPECT().GetEventTypes("default").Return(returnedList, nil) + eventTypes.EXPECT().ListEventTypes("default").Return(returnedList, nil) resp := request(router, http.MethodGet, "/v1/spaces/default/eventtypes", nil) @@ -88,7 +88,7 @@ func TestGetEventTypes(t *testing.T) { }) t.Run("internal error", func(t *testing.T) { - eventTypes.EXPECT().GetEventTypes(gomock.Any()).Return(nil, errors.New("processing failed")) + eventTypes.EXPECT().ListEventTypes(gomock.Any()).Return(nil, errors.New("processing failed")) resp := request(router, http.MethodGet, "/v1/spaces/default/eventtypes", nil) @@ -356,7 +356,7 @@ func TestGetFunctions(t *testing.T) { ProviderType: httpprovider.Type, Provider: &httpprovider.HTTP{}, }} - functions.EXPECT().GetFunctions("default").Return(returnedList, nil) + functions.EXPECT().ListFunctions("default").Return(returnedList, nil) resp := request(router, http.MethodGet, "/v1/spaces/default/functions", nil) @@ -368,7 +368,7 @@ func TestGetFunctions(t *testing.T) { }) t.Run("internal error", func(t *testing.T) { - functions.EXPECT().GetFunctions(gomock.Any()).Return(nil, errors.New("processing failed")) + functions.EXPECT().ListFunctions(gomock.Any()).Return(nil, errors.New("processing failed")) resp := request(router, http.MethodGet, "/v1/spaces/default/functions", nil) @@ -395,7 +395,7 @@ func TestRegisterFunction(t *testing.T) { URL: "http://example.com", }, } - functions.EXPECT().RegisterFunction(fn).Return(fn, nil) + functions.EXPECT().CreateFunction(fn).Return(fn, nil) resp := request(router, http.MethodPost, "/v1/spaces/test1/functions", fnPayload) @@ -408,7 +408,7 @@ func TestRegisterFunction(t *testing.T) { }) t.Run("function already exists", func(t *testing.T) { - functions.EXPECT().RegisterFunction(gomock.Any()). + functions.EXPECT().CreateFunction(gomock.Any()). Return(nil, &function.ErrFunctionAlreadyRegistered{ID: function.ID("func1")}) resp := request(router, http.MethodPost, "/v1/spaces/default/functions", fnPayload) @@ -420,7 +420,7 @@ func TestRegisterFunction(t *testing.T) { }) t.Run("validation error", func(t *testing.T) { - functions.EXPECT().RegisterFunction(gomock.Any()). + functions.EXPECT().CreateFunction(gomock.Any()). Return(nil, &function.ErrFunctionValidation{Message: "wrong function ID format"}) payload := []byte(`{"functionID":"/","type":"http","provider":{"url":"http://test.com"}}}`) @@ -442,7 +442,7 @@ func TestRegisterFunction(t *testing.T) { }) t.Run("internal error", func(t *testing.T) { - functions.EXPECT().RegisterFunction(gomock.Any()).Return(nil, errors.New("processing error")) + functions.EXPECT().CreateFunction(gomock.Any()).Return(nil, errors.New("processing error")) resp := request(router, http.MethodPost, "/v1/spaces/default/functions", fnPayload) @@ -693,7 +693,7 @@ func TestGetCORSes(t *testing.T) { Space: "default", ID: cors.ID("GET%2Fhello"), }} - corses.EXPECT().GetCORSes("default").Return(returnedList, nil) + corses.EXPECT().ListCORS("default").Return(returnedList, nil) resp := request(router, http.MethodGet, "/v1/spaces/default/cors", nil) @@ -705,7 +705,7 @@ func TestGetCORSes(t *testing.T) { }) t.Run("internal error", func(t *testing.T) { - corses.EXPECT().GetCORSes(gomock.Any()).Return(nil, errors.New("processing failed")) + corses.EXPECT().ListCORS(gomock.Any()).Return(nil, errors.New("processing failed")) resp := request(router, http.MethodGet, "/v1/spaces/default/cors", nil) diff --git a/libkv/cors.go b/libkv/cors.go index 40e81f9..97deb40 100644 --- a/libkv/cors.go +++ b/libkv/cors.go @@ -70,8 +70,8 @@ func (service Service) GetCORS(space string, id cors.ID) (*cors.CORS, error) { return &config, nil } -// GetCORSes returns an array of all CORS configuration in the space. -func (service Service) GetCORSes(space string) (cors.CORSes, error) { +// ListCORS returns an array of all CORS configuration in the space. +func (service Service) ListCORS(space string) (cors.CORSes, error) { configs := []*cors.CORS{} kvs, err := service.CORSStore.List(spacePath(space), &store.ReadOptions{Consistent: true}) diff --git a/libkv/cors_test.go b/libkv/cors_test.go index 186605d..63f7a95 100644 --- a/libkv/cors_test.go +++ b/libkv/cors_test.go @@ -150,7 +150,7 @@ func TestGetCORS(t *testing.T) { }) } -func TestGetCORSes(t *testing.T) { +func TestListCORS(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -163,7 +163,7 @@ func TestGetCORSes(t *testing.T) { db.EXPECT().List("default/", &store.ReadOptions{Consistent: true}).Return(kvs, nil) service := &Service{CORSStore: db, Log: zap.NewNop()} - list, err := service.GetCORSes("default") + list, err := service.ListCORS("default") assert.Nil(t, err) assert.Equal(t, cors.CORSes{testConfig}, list) @@ -174,7 +174,7 @@ func TestGetCORSes(t *testing.T) { db.EXPECT().List(gomock.Any(), gomock.Any()).Return([]*store.KVPair{}, errors.New("KV list err")) service := &Service{CORSStore: db, Log: zap.NewNop()} - _, err := service.GetCORSes("default") + _, err := service.ListCORS("default") assert.EqualError(t, err, "KV list err") }) @@ -184,7 +184,7 @@ func TestGetCORSes(t *testing.T) { db.EXPECT().List(gomock.Any(), gomock.Any()).Return([]*store.KVPair{}, errors.New("Key not found in store")) service := &Service{CORSStore: db, Log: zap.NewNop()} - list, _ := service.GetCORSes("default") + list, _ := service.ListCORS("default") assert.Equal(t, cors.CORSes{}, list) }) diff --git a/libkv/eventtype.go b/libkv/eventtype.go index 229ed28..c927d5a 100644 --- a/libkv/eventtype.go +++ b/libkv/eventtype.go @@ -74,8 +74,8 @@ func (service Service) GetEventType(space string, name event.TypeName) (*event.T return &eventType, nil } -// GetEventTypes returns an array of all event types in the space. -func (service Service) GetEventTypes(space string) (event.Types, error) { +// ListEventTypes returns an array of all event types in the space. +func (service Service) ListEventTypes(space string) (event.Types, error) { types := []*event.Type{} kvs, err := service.EventTypeStore.List(spacePath(space), &store.ReadOptions{Consistent: true}) @@ -132,7 +132,7 @@ func (service Service) UpdateEventType(newEventType *event.Type) (*event.Type, e // DeleteEventType deletes event type from the configuration. func (service Service) DeleteEventType(space string, name event.TypeName) error { - subs, err := service.GetSubscriptions(space) + subs, err := service.ListSubscriptions(space) if err != nil { return err } diff --git a/libkv/eventtype_test.go b/libkv/eventtype_test.go index 03b3e82..a6715e0 100644 --- a/libkv/eventtype_test.go +++ b/libkv/eventtype_test.go @@ -121,7 +121,7 @@ func TestGetEventType(t *testing.T) { }) } -func TestGetEventTypes(t *testing.T) { +func TestListEventTypes(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -134,7 +134,7 @@ func TestGetEventTypes(t *testing.T) { db.EXPECT().List("default/", &store.ReadOptions{Consistent: true}).Return(kvs, nil) service := &Service{EventTypeStore: db, Log: zap.NewNop()} - list, err := service.GetEventTypes("default") + list, err := service.ListEventTypes("default") assert.Nil(t, err) assert.Equal(t, event.Types{testEventType}, list) @@ -145,7 +145,7 @@ func TestGetEventTypes(t *testing.T) { db.EXPECT().List(gomock.Any(), gomock.Any()).Return([]*store.KVPair{}, errors.New("KV list err")) service := &Service{EventTypeStore: db, Log: zap.NewNop()} - _, err := service.GetEventTypes("default") + _, err := service.ListEventTypes("default") assert.EqualError(t, err, "KV list err") }) @@ -155,7 +155,7 @@ func TestGetEventTypes(t *testing.T) { db.EXPECT().List(gomock.Any(), gomock.Any()).Return([]*store.KVPair{}, errors.New("Key not found in store")) service := &Service{EventTypeStore: db, Log: zap.NewNop()} - list, _ := service.GetEventTypes("default") + list, _ := service.ListEventTypes("default") assert.Equal(t, event.Types{}, list) }) diff --git a/libkv/function.go b/libkv/function.go index 4479b1a..270fe49 100644 --- a/libkv/function.go +++ b/libkv/function.go @@ -23,8 +23,8 @@ func (key FunctionKey) String() string { return key.Space + "/" + string(key.ID) } -// RegisterFunction registers function in configuration. -func (service Service) RegisterFunction(fn *function.Function) (*function.Function, error) { +// CreateFunction registers function in configuration. +func (service Service) CreateFunction(fn *function.Function) (*function.Function, error) { if err := validateFunction(fn); err != nil { return nil, err } @@ -94,8 +94,8 @@ func (service Service) GetFunction(space string, id function.ID) (*function.Func return &fn, nil } -// GetFunctions returns an array of all functions in the space. -func (service Service) GetFunctions(space string) (function.Functions, error) { +// ListFunctions returns an array of all functions in the space. +func (service Service) ListFunctions(space string) (function.Functions, error) { fns := []*function.Function{} kvs, err := service.FunctionStore.List(spacePath(space), &store.ReadOptions{Consistent: true}) @@ -119,7 +119,7 @@ func (service Service) GetFunctions(space string) (function.Functions, error) { // DeleteFunction deletes function from the registry. func (service Service) DeleteFunction(space string, id function.ID) error { - subs, err := service.GetSubscriptions(space) + subs, err := service.ListSubscriptions(space) if err != nil { return err } diff --git a/libkv/function_test.go b/libkv/function_test.go index 5663849..aeb4bac 100644 --- a/libkv/function_test.go +++ b/libkv/function_test.go @@ -15,7 +15,7 @@ import ( _ "github.com/serverless/event-gateway/providers/http" ) -func TestRegisterFunction(t *testing.T) { +func TestCreateFunction(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -32,7 +32,7 @@ func TestRegisterFunction(t *testing.T) { db.EXPECT().AtomicPut("default/testid", payload, nil, nil).Return(true, nil, nil) service := &Service{FunctionStore: db, Log: zap.NewNop()} - _, err := service.RegisterFunction(fn) + _, err := service.CreateFunction(fn) assert.Nil(t, err) }) @@ -42,7 +42,7 @@ func TestRegisterFunction(t *testing.T) { db.EXPECT().Get("default/testid", gomock.Any()).Return(nil, nil) service := &Service{FunctionStore: db, Log: zap.NewNop()} - _, err := service.RegisterFunction(fn) + _, err := service.CreateFunction(fn) assert.Equal(t, err, &function.ErrFunctionAlreadyRegistered{ID: "testid"}) }) @@ -53,7 +53,7 @@ func TestRegisterFunction(t *testing.T) { db.EXPECT().AtomicPut(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(false, nil, errors.New("KV put error")) service := &Service{FunctionStore: db, Log: zap.NewNop()} - _, err := service.RegisterFunction(fn) + _, err := service.CreateFunction(fn) assert.EqualError(t, err, "KV put error") }) @@ -163,7 +163,7 @@ func TestGetFunctions(t *testing.T) { db.EXPECT().List("default/", &store.ReadOptions{Consistent: true}).Return(kvs, nil) service := &Service{FunctionStore: db, Log: zap.NewNop()} - list, err := service.GetFunctions("default") + list, err := service.ListFunctions("default") assert.Nil(t, err) assert.Equal(t, function.Functions{{ @@ -178,7 +178,7 @@ func TestGetFunctions(t *testing.T) { db.EXPECT().List("default/", gomock.Any()).Return([]*store.KVPair{}, errors.New("KV list err")) service := &Service{FunctionStore: db, Log: zap.NewNop()} - _, err := service.GetFunctions("default") + _, err := service.ListFunctions("default") assert.EqualError(t, err, "KV list err") }) @@ -188,7 +188,7 @@ func TestGetFunctions(t *testing.T) { db.EXPECT().List("default/", gomock.Any()).Return([]*store.KVPair{}, errors.New("Key not found in store")) service := &Service{FunctionStore: db, Log: zap.NewNop()} - list, _ := service.GetFunctions("default") + list, _ := service.ListFunctions("default") assert.Equal(t, function.Functions{}, list) }) diff --git a/libkv/subscription.go b/libkv/subscription.go index 6088a17..99dc9c2 100644 --- a/libkv/subscription.go +++ b/libkv/subscription.go @@ -115,8 +115,8 @@ func (service Service) DeleteSubscription(space string, id subscription.ID) erro return nil } -// GetSubscriptions returns array of all Subscription. -func (service Service) GetSubscriptions(space string) (subscription.Subscriptions, error) { +// ListSubscriptions returns array of all Subscription. +func (service Service) ListSubscriptions(space string) (subscription.Subscriptions, error) { subs := []*subscription.Subscription{} kvs, err := service.SubscriptionStore.List(spacePath(space), &store.ReadOptions{Consistent: true}) diff --git a/libkv/subscription_test.go b/libkv/subscription_test.go index 5f63938..8f5d8fa 100644 --- a/libkv/subscription_test.go +++ b/libkv/subscription_test.go @@ -334,7 +334,7 @@ func TestDeleteSubscription(t *testing.T) { }) } -func TestGetSubscriptions_OK(t *testing.T) { +func TestListSubscriptions(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -347,7 +347,7 @@ func TestGetSubscriptions_OK(t *testing.T) { subscriptionsDB.EXPECT().List("default/", &store.ReadOptions{Consistent: true}).Return(kvs, nil) subs := &Service{SubscriptionStore: subscriptionsDB, Log: zap.NewNop()} - list, _ := subs.GetSubscriptions("default") + list, _ := subs.ListSubscriptions("default") assert.Equal(t, subscription.Subscriptions{ { @@ -370,7 +370,7 @@ func TestGetSubscriptions_OK(t *testing.T) { subscriptionsDB.EXPECT().List("default/", gomock.Any()).Return(nil, errors.New("KV error")) subs := &Service{SubscriptionStore: subscriptionsDB, Log: zap.NewNop()} - _, err := subs.GetSubscriptions("default") + _, err := subs.ListSubscriptions("default") assert.EqualError(t, err, "KV error") }) diff --git a/mock/cors.go b/mock/cors.go index 2ab4428..5ef6548 100644 --- a/mock/cors.go +++ b/mock/cors.go @@ -71,17 +71,17 @@ func (mr *MockCORSServiceMockRecorder) GetCORS(arg0, arg1 interface{}) *gomock.C return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCORS", reflect.TypeOf((*MockCORSService)(nil).GetCORS), arg0, arg1) } -// GetCORSes mocks base method -func (m *MockCORSService) GetCORSes(arg0 string) (cors.CORSes, error) { - ret := m.ctrl.Call(m, "GetCORSes", arg0) +// ListCORS mocks base method +func (m *MockCORSService) ListCORS(arg0 string) (cors.CORSes, error) { + ret := m.ctrl.Call(m, "ListCORS", arg0) ret0, _ := ret[0].(cors.CORSes) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetCORSes indicates an expected call of GetCORSes -func (mr *MockCORSServiceMockRecorder) GetCORSes(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCORSes", reflect.TypeOf((*MockCORSService)(nil).GetCORSes), arg0) +// ListCORS indicates an expected call of ListCORS +func (mr *MockCORSServiceMockRecorder) ListCORS(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCORS", reflect.TypeOf((*MockCORSService)(nil).ListCORS), arg0) } // UpdateCORS mocks base method diff --git a/mock/eventtype.go b/mock/eventtype.go index 070e12f..4f50b98 100644 --- a/mock/eventtype.go +++ b/mock/eventtype.go @@ -71,17 +71,17 @@ func (mr *MockEventTypeServiceMockRecorder) GetEventType(arg0, arg1 interface{}) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEventType", reflect.TypeOf((*MockEventTypeService)(nil).GetEventType), arg0, arg1) } -// GetEventTypes mocks base method -func (m *MockEventTypeService) GetEventTypes(arg0 string) (event.Types, error) { - ret := m.ctrl.Call(m, "GetEventTypes", arg0) +// ListEventTypes mocks base method +func (m *MockEventTypeService) ListEventTypes(arg0 string) (event.Types, error) { + ret := m.ctrl.Call(m, "ListEventTypes", arg0) ret0, _ := ret[0].(event.Types) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetEventTypes indicates an expected call of GetEventTypes -func (mr *MockEventTypeServiceMockRecorder) GetEventTypes(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetEventTypes", reflect.TypeOf((*MockEventTypeService)(nil).GetEventTypes), arg0) +// ListEventTypes indicates an expected call of ListEventTypes +func (mr *MockEventTypeServiceMockRecorder) ListEventTypes(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEventTypes", reflect.TypeOf((*MockEventTypeService)(nil).ListEventTypes), arg0) } // UpdateEventType mocks base method diff --git a/mock/function.go b/mock/function.go index b286052..ff5c3c8 100644 --- a/mock/function.go +++ b/mock/function.go @@ -33,6 +33,19 @@ func (m *MockFunctionService) EXPECT() *MockFunctionServiceMockRecorder { return m.recorder } +// CreateFunction mocks base method +func (m *MockFunctionService) CreateFunction(arg0 *function.Function) (*function.Function, error) { + ret := m.ctrl.Call(m, "CreateFunction", arg0) + ret0, _ := ret[0].(*function.Function) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateFunction indicates an expected call of CreateFunction +func (mr *MockFunctionServiceMockRecorder) CreateFunction(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateFunction", reflect.TypeOf((*MockFunctionService)(nil).CreateFunction), arg0) +} + // DeleteFunction mocks base method func (m *MockFunctionService) DeleteFunction(arg0 string, arg1 function.ID) error { ret := m.ctrl.Call(m, "DeleteFunction", arg0, arg1) @@ -58,30 +71,17 @@ func (mr *MockFunctionServiceMockRecorder) GetFunction(arg0, arg1 interface{}) * return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFunction", reflect.TypeOf((*MockFunctionService)(nil).GetFunction), arg0, arg1) } -// GetFunctions mocks base method -func (m *MockFunctionService) GetFunctions(arg0 string) (function.Functions, error) { - ret := m.ctrl.Call(m, "GetFunctions", arg0) +// ListFunctions mocks base method +func (m *MockFunctionService) ListFunctions(arg0 string) (function.Functions, error) { + ret := m.ctrl.Call(m, "ListFunctions", arg0) ret0, _ := ret[0].(function.Functions) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetFunctions indicates an expected call of GetFunctions -func (mr *MockFunctionServiceMockRecorder) GetFunctions(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetFunctions", reflect.TypeOf((*MockFunctionService)(nil).GetFunctions), arg0) -} - -// RegisterFunction mocks base method -func (m *MockFunctionService) RegisterFunction(arg0 *function.Function) (*function.Function, error) { - ret := m.ctrl.Call(m, "RegisterFunction", arg0) - ret0, _ := ret[0].(*function.Function) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// RegisterFunction indicates an expected call of RegisterFunction -func (mr *MockFunctionServiceMockRecorder) RegisterFunction(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterFunction", reflect.TypeOf((*MockFunctionService)(nil).RegisterFunction), arg0) +// ListFunctions indicates an expected call of ListFunctions +func (mr *MockFunctionServiceMockRecorder) ListFunctions(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListFunctions", reflect.TypeOf((*MockFunctionService)(nil).ListFunctions), arg0) } // UpdateFunction mocks base method diff --git a/mock/subscription.go b/mock/subscription.go index 8f50ea2..9da3eca 100644 --- a/mock/subscription.go +++ b/mock/subscription.go @@ -71,17 +71,17 @@ func (mr *MockSubscriptionServiceMockRecorder) GetSubscription(arg0, arg1 interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscription", reflect.TypeOf((*MockSubscriptionService)(nil).GetSubscription), arg0, arg1) } -// GetSubscriptions mocks base method -func (m *MockSubscriptionService) GetSubscriptions(arg0 string) (subscription.Subscriptions, error) { - ret := m.ctrl.Call(m, "GetSubscriptions", arg0) +// ListSubscriptions mocks base method +func (m *MockSubscriptionService) ListSubscriptions(arg0 string) (subscription.Subscriptions, error) { + ret := m.ctrl.Call(m, "ListSubscriptions", arg0) ret0, _ := ret[0].(subscription.Subscriptions) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetSubscriptions indicates an expected call of GetSubscriptions -func (mr *MockSubscriptionServiceMockRecorder) GetSubscriptions(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSubscriptions", reflect.TypeOf((*MockSubscriptionService)(nil).GetSubscriptions), arg0) +// ListSubscriptions indicates an expected call of ListSubscriptions +func (mr *MockSubscriptionServiceMockRecorder) ListSubscriptions(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListSubscriptions", reflect.TypeOf((*MockSubscriptionService)(nil).ListSubscriptions), arg0) } // UpdateSubscription mocks base method diff --git a/subscription/cors/service.go b/subscription/cors/service.go index 080ab1c..17550ed 100644 --- a/subscription/cors/service.go +++ b/subscription/cors/service.go @@ -2,9 +2,9 @@ package cors // Service represents service for managing CORS configuration. type Service interface { + GetCORS(space string, id ID) (*CORS, error) + ListCORS(space string) (CORSes, error) CreateCORS(c *CORS) (*CORS, error) UpdateCORS(c *CORS) (*CORS, error) - GetCORS(space string, id ID) (*CORS, error) - GetCORSes(space string) (CORSes, error) DeleteCORS(space string, id ID) error } diff --git a/subscription/service.go b/subscription/service.go index 1a9e36b..7dd98e0 100644 --- a/subscription/service.go +++ b/subscription/service.go @@ -2,9 +2,9 @@ package subscription // Service represents service for managing subscriptions. type Service interface { + GetSubscription(space string, id ID) (*Subscription, error) + ListSubscriptions(space string) (Subscriptions, error) CreateSubscription(s *Subscription) (*Subscription, error) UpdateSubscription(id ID, s *Subscription) (*Subscription, error) - GetSubscription(space string, id ID) (*Subscription, error) - GetSubscriptions(space string) (Subscriptions, error) DeleteSubscription(space string, id ID) error }