diff --git a/clients/http/deviceservicecallback.go b/clients/http/deviceservicecallback.go deleted file mode 100644 index 33d3c504..00000000 --- a/clients/http/deviceservicecallback.go +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright (C) 2020-2023 IOTech Ltd -// Copyright (C) 2023 Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 - -package http - -import ( - "context" - "path" - - "github.com/edgexfoundry/go-mod-core-contracts/v4/clients/http/utils" - "github.com/edgexfoundry/go-mod-core-contracts/v4/clients/interfaces" - "github.com/edgexfoundry/go-mod-core-contracts/v4/common" - dtoCommon "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/common" - "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/requests" - "github.com/edgexfoundry/go-mod-core-contracts/v4/errors" -) - -type deviceServiceCallbackClient struct { - baseUrl string - authInjector interfaces.AuthenticationInjector - enableNameFieldEscape bool -} - -// NewDeviceServiceCallbackClient creates an instance of deviceServiceCallbackClient -func NewDeviceServiceCallbackClient(baseUrl string, authInjector interfaces.AuthenticationInjector, enableNameFieldEscape bool) interfaces.DeviceServiceCallbackClient { - return &deviceServiceCallbackClient{ - baseUrl: baseUrl, - authInjector: authInjector, - enableNameFieldEscape: enableNameFieldEscape, - } -} - -func (client *deviceServiceCallbackClient) AddDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PostRequestWithRawData(ctx, &response, client.baseUrl, common.ApiDeviceCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) ValidateDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PostRequestWithRawData(ctx, &response, client.baseUrl, common.ApiDeviceValidationRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) UpdateDeviceCallback(ctx context.Context, request requests.UpdateDeviceRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PutRequest(ctx, &response, client.baseUrl, common.ApiDeviceCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) DeleteDeviceCallback(ctx context.Context, name string) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - requestPath := path.Join(common.ApiDeviceCallbackRoute, common.Name, name) - err := utils.DeleteRequest(ctx, &response, client.baseUrl, requestPath, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) UpdateDeviceProfileCallback(ctx context.Context, request requests.DeviceProfileRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PutRequest(ctx, &response, client.baseUrl, common.ApiProfileCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) AddProvisionWatcherCallback(ctx context.Context, request requests.AddProvisionWatcherRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PostRequestWithRawData(ctx, &response, client.baseUrl, common.ApiWatcherCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) UpdateProvisionWatcherCallback(ctx context.Context, request requests.UpdateProvisionWatcherRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PutRequest(ctx, &response, client.baseUrl, common.ApiWatcherCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) DeleteProvisionWatcherCallback(ctx context.Context, name string) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - requestPath := common.NewPathBuilder().EnableNameFieldEscape(client.enableNameFieldEscape). - SetPath(common.ApiWatcherCallbackRoute).SetPath(common.Name).SetNameFieldPath(name).BuildPath() - err := utils.DeleteRequest(ctx, &response, client.baseUrl, requestPath, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} - -func (client *deviceServiceCallbackClient) UpdateDeviceServiceCallback(ctx context.Context, request requests.UpdateDeviceServiceRequest) (dtoCommon.BaseResponse, errors.EdgeX) { - var response dtoCommon.BaseResponse - err := utils.PutRequest(ctx, &response, client.baseUrl, common.ApiServiceCallbackRoute, nil, request, client.authInjector) - if err != nil { - return response, errors.NewCommonEdgeXWrapper(err) - } - return response, nil -} diff --git a/clients/http/deviceservicecallback_test.go b/clients/http/deviceservicecallback_test.go deleted file mode 100644 index 506d22dc..00000000 --- a/clients/http/deviceservicecallback_test.go +++ /dev/null @@ -1,143 +0,0 @@ -// -// Copyright (C) 2020-2022 IOTech Ltd -// Copyright (C) 2023 Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 - -package http - -import ( - "context" - "net/http" - "path" - "testing" - - "github.com/edgexfoundry/go-mod-core-contracts/v4/common" - dtoCommon "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/common" - "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/requests" - - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestAddDeviceCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPost, common.ApiDeviceCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.AddDeviceCallback(context.Background(), requests.AddDeviceRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestValidateDeviceCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPost, common.ApiDeviceValidationRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.ValidateDeviceCallback(context.Background(), requests.AddDeviceRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestUpdateDeviceCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPut, common.ApiDeviceCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.UpdateDeviceCallback(context.Background(), requests.UpdateDeviceRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestDeleteDeviceCallback(t *testing.T) { - testDeviceName := "testName" - requestId := uuid.New().String() - urlPath := path.Join(common.ApiDeviceCallbackRoute, common.Name, testDeviceName) - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodDelete, urlPath, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.DeleteDeviceCallback(context.Background(), testDeviceName) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestUpdateDeviceProfileCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPut, common.ApiProfileCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.UpdateDeviceProfileCallback(context.Background(), requests.DeviceProfileRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestAddProvisionWatcherCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPost, common.ApiWatcherCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.AddProvisionWatcherCallback(context.Background(), requests.AddProvisionWatcherRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestUpdateProvisionWatcherCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPut, common.ApiWatcherCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.UpdateProvisionWatcherCallback(context.Background(), requests.UpdateProvisionWatcherRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestDeleteProvisionWatcherCallback(t *testing.T) { - testWatcherName := "testName" - requestId := uuid.New().String() - urlPath := path.Join(common.ApiWatcherCallbackRoute, common.Name, testWatcherName) - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodDelete, urlPath, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.DeleteProvisionWatcherCallback(context.Background(), testWatcherName) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} - -func TestUpdateDeviceServiceCallback(t *testing.T) { - requestId := uuid.New().String() - expectedResponse := dtoCommon.NewBaseResponse(requestId, "", http.StatusOK) - ts := newTestServer(http.MethodPut, common.ApiServiceCallbackRoute, expectedResponse) - defer ts.Close() - - client := NewDeviceServiceCallbackClient(ts.URL, NewNullAuthenticationInjector(), false) - res, err := client.UpdateDeviceServiceCallback(context.Background(), requests.UpdateDeviceServiceRequest{}) - - require.NoError(t, err) - assert.Equal(t, requestId, res.RequestId) -} diff --git a/clients/interfaces/deviceservicecallback.go b/clients/interfaces/deviceservicecallback.go deleted file mode 100644 index fdd8de96..00000000 --- a/clients/interfaces/deviceservicecallback.go +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (C) 2020-2022 IOTech Ltd -// -// SPDX-License-Identifier: Apache-2.0 - -package interfaces - -import ( - "context" - - "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/common" - "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/requests" - "github.com/edgexfoundry/go-mod-core-contracts/v4/errors" -) - -// DeviceServiceCallbackClient defines the interface for interactions with the callback endpoint on the EdgeX Foundry device service. -type DeviceServiceCallbackClient interface { - // AddDeviceCallback invokes device service's callback API for adding device - AddDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (common.BaseResponse, errors.EdgeX) - // UpdateDeviceCallback invokes device service's callback API for updating device - UpdateDeviceCallback(ctx context.Context, request requests.UpdateDeviceRequest) (common.BaseResponse, errors.EdgeX) - // DeleteDeviceCallback invokes device service's callback API for deleting device - DeleteDeviceCallback(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) - // ValidateDeviceCallback invokes device service's validation API for validating device - ValidateDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (common.BaseResponse, errors.EdgeX) - // UpdateDeviceProfileCallback invokes device service's callback API for updating device profile - UpdateDeviceProfileCallback(ctx context.Context, request requests.DeviceProfileRequest) (common.BaseResponse, errors.EdgeX) - // AddProvisionWatcherCallback invokes device service's callback API for adding provision watcher - AddProvisionWatcherCallback(ctx context.Context, request requests.AddProvisionWatcherRequest) (common.BaseResponse, errors.EdgeX) - // UpdateProvisionWatcherCallback invokes device service's callback API for updating provision watcher - UpdateProvisionWatcherCallback(ctx context.Context, request requests.UpdateProvisionWatcherRequest) (common.BaseResponse, errors.EdgeX) - // DeleteProvisionWatcherCallback invokes device service's callback API for deleting provision watcher - DeleteProvisionWatcherCallback(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) - // UpdateDeviceServiceCallback invokes device service's callback API for updating device service - UpdateDeviceServiceCallback(ctx context.Context, request requests.UpdateDeviceServiceRequest) (common.BaseResponse, errors.EdgeX) -} diff --git a/clients/interfaces/mocks/AuthenticationInjector.go b/clients/interfaces/mocks/AuthenticationInjector.go new file mode 100644 index 00000000..b37ad040 --- /dev/null +++ b/clients/interfaces/mocks/AuthenticationInjector.go @@ -0,0 +1,66 @@ +// Code generated by mockery v2.45.0. DO NOT EDIT. + +package mocks + +import ( + http "net/http" + + mock "github.com/stretchr/testify/mock" +) + +// AuthenticationInjector is an autogenerated mock type for the AuthenticationInjector type +type AuthenticationInjector struct { + mock.Mock +} + +// AddAuthenticationData provides a mock function with given fields: _a0 +func (_m *AuthenticationInjector) AddAuthenticationData(_a0 *http.Request) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for AddAuthenticationData") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*http.Request) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// RoundTripper provides a mock function with given fields: +func (_m *AuthenticationInjector) RoundTripper() http.RoundTripper { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for RoundTripper") + } + + var r0 http.RoundTripper + if rf, ok := ret.Get(0).(func() http.RoundTripper); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(http.RoundTripper) + } + } + + return r0 +} + +// NewAuthenticationInjector creates a new instance of AuthenticationInjector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAuthenticationInjector(t interface { + mock.TestingT + Cleanup(func()) +}) *AuthenticationInjector { + mock := &AuthenticationInjector{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/clients/interfaces/mocks/DeviceServiceCallbackClient.go b/clients/interfaces/mocks/DeviceServiceCallbackClient.go deleted file mode 100644 index f6ea5c0b..00000000 --- a/clients/interfaces/mocks/DeviceServiceCallbackClient.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - common "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/common" - - errors "github.com/edgexfoundry/go-mod-core-contracts/v4/errors" - - mock "github.com/stretchr/testify/mock" - - requests "github.com/edgexfoundry/go-mod-core-contracts/v4/dtos/requests" -) - -// DeviceServiceCallbackClient is an autogenerated mock type for the DeviceServiceCallbackClient type -type DeviceServiceCallbackClient struct { - mock.Mock -} - -// AddDeviceCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) AddDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.AddDeviceRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.AddDeviceRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// AddProvisionWatcherCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) AddProvisionWatcherCallback(ctx context.Context, request requests.AddProvisionWatcherRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.AddProvisionWatcherRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.AddProvisionWatcherRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// DeleteDeviceCallback provides a mock function with given fields: ctx, name -func (_m *DeviceServiceCallbackClient) DeleteDeviceCallback(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, name) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, string) common.BaseResponse); ok { - r0 = rf(ctx, name) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { - r1 = rf(ctx, name) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// DeleteProvisionWatcherCallback provides a mock function with given fields: ctx, name -func (_m *DeviceServiceCallbackClient) DeleteProvisionWatcherCallback(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, name) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, string) common.BaseResponse); ok { - r0 = rf(ctx, name) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { - r1 = rf(ctx, name) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// UpdateDeviceCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) UpdateDeviceCallback(ctx context.Context, request requests.UpdateDeviceRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.UpdateDeviceRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.UpdateDeviceRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// UpdateDeviceProfileCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) UpdateDeviceProfileCallback(ctx context.Context, request requests.DeviceProfileRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.DeviceProfileRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.DeviceProfileRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// UpdateDeviceServiceCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) UpdateDeviceServiceCallback(ctx context.Context, request requests.UpdateDeviceServiceRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.UpdateDeviceServiceRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.UpdateDeviceServiceRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// UpdateProvisionWatcherCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) UpdateProvisionWatcherCallback(ctx context.Context, request requests.UpdateProvisionWatcherRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.UpdateProvisionWatcherRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.UpdateProvisionWatcherRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -// ValidateDeviceCallback provides a mock function with given fields: ctx, request -func (_m *DeviceServiceCallbackClient) ValidateDeviceCallback(ctx context.Context, request requests.AddDeviceRequest) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, request) - - var r0 common.BaseResponse - if rf, ok := ret.Get(0).(func(context.Context, requests.AddDeviceRequest) common.BaseResponse); ok { - r0 = rf(ctx, request) - } else { - r0 = ret.Get(0).(common.BaseResponse) - } - - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, requests.AddDeviceRequest) errors.EdgeX); ok { - r1 = rf(ctx, request) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(errors.EdgeX) - } - } - - return r0, r1 -} - -type mockConstructorTestingTNewDeviceServiceCallbackClient interface { - mock.TestingT - Cleanup(func()) -} - -// NewDeviceServiceCallbackClient creates a new instance of DeviceServiceCallbackClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDeviceServiceCallbackClient(t mockConstructorTestingTNewDeviceServiceCallbackClient) *DeviceServiceCallbackClient { - mock := &DeviceServiceCallbackClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/common/constants.go b/common/constants.go index bb2b9f33..6ea3e0ed 100644 --- a/common/constants.go +++ b/common/constants.go @@ -12,26 +12,26 @@ const ( ApiBase = "/api/v3" ApiEventRoute = ApiBase + "/event" - ApiEventServiceNameProfileNameDeviceNameSourceNameRoute = ApiEventRoute + "/{" + ServiceName + "}" + "/{" + ProfileName + "}" + "/{" + DeviceName + "}" + "/{" + SourceName + "}" ApiAllEventRoute = ApiEventRoute + "/" + All - ApiEventIdRoute = ApiEventRoute + "/" + Id + "/{" + Id + "}" ApiEventCountRoute = ApiEventRoute + "/" + Count - ApiEventCountByDeviceNameRoute = ApiEventCountRoute + "/" + Device + "/" + Name + "/{" + Name + "}" - ApiEventByDeviceNameRoute = ApiEventRoute + "/" + Device + "/" + Name + "/{" + Name + "}" - ApiEventByTimeRangeRoute = ApiEventRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiEventByAgeRoute = ApiEventRoute + "/" + Age + "/{" + Age + "}" + ApiEventServiceNameProfileNameDeviceNameSourceNameRoute = ApiEventRoute + "/:" + ServiceName + "/:" + ProfileName + "/:" + DeviceName + "/:" + SourceName + ApiEventIdRoute = ApiEventRoute + "/" + Id + "/:" + Id + ApiEventCountByDeviceNameRoute = ApiEventCountRoute + "/" + Device + "/" + Name + "/:" + Name + ApiEventByDeviceNameRoute = ApiEventRoute + "/" + Device + "/" + Name + "/:" + Name + ApiEventByTimeRangeRoute = ApiEventRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiEventByAgeRoute = ApiEventRoute + "/" + Age + "/:" + Age ApiReadingRoute = ApiBase + "/reading" ApiAllReadingRoute = ApiReadingRoute + "/" + All ApiReadingCountRoute = ApiReadingRoute + "/" + Count - ApiReadingCountByDeviceNameRoute = ApiReadingCountRoute + "/" + Device + "/" + Name + "/{" + Name + "}" - ApiReadingByDeviceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/{" + Name + "}" - ApiReadingByResourceNameRoute = ApiReadingRoute + "/" + ResourceName + "/{" + ResourceName + "}" - ApiReadingByTimeRangeRoute = ApiReadingRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiReadingByResourceNameAndTimeRangeRoute = ApiReadingByResourceNameRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiReadingByDeviceNameAndResourceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/{" + Name + "}/" + ResourceName + "/{" + ResourceName + "}" - ApiReadingByDeviceNameAndResourceNameAndTimeRangeRoute = ApiReadingByDeviceNameAndResourceNameRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiReadingByDeviceNameAndTimeRangeRoute = ApiReadingByDeviceNameRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" + ApiReadingCountByDeviceNameRoute = ApiReadingCountRoute + "/" + Device + "/" + Name + "/:" + Name + ApiReadingByDeviceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/:" + Name + ApiReadingByResourceNameRoute = ApiReadingRoute + "/" + ResourceName + "/:" + ResourceName + ApiReadingByTimeRangeRoute = ApiReadingRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiReadingByResourceNameAndTimeRangeRoute = ApiReadingByResourceNameRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiReadingByDeviceNameAndResourceNameRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/:" + Name + "/" + ResourceName + "/:" + ResourceName + ApiReadingByDeviceNameAndResourceNameAndTimeRangeRoute = ApiReadingByDeviceNameAndResourceNameRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiReadingByDeviceNameAndTimeRangeRoute = ApiReadingByDeviceNameRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End ApiDeviceProfileRoute = ApiBase + "/deviceprofile" ApiDeviceProfileBasicInfoRoute = ApiDeviceProfileRoute + "/basicinfo" @@ -39,81 +39,82 @@ const ( ApiDeviceProfileDeviceCommandRoute = ApiDeviceProfileRoute + "/" + DeviceCommand ApiDeviceProfileResourceRoute = ApiDeviceProfileRoute + "/" + Resource ApiDeviceProfileUploadFileRoute = ApiDeviceProfileRoute + "/uploadfile" - ApiDeviceProfileByNameRoute = ApiDeviceProfileRoute + "/" + Name + "/{" + Name + "}" - ApiDeviceProfileDeviceCommandByNameRoute = ApiDeviceProfileByNameRoute + "/" + DeviceCommand + "/{" + CommandName + "}" - ApiDeviceProfileResourceByNameRoute = ApiDeviceProfileByNameRoute + "/" + Resource + "/{" + ResourceName + "}" - ApiDeviceProfileByIdRoute = ApiDeviceProfileRoute + "/" + Id + "/{" + Id + "}" ApiAllDeviceProfileRoute = ApiDeviceProfileRoute + "/" + All - ApiDeviceProfileByManufacturerRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}" - ApiDeviceProfileByModelRoute = ApiDeviceProfileRoute + "/" + Model + "/{" + Model + "}" - ApiDeviceProfileByManufacturerAndModelRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/{" + Manufacturer + "}" + "/" + Model + "/{" + Model + "}" + ApiDeviceProfileByNameRoute = ApiDeviceProfileRoute + "/" + Name + "/:" + Name + ApiDeviceProfileDeviceCommandByNameRoute = ApiDeviceProfileByNameRoute + "/" + DeviceCommand + "/:" + CommandName + ApiDeviceProfileResourceByNameRoute = ApiDeviceProfileByNameRoute + "/" + Resource + "/:" + ResourceName + ApiDeviceProfileByManufacturerRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/:" + Manufacturer + ApiDeviceProfileByModelRoute = ApiDeviceProfileRoute + "/" + Model + "/:" + Model + ApiDeviceProfileByManufacturerAndModelRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/:" + Manufacturer + "/" + Model + "/:" + Model ApiDeviceResourceRoute = ApiBase + "/deviceresource" - ApiDeviceResourceByProfileAndResourceRoute = ApiDeviceResourceRoute + "/" + Profile + "/{" + ProfileName + "}" + "/" + Resource + "/{" + ResourceName + "}" + ApiDeviceResourceByProfileAndResourceRoute = ApiDeviceResourceRoute + "/" + Profile + "/:" + ProfileName + "/" + Resource + "/:" + ResourceName ApiDeviceServiceRoute = ApiBase + "/deviceservice" ApiAllDeviceServiceRoute = ApiDeviceServiceRoute + "/" + All - ApiDeviceServiceByNameRoute = ApiDeviceServiceRoute + "/" + Name + "/{" + Name + "}" - ApiDeviceServiceByIdRoute = ApiDeviceServiceRoute + "/" + Id + "/{" + Id + "}" + ApiDeviceServiceByNameRoute = ApiDeviceServiceRoute + "/" + Name + "/:" + Name ApiDeviceRoute = ApiBase + "/device" ApiAllDeviceRoute = ApiDeviceRoute + "/" + All - ApiDeviceIdExistsRoute = ApiDeviceRoute + "/" + Check + "/" + Id + "/{" + Id + "}" - ApiDeviceNameExistsRoute = ApiDeviceRoute + "/" + Check + "/" + Name + "/{" + Name + "}" - ApiDeviceByIdRoute = ApiDeviceRoute + "/" + Id + "/{" + Id + "}" - ApiDeviceByNameRoute = ApiDeviceRoute + "/" + Name + "/{" + Name + "}" - ApiDeviceByProfileIdRoute = ApiDeviceRoute + "/" + Profile + "/" + Id + "/{" + Id + "}" - ApiDeviceByProfileNameRoute = ApiDeviceRoute + "/" + Profile + "/" + Name + "/{" + Name + "}" - ApiDeviceByServiceIdRoute = ApiDeviceRoute + "/" + Service + "/" + Id + "/{" + Id + "}" - ApiDeviceByServiceNameRoute = ApiDeviceRoute + "/" + Service + "/" + Name + "/{" + Name + "}" - ApiDeviceNameCommandNameRoute = ApiDeviceByNameRoute + "/{" + Command + "}" + ApiDeviceNameExistsRoute = ApiDeviceRoute + "/" + Check + "/" + Name + "/:" + Name + ApiDeviceByNameRoute = ApiDeviceRoute + "/" + Name + "/:" + Name + ApiDeviceByProfileNameRoute = ApiDeviceRoute + "/" + Profile + "/" + Name + "/:" + Name + ApiDeviceByServiceNameRoute = ApiDeviceRoute + "/" + Service + "/" + Name + "/:" + Name + ApiDeviceNameCommandNameRoute = ApiDeviceByNameRoute + "/:" + Command ApiProvisionWatcherRoute = ApiBase + "/provisionwatcher" ApiAllProvisionWatcherRoute = ApiProvisionWatcherRoute + "/" + All - ApiProvisionWatcherByIdRoute = ApiProvisionWatcherRoute + "/" + Id + "/{" + Id + "}" - ApiProvisionWatcherByNameRoute = ApiProvisionWatcherRoute + "/" + Name + "/{" + Name + "}" - ApiProvisionWatcherByProfileNameRoute = ApiProvisionWatcherRoute + "/" + Profile + "/" + Name + "/{" + Name + "}" - ApiProvisionWatcherByServiceNameRoute = ApiProvisionWatcherRoute + "/" + Service + "/" + Name + "/{" + Name + "}" + ApiProvisionWatcherByNameRoute = ApiProvisionWatcherRoute + "/" + Name + "/:" + Name + ApiProvisionWatcherByProfileNameRoute = ApiProvisionWatcherRoute + "/" + Profile + "/" + Name + "/:" + Name + ApiProvisionWatcherByServiceNameRoute = ApiProvisionWatcherRoute + "/" + Service + "/" + Name + "/:" + Name + + ApiDiscoveryRoute = ApiBase + "/discovery" + ApiDiscoveryByIdRoute = ApiDiscoveryRoute + "/" + RequestId + "/:" + RequestId + + ApiProfileScanRoute = ApiBase + "/profilescan" + ApiProfileScanByDeviceNameRoute = ApiProfileScanRoute + "/" + Device + "/" + Name + "/:" + Name ApiSubscriptionRoute = ApiBase + "/subscription" ApiAllSubscriptionRoute = ApiSubscriptionRoute + "/" + All - ApiSubscriptionByNameRoute = ApiSubscriptionRoute + "/" + Name + "/{" + Name + "}" - ApiSubscriptionByCategoryRoute = ApiSubscriptionRoute + "/" + Category + "/{" + Category + "}" - ApiSubscriptionByLabelRoute = ApiSubscriptionRoute + "/" + Label + "/{" + Label + "}" - ApiSubscriptionByReceiverRoute = ApiSubscriptionRoute + "/" + Receiver + "/{" + Receiver + "}" + ApiSubscriptionByNameRoute = ApiSubscriptionRoute + "/" + Name + "/:" + Name + ApiSubscriptionByCategoryRoute = ApiSubscriptionRoute + "/" + Category + "/:" + Category + ApiSubscriptionByLabelRoute = ApiSubscriptionRoute + "/" + Label + "/:" + Label + ApiSubscriptionByReceiverRoute = ApiSubscriptionRoute + "/" + Receiver + "/:" + Receiver - ApiNotificationCleanupRoute = ApiBase + "/cleanup" - ApiNotificationCleanupByAgeRoute = ApiBase + "/" + Cleanup + "/" + Age + "/{" + Age + "}" ApiNotificationRoute = ApiBase + "/notification" - ApiNotificationByTimeRangeRoute = ApiNotificationRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiNotificationByAgeRoute = ApiNotificationRoute + "/" + Age + "/{" + Age + "}" - ApiNotificationByCategoryRoute = ApiNotificationRoute + "/" + Category + "/{" + Category + "}" - ApiNotificationByLabelRoute = ApiNotificationRoute + "/" + Label + "/{" + Label + "}" - ApiNotificationByIdRoute = ApiNotificationRoute + "/" + Id + "/{" + Id + "}" - ApiNotificationByStatusRoute = ApiNotificationRoute + "/" + Status + "/{" + Status + "}" - ApiNotificationBySubscriptionNameRoute = ApiNotificationRoute + "/" + Subscription + "/" + Name + "/{" + Name + "}" + ApiNotificationCleanupRoute = ApiBase + "/cleanup" + ApiNotificationCleanupByAgeRoute = ApiNotificationCleanupRoute + "/" + Age + "/:" + Age + ApiNotificationByTimeRangeRoute = ApiNotificationRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiNotificationByAgeRoute = ApiNotificationRoute + "/" + Age + "/:" + Age + ApiNotificationByCategoryRoute = ApiNotificationRoute + "/" + Category + "/:" + Category + ApiNotificationByLabelRoute = ApiNotificationRoute + "/" + Label + "/:" + Label + ApiNotificationByIdRoute = ApiNotificationRoute + "/" + Id + "/:" + Id + ApiNotificationByStatusRoute = ApiNotificationRoute + "/" + Status + "/:" + Status + ApiNotificationBySubscriptionNameRoute = ApiNotificationRoute + "/" + Subscription + "/" + Name + "/:" + Name + ApiNotificationAcknowledgeByIdsRoute = ApiNotificationRoute + "/" + Acknowledge + "/" + Ids + "/:" + Ids + ApiNotificationUnacknowledgeByIdsRoute = ApiNotificationRoute + "/" + Unacknowledge + "/" + Ids + "/:" + Ids ApiTransmissionRoute = ApiBase + "/transmission" - ApiTransmissionByIdRoute = ApiTransmissionRoute + "/" + Id + "/{" + Id + "}" - ApiTransmissionByAgeRoute = ApiTransmissionRoute + "/" + Age + "/{" + Age + "}" ApiAllTransmissionRoute = ApiTransmissionRoute + "/" + All - ApiTransmissionBySubscriptionNameRoute = ApiTransmissionRoute + "/" + Subscription + "/" + Name + "/{" + Name + "}" - ApiTransmissionByTimeRangeRoute = ApiTransmissionRoute + "/" + Start + "/{" + Start + "}/" + End + "/{" + End + "}" - ApiTransmissionByStatusRoute = ApiTransmissionRoute + "/" + Status + "/{" + Status + "}" - ApiTransmissionByNotificationIdRoute = ApiTransmissionRoute + "/" + Notification + "/" + Id + "/{" + Id + "}" + ApiTransmissionByIdRoute = ApiTransmissionRoute + "/" + Id + "/:" + Id + ApiTransmissionByAgeRoute = ApiTransmissionRoute + "/" + Age + "/:" + Age + ApiTransmissionBySubscriptionNameRoute = ApiTransmissionRoute + "/" + Subscription + "/" + Name + "/:" + Name + ApiTransmissionByTimeRangeRoute = ApiTransmissionRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End + ApiTransmissionByStatusRoute = ApiTransmissionRoute + "/" + Status + "/:" + Status + ApiTransmissionByNotificationIdRoute = ApiTransmissionRoute + "/" + Notification + "/" + Id + "/:" + Id ApiScheduleJobRoute = ApiBase + "/job" ApiAllScheduleJobRoute = ApiScheduleJobRoute + "/" + All - ApiScheduleJobByNameRoute = ApiScheduleJobRoute + "/" + Name + "/{" + Name + "}" ApiTriggerScheduleJobRoute = ApiScheduleJobRoute + "/" + Trigger - ApiTriggerScheduleJobByNameRoute = ApiScheduleJobRoute + "/" + Trigger + "/" + Name + "/{" + Name + "}" + ApiScheduleJobByNameRoute = ApiScheduleJobRoute + "/" + Name + "/:" + Name + ApiTriggerScheduleJobByNameRoute = ApiTriggerScheduleJobRoute + "/" + Name + "/:" + Name - ApiScheduleActionRecordRoute = ApiBase + "/scheduleactionrecord" - ApiAllScheduleActionRecordRoute = ApiScheduleActionRecordRoute + "/" + All - ApiLatestScheduleActionRecordByJobNameRoute = ApiScheduleActionRecordRoute + "/" + Latest + "/" + Job + "/" + Name + "/{" + Name + "}" - ApiScheduleActionRecordRouteByStatusRoute = ApiScheduleActionRecordRoute + "/" + Status + "/{" + Status + "}" - ApiScheduleActionRecordRouteByJobNameRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/{" + Name + "}" - ApiScheduleActionRecordByJobNameAndStatusRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/{" + Name + "}/" + Status + "/{" + Status + "}" + ApiScheduleActionRecordRoute = ApiBase + "/scheduleactionrecord" + ApiAllScheduleActionRecordRoute = ApiScheduleActionRecordRoute + "/" + All + ApiLatestScheduleActionRecordByJobNameRoute = ApiScheduleActionRecordRoute + "/" + Latest + "/" + Job + "/" + Name + "/:" + Name + ApiScheduleActionRecordRouteByStatusRoute = ApiScheduleActionRecordRoute + "/" + Status + "/:" + Status + ApiScheduleActionRecordRouteByJobNameRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/:" + Name + ApiScheduleActionRecordRouteByJobNameAndStatusRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/:" + Name + "/" + Status + "/:" + Status ApiConfigRoute = ApiBase + "/config" ApiPingRoute = ApiBase + "/ping" @@ -121,29 +122,16 @@ const ( ApiSecretRoute = ApiBase + "/secret" ApiUnitsOfMeasureRoute = ApiBase + "/uom" - ApiDeviceCallbackRoute = ApiBase + "/callback/device" - ApiDeviceCallbackNameRoute = ApiBase + "/callback/device/name/{name}" - ApiProfileCallbackRoute = ApiBase + "/callback/profile" - ApiProfileCallbackNameRoute = ApiBase + "/callback/profile/name/{name}" - ApiWatcherCallbackRoute = ApiBase + "/callback/watcher" - ApiWatcherCallbackNameRoute = ApiBase + "/callback/watcher/name/{name}" - ApiServiceCallbackRoute = ApiBase + "/callback/service" - ApiDiscoveryRoute = ApiBase + "/discovery" - ApiDeviceValidationRoute = ApiBase + "/validate/device" - ApiProfileScanRoute = ApiBase + "/profilescan" - ApiDiscoveryByIdRoute = ApiDiscoveryRoute + "/" + RequestId + "/{" + RequestId + "}" - ApiProfileScanByDeviceNameRoute = ApiProfileScanRoute + "/" + Device + "/" + Name + "/{" + Name + "}" - ApiSystemRoute = ApiBase + "/system" ApiOperationRoute = ApiSystemRoute + "/operation" ApiHealthRoute = ApiSystemRoute + "/health" ApiMultiConfigRoute = ApiSystemRoute + "/config" ApiKVSRoute = ApiBase + "/kvs" - ApiKVSByKeyRoute = ApiKVSRoute + "/" + Key + "/{" + Key + "}" ApiRegisterRoute = ApiBase + "/registry" ApiAllRegistrationsRoute = ApiRegisterRoute + "/" + All - ApiRegistrationByServiceIdRoute = ApiRegisterRoute + "/" + ServiceId + "/{" + ServiceId + "}" + ApiKVSByKeyRoute = ApiKVSRoute + "/" + Key + "/:" + Key + ApiRegistrationByServiceIdRoute = ApiRegisterRoute + "/" + ServiceId + "/:" + ServiceId ) // Constants related to defined url path names and parameters in the v3 service APIs diff --git a/common/echo_api_constants.go b/common/echo_api_constants.go deleted file mode 100644 index 459acc4b..00000000 --- a/common/echo_api_constants.go +++ /dev/null @@ -1,99 +0,0 @@ -// -// Copyright (C) 2023-2024 IOTech Ltd -// -// SPDX-License-Identifier: Apache-2.0 - -package common - -// Constants related to defined routes with path params in the v3 service APIs for Echo -// TODO: Remove in EdgeX 4.0 and will use the original API constant names defined in constants.go -const ( - ApiEventServiceNameProfileNameDeviceNameSourceNameEchoRoute = ApiEventRoute + "/:" + ServiceName + "/:" + ProfileName + "/:" + DeviceName + "/:" + SourceName - ApiEventIdEchoRoute = ApiEventRoute + "/" + Id + "/:" + Id - ApiEventCountByDeviceNameEchoRoute = ApiEventCountRoute + "/" + Device + "/" + Name + "/:" + Name - ApiEventByDeviceNameEchoRoute = ApiEventRoute + "/" + Device + "/" + Name + "/:" + Name - ApiEventByTimeRangeEchoRoute = ApiEventRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiEventByAgeEchoRoute = ApiEventRoute + "/" + Age + "/:" + Age - - ApiReadingCountByDeviceNameEchoRoute = ApiReadingCountRoute + "/" + Device + "/" + Name + "/:" + Name - ApiReadingByDeviceNameEchoRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/:" + Name - ApiReadingByResourceNameEchoRoute = ApiReadingRoute + "/" + ResourceName + "/:" + ResourceName - ApiReadingByTimeRangeEchoRoute = ApiReadingRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiReadingByResourceNameAndTimeRangeEchoRoute = ApiReadingByResourceNameEchoRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiReadingByDeviceNameAndResourceNameEchoRoute = ApiReadingRoute + "/" + Device + "/" + Name + "/:" + Name + "/" + ResourceName + "/:" + ResourceName - ApiReadingByDeviceNameAndResourceNameAndTimeRangeEchoRoute = ApiReadingByDeviceNameAndResourceNameEchoRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiReadingByDeviceNameAndTimeRangeEchoRoute = ApiReadingByDeviceNameEchoRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - - ApiDeviceProfileByNameEchoRoute = ApiDeviceProfileRoute + "/" + Name + "/:" + Name - ApiDeviceProfileDeviceCommandByNameEchoRoute = ApiDeviceProfileByNameEchoRoute + "/" + DeviceCommand + "/:" + CommandName - ApiDeviceProfileResourceByNameEchoRoute = ApiDeviceProfileByNameEchoRoute + "/" + Resource + "/:" + ResourceName - ApiDeviceProfileByIdEchoRoute = ApiDeviceProfileRoute + "/" + Id + "/:" + Id - ApiDeviceProfileByManufacturerEchoRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/:" + Manufacturer - ApiDeviceProfileByModelEchoRoute = ApiDeviceProfileRoute + "/" + Model + "/:" + Model - ApiDeviceProfileByManufacturerAndModelEchoRoute = ApiDeviceProfileRoute + "/" + Manufacturer + "/:" + Manufacturer + "/" + Model + "/:" + Model - - ApiDeviceResourceByProfileAndResourceEchoRoute = ApiDeviceResourceRoute + "/" + Profile + "/:" + ProfileName + "/" + Resource + "/:" + ResourceName - - ApiDeviceServiceByNameEchoRoute = ApiDeviceServiceRoute + "/" + Name + "/:" + Name - ApiDeviceServiceByIdEchoRoute = ApiDeviceServiceRoute + "/" + Id + "/:" + Id - - ApiDeviceIdExistsEchoRoute = ApiDeviceRoute + "/" + Check + "/" + Id + "/:" + Id - ApiDeviceNameExistsEchoRoute = ApiDeviceRoute + "/" + Check + "/" + Name + "/:" + Name - ApiDeviceByIdEchoRoute = ApiDeviceRoute + "/" + Id + "/:" + Id - ApiDeviceByNameEchoRoute = ApiDeviceRoute + "/" + Name + "/:" + Name - ApiDeviceByProfileIdEchoRoute = ApiDeviceRoute + "/" + Profile + "/" + Id + "/:" + Id - ApiDeviceByProfileNameEchoRoute = ApiDeviceRoute + "/" + Profile + "/" + Name + "/:" + Name - ApiDeviceByServiceIdEchoRoute = ApiDeviceRoute + "/" + Service + "/" + Id + "/:" + Id - ApiDeviceByServiceNameEchoRoute = ApiDeviceRoute + "/" + Service + "/" + Name + "/:" + Name - ApiDeviceNameCommandNameEchoRoute = ApiDeviceByNameEchoRoute + "/:" + Command - ApiDiscoveryByIdEchoRoute = ApiDiscoveryRoute + "/" + RequestId + "/:" + RequestId - ApiProfileScanByDeviceNameEchoRoute = ApiProfileScanRoute + "/" + Device + "/" + Name + "/:" + Name - - ApiProvisionWatcherByIdEchoRoute = ApiProvisionWatcherRoute + "/" + Id + "/:" + Id - ApiProvisionWatcherByNameEchoRoute = ApiProvisionWatcherRoute + "/" + Name + "/:" + Name - ApiProvisionWatcherByProfileNameEchoRoute = ApiProvisionWatcherRoute + "/" + Profile + "/" + Name + "/:" + Name - ApiProvisionWatcherByServiceNameEchoRoute = ApiProvisionWatcherRoute + "/" + Service + "/" + Name + "/:" + Name - - ApiSubscriptionByNameEchoRoute = ApiSubscriptionRoute + "/" + Name + "/:" + Name - ApiSubscriptionByCategoryEchoRoute = ApiSubscriptionRoute + "/" + Category + "/:" + Category - ApiSubscriptionByLabelEchoRoute = ApiSubscriptionRoute + "/" + Label + "/:" + Label - ApiSubscriptionByReceiverEchoRoute = ApiSubscriptionRoute + "/" + Receiver + "/:" + Receiver - - ApiNotificationCleanupByAgeEchoRoute = ApiBase + "/" + Cleanup + "/" + Age + "/:" + Age - ApiNotificationByTimeRangeEchoRoute = ApiNotificationRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiNotificationByAgeEchoRoute = ApiNotificationRoute + "/" + Age + "/:" + Age - ApiNotificationByCategoryEchoRoute = ApiNotificationRoute + "/" + Category + "/:" + Category - ApiNotificationByLabelEchoRoute = ApiNotificationRoute + "/" + Label + "/:" + Label - ApiNotificationByIdEchoRoute = ApiNotificationRoute + "/" + Id + "/:" + Id - ApiNotificationByStatusEchoRoute = ApiNotificationRoute + "/" + Status + "/:" + Status - ApiNotificationBySubscriptionNameEchoRoute = ApiNotificationRoute + "/" + Subscription + "/" + Name + "/:" + Name - ApiNotificationByIdsRoute = ApiNotificationRoute + "/" + Ids + "/:" + Ids - ApiNotificationAcknowledgeByIdsRoute = ApiNotificationRoute + "/" + Acknowledge + "/" + Ids + "/:" + Ids - ApiNotificationUnacknowledgeByIdsRoute = ApiNotificationRoute + "/" + Unacknowledge + "/" + Ids + "/:" + Ids - - ApiTransmissionByIdEchoRoute = ApiTransmissionRoute + "/" + Id + "/:" + Id - ApiTransmissionByAgeEchoRoute = ApiTransmissionRoute + "/" + Age + "/:" + Age - ApiTransmissionBySubscriptionNameEchoRoute = ApiTransmissionRoute + "/" + Subscription + "/" + Name + "/:" + Name - ApiTransmissionByTimeRangeEchoRoute = ApiTransmissionRoute + "/" + Start + "/:" + Start + "/" + End + "/:" + End - ApiTransmissionByStatusEchoRoute = ApiTransmissionRoute + "/" + Status + "/:" + Status - ApiTransmissionByNotificationIdEchoRoute = ApiTransmissionRoute + "/" + Notification + "/" + Id + "/:" + Id - - ApiDeviceCallbackNameEchoRoute = ApiBase + "/callback/device/name/:name" - ApiProfileCallbackNameEchoRoute = ApiBase + "/callback/profile/name/:name" - ApiWatcherCallbackNameEchoRoute = ApiBase + "/callback/watcher/name/:name" - - ApiKVSByKeyEchoRoute = ApiKVSRoute + "/" + Key + "/:" + Key - ApiRegistrationByServiceIdEchoRoute = ApiRegisterRoute + "/" + ServiceId + "/:" + ServiceId - - ApiScheduleJobEchoRoute = ApiBase + "/job" - ApiAllScheduleJobEchoRoute = ApiScheduleJobRoute + "/" + All - ApiTriggerScheduleJobByNameEchoRoute = ApiScheduleJobRoute + "/" + Trigger + "/" + Name + "/:" + Name - ApiScheduleJobByNameEchoRoute = ApiScheduleJobRoute + "/" + Name + "/:" + Name - - ApiScheduleActionRecordEchoRoute = ApiBase + "/scheduleactionrecord" - ApiAllScheduleActionRecordEchoRoute = ApiScheduleActionRecordRoute + "/" + All - ApiLatestScheduleActionRecordByJobNameEchoRoute = ApiScheduleActionRecordRoute + "/" + Latest + "/" + Job + "/" + Name + "/:" + Name - ApiScheduleActionRecordRouteByStatusEchoRoute = ApiScheduleActionRecordRoute + "/" + Status + "/:" + Status - ApiScheduleActionRecordRouteByJobNameEchoRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/:" + Name - ApiScheduleActionRecordRouteByJobNameAndStatusEchoRoute = ApiScheduleActionRecordRoute + "/" + Job + "/" + Name + "/:" + Name + "/" + Status + "/:" + Status -)