Skip to content

Commit

Permalink
refactor(yurt-iot-dock): temporarily remove v3 client to deal with co…
Browse files Browse the repository at this point in the history
…de duplication (#1686)

Signed-off-by: LavenderQAQ <[email protected]>
  • Loading branch information
LavenderQAQ authored Oct 8, 2023
1 parent df21f74 commit dd458e5
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 1,602 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/aliyun/alibaba-cloud-sdk-go v1.62.156
github.com/davecgh/go-spew v1.1.1
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.3.0
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/go-resty/resty/v2 v2.7.0
github.com/golang-jwt/jwt v3.2.2+incompatible
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.3.0 h1:8Svk1HTehXEgwxgyA4muVhSkP3D9n1q+oSHI3B1Ac90=
github.com/edgexfoundry/go-mod-core-contracts/v2 v2.3.0/go.mod h1:4/e61acxVkhQWCTjQ4XcHVJDnrMDloFsZZB1B6STCRw=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0 h1:xjwCI34DLM31cSl1q9XmYgXS3JqXufQJMgohnLLLDx0=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0/go.mod h1:zzzWGWij6wAqm1go9TLs++TFMIsBqBb1eRnIj4mRxGw=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
Expand Down
13 changes: 3 additions & 10 deletions pkg/yurtiotdock/clients/edgex-foundry/edgexobject.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/openyurtio/openyurt/pkg/yurtiotdock/clients"
edgexcliv2 "github.com/openyurtio/openyurt/pkg/yurtiotdock/clients/edgex-foundry/v2"
edgexcliv3 "github.com/openyurtio/openyurt/pkg/yurtiotdock/clients/edgex-foundry/v3"
)

type EdgeXObject interface {
Expand All @@ -44,9 +43,7 @@ func NewEdgexDock(version string, coreMetadataAddr string, coreCommandAddr strin

func (ep *EdgexDock) CreateDeviceClient() (clients.DeviceInterface, error) {
switch ep.Version {
case "minnesota":
return edgexcliv3.NewEdgexDeviceClient(ep.CoreMetadataAddr, ep.CoreCommandAddr), nil
case "levski", "kamakura", "jakarta":
case "minnesota", "levski", "kamakura", "jakarta":
return edgexcliv2.NewEdgexDeviceClient(ep.CoreMetadataAddr, ep.CoreCommandAddr), nil
default:
return nil, fmt.Errorf("unsupported Edgex version: %v", ep.Version)
Expand All @@ -55,9 +52,7 @@ func (ep *EdgexDock) CreateDeviceClient() (clients.DeviceInterface, error) {

func (ep *EdgexDock) CreateDeviceProfileClient() (clients.DeviceProfileInterface, error) {
switch ep.Version {
case "minnesota":
return edgexcliv3.NewEdgexDeviceProfile(ep.CoreMetadataAddr), nil
case "levski", "kamakura", "jakarta":
case "minnesota", "levski", "kamakura", "jakarta":
return edgexcliv2.NewEdgexDeviceProfile(ep.CoreMetadataAddr), nil
default:
return nil, fmt.Errorf("unsupported Edgex version: %v", ep.Version)
Expand All @@ -66,9 +61,7 @@ func (ep *EdgexDock) CreateDeviceProfileClient() (clients.DeviceProfileInterface

func (ep *EdgexDock) CreateDeviceServiceClient() (clients.DeviceServiceInterface, error) {
switch ep.Version {
case "minnesota":
return edgexcliv3.NewEdgexDeviceServiceClient(ep.CoreMetadataAddr), nil
case "levski", "kamakura", "jakarta":
case "minnesota", "levski", "kamakura", "jakarta":
return edgexcliv2.NewEdgexDeviceServiceClient(ep.CoreMetadataAddr), nil
default:
return nil, fmt.Errorf("unsupported Edgex version: %v", ep.Version)
Expand Down
Loading

0 comments on commit dd458e5

Please sign in to comment.