Documentation ¶
Overview ¶
Package clients provides REST-based integration with the core APIs of the EdgeX Foundry platform.
Each individual service client can be found in its respective package within clients. View the Subdirectories section below for more information.
While it is certainly possible to utilize the exported functions in this package to make calls to a given service, it is recommended (unless you really specifically know what you're doing) to use the service clients instead. The functions here are exported primarily for the use of the service clients.
Index ¶
- Constants
- func CountRequest(url string, ctx context.Context) (int, error)
- func DeleteRequest(url string, ctx context.Context) error
- func FromContext(key string, ctx context.Context) string
- func GetRequest(url string, ctx context.Context) ([]byte, error)
- func PostJsonRequest(url string, data interface{}, ctx context.Context) (string, error)
- func PostRequest(url string, data []byte, ctx context.Context) (string, error)
- func PutRequest(url string, body []byte, ctx context.Context) (string, error)
- func UpdateRequest(url string, data interface{}, ctx context.Context) error
- func UploadFileRequest(url string, filePath string, ctx context.Context) (string, error)
- type CorrelatedRequest
- type Endpointer
Constants ¶
const ( ClientMonitorDefault = 15000 // Defaults the interval at which a given service client will refresh its endpoint from the Registry, if used CorrelationHeader = "correlation-id" // Sets the key of the Correlation ID HTTP header )
Do not assume that if a constant is identified by your IDE as not being used within this module that it is not being used at all. Any application wishing to exchange information with the EdgeX core services will utilize this module, so constants located here may be used externally.
Miscellaneous constants
const ( ApiVersionRoute = "/api/version" ApiBase = "/api/v1" ApiAddressableRoute = "/api/v1/addressable" ApiCallbackRoute = "/api/v1/callback" ApiCommandRoute = "/api/v1/command" ApiConfigRoute = "/api/v1/config" ApiDeviceRoute = "/api/v1/device" ApiDeviceProfileRoute = "/api/v1/deviceprofile" ApiDeviceServiceRoute = "/api/v1/deviceservice" ApiEventRoute = "/api/v1/event" ApiLoggingRoute = "/api/v1/logs" ApiMetricsRoute = "/api/v1/metrics" ApiNotificationRoute = "/api/v1/notification" ApiNotifyRegistrationRoute = "/api/v1/notify/registrations" ApiPingRoute = "/api/v1/ping" ApiProvisionWatcherRoute = "/api/v1/provisionwatcher" ApiReadingRoute = "/api/v1/reading" ApiRegistrationRoute = "/api/v1/registration" ApiRegistrationByNameRoute = ApiRegistrationRoute + "/name" ApiSubscriptionRoute = "/api/v1/subscription" ApiTransmissionRoute = "/api/v1/transmission" ApiValueDescriptorRoute = "/api/v1/valuedescriptor" ApiIntervalRoute = "/api/v1/interval" ApiIntervalActionRoute = "/api/v1/intervalaction" )
Constants related to defined routes in the service APIs
const ( ServiceKeyPrefix = "edgex-" ConfigSeedServiceKey = "edgex-config-seed" CoreCommandServiceKey = "edgex-core-command" CoreDataServiceKey = "edgex-core-data" CoreMetaDataServiceKey = "edgex-core-metadata" ExportClientServiceKey = "edgex-export-client" ExportDistroServiceKey = "edgex-export-distro" SupportLoggingServiceKey = "edgex-support-logging" SupportNotificationsServiceKey = "edgex-support-notifications" SystemManagementAgentServiceKey = "edgex-sys-mgmt-agent" SupportSchedulerServiceKey = "edgex-support-scheduler" )
Constants related to how services identify themselves in the Service Registry
const ( ContentType = "Content-Type" ContentTypeCBOR = "application/cbor" ContentTypeJSON = "application/json" ContentTypeYAML = "application/x-yaml" ContentTypeText = "text/plain" )
Constants related to the possible content types supported by the APIs
Variables ¶
This section is empty.
Functions ¶
func CountRequest ¶
Helper method to make the count request
func DeleteRequest ¶
Helper method to make the delete request
func FromContext ¶
FromContext allows for the retrieval of the specified key's value from the supplied Context. If the value is not found, an empty string is returned.
func GetRequest ¶
Helper method to make the get request and return the body
func PostJsonRequest ¶
Helper method to make the post JSON request and return the body
func PostRequest ¶
Helper method to make the post request and return the body
func PutRequest ¶
Helper method to make the put request
func UpdateRequest ¶
Helper method to make the update request
Types ¶
type CorrelatedRequest ¶
type CorrelatedRequest struct {
}CorrelatedRequest is a wrapper type for use in managing Correlation IDs during service to service API calls.
func NewCorrelatedRequest ¶
func NewCorrelatedRequest(req *http.Request, ctx context.Context) CorrelatedRequest
NewCorrelatedRequest will add the Correlation ID header to the supplied request. If no Correlation ID header is present in the supplied context, one will be created along with a value.
type Endpointer ¶
type Endpointer interface { //Monitor is responsible for looking up information about the service endpoint corresponding //to the params.ServiceKey property. The name "Monitor" implies that this lookup will be done //at a regular interval. Information about the service from the discovery provider should be //used to construct a URL which will then be pushed to the returned channel. Monitor(params types.EndpointParams) chan string }
Endpointer is the interface for types that need to implement or simulate integration with a service discovery provider.
Directories ¶
Path | Synopsis |
---|---|
Package command provides a client for integration with the core-command service.
|
Package command provides a client for integration with the core-command service. |
Package coredata provides clients used for integration with the core-data service.
|
Package coredata provides clients used for integration with the core-data service. |
export
|
|
distro
Package distro provides a client for integration with the export-distro service.
|
Package distro provides a client for integration with the export-distro service. |
Package general provides a client for calling operational endpoints that are present on all service APIs.
|
Package general provides a client for calling operational endpoints that are present on all service APIs. |
Package logger provides a client for integration with the support-logging service.
|
Package logger provides a client for integration with the support-logging service. |
Package metadata provides clients used for integration with the core-metadata service.
|
Package metadata provides clients used for integration with the core-metadata service. |
Package notifications provides a client for integrating with the support-notifications service.
|
Package notifications provides a client for integrating with the support-notifications service. |
Package scheduler provides clients used for integration with the support-scheduler service.
|
Package scheduler provides clients used for integration with the support-scheduler service. |
Package types provides supporting types that facilitate the various service client implementations.
|
Package types provides supporting types that facilitate the various service client implementations. |