diff --git a/go.mod b/go.mod index 631bfe47..14dffe54 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/edgexfoundry/go-mod-bootstrap/v2 require ( github.com/BurntSushi/toml v0.3.1 github.com/edgexfoundry/go-mod-configuration/v2 v2.0.0-dev.1 - github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0-dev.13 + github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0-dev.18 github.com/edgexfoundry/go-mod-registry/v2 v2.0.0-dev.1 github.com/edgexfoundry/go-mod-secrets/v2 v2.0.0-dev.3 github.com/gorilla/mux v1.7.1 diff --git a/v2/bootstrap/container/deviceservice.go b/v2/bootstrap/container/deviceservice.go index eb734072..346f98da 100644 --- a/v2/bootstrap/container/deviceservice.go +++ b/v2/bootstrap/container/deviceservice.go @@ -13,7 +13,10 @@ import ( // DeviceServiceCallbackClientName contains the name of the DeviceServiceCallbackClient instance in the DIC. var DeviceServiceCallbackClientName = di.TypeInstanceToName((*interfaces.DeviceServiceCallbackClient)(nil)) -// DeviceServiceCallbackClientFrom helper function queries the DIC and returns the DeviceServiceCallbackClientFrom instance. +// DeviceServiceCommandClientName contains the name of the DeviceServiceCommandClient instance in the DIC. +var DeviceServiceCommandClientName = di.TypeInstanceToName((*interfaces.DeviceServiceCommandClient)(nil)) + +// DeviceServiceCallbackClientFrom helper function queries the DIC and returns the DeviceServiceCallbackClient instance. func DeviceServiceCallbackClientFrom(get di.Get) interfaces.DeviceServiceCallbackClient { client, ok := get(DeviceServiceCallbackClientName).(interfaces.DeviceServiceCallbackClient) if !ok { @@ -22,3 +25,13 @@ func DeviceServiceCallbackClientFrom(get di.Get) interfaces.DeviceServiceCallbac return client } + +// DeviceServiceCommandClientFrom helper function queries the DIC and returns the DeviceServiceCommandClient instance. +func DeviceServiceCommandClientFrom(get di.Get) interfaces.DeviceServiceCommandClient { + client, ok := get(DeviceServiceCommandClientName).(interfaces.DeviceServiceCommandClient) + if !ok { + return nil + } + + return client +}