This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interfaces which used to interact with the edge-side platform
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package clients | ||
|
||
import ( | ||
"github.com/charleszheng44/device-controller/api/v1alpha1" | ||
"github.com/go-resty/resty/v2" | ||
) | ||
|
||
// Options represents the additional parameters required to manipulate the actual object | ||
type Options map[string]string | ||
|
||
// DeviceInterface defines the interfaces which used to create, delete, update, get and list Device objects on edge-side platform | ||
type DeviceInterface interface { | ||
DevicePropertyInterface | ||
Create(device *v1alpha1.Device, options Options) (string, error) | ||
Delete(deviceName string, option Options) error | ||
Update(device *v1alpha1.Device, options Options) (string, error) | ||
Get(deviceName string, options Options) (*v1alpha1.Device, error) | ||
List(options Options) ([]v1alpha1.Device, error) | ||
} | ||
|
||
// DevicePropertyInterface defines the interfaces which used to get, list and set the actual status value of the device properties | ||
type DevicePropertyInterface interface { | ||
GetPropertyState(propertyName string, d *v1alpha1.Device, options Options) (*v1alpha1.ActualPropertyState, error) | ||
SetPropertyState(propertyName string, d *v1alpha1.Device, options Options) (*resty.Response, error) | ||
ListPropertiesState(deviceName string) (map[string]v1alpha1.DesiredPropertyState, map[string]v1alpha1.ActualPropertyState, error) | ||
} | ||
|
||
// DeviceServiceInterface defines the interfaces which used to create, delete, update, get and list DeviceService objects on edge-side platform | ||
type DeviceServiceInterface interface { | ||
AddressableInterface | ||
Create(deviceService *v1alpha1.DeviceService, options Options) (string, error) | ||
Delete(deviceServiceName string) error | ||
Update(deviceService *v1alpha1.DeviceService, options Options) (string, error) | ||
Get(deviceServiceName string, options Options) (*v1alpha1.DeviceService, error) | ||
List(options Options) ([]v1alpha1.DeviceService, error) | ||
} | ||
|
||
// AddressableInterface defines the interfaces which used to create, delete, update, get and list Addressable objects on edge-side platform | ||
type AddressableInterface interface { | ||
CreateAddressable(addressable *v1alpha1.Addressable, options Options) (string, error) | ||
DeleteAddressable(addressableName string, options Options) error | ||
UpdateAddressable(device *v1alpha1.Addressable, options Options) (string, error) | ||
GetAddressable(addressableName string, options Options) (*v1alpha1.Addressable, error) | ||
ListAddressables(options Options) ([]v1alpha1.Addressable, error) | ||
} | ||
|
||
// DeviceProfileInterface defines the interfaces which used to create, delete, update, get and list DeviceProfile objects on edge-side platform | ||
type DeviceProfileInterface interface { | ||
Create(deviceProfile *v1alpha1.DeviceProfile, options Options) (string, error) | ||
Delete(deviceProfileName string, options Options) error | ||
Update(deviceProfile *v1alpha1.DeviceProfile, options Options) (string, error) | ||
Get(deviceProfileName string, options Options) (*v1alpha1.DeviceProfile, error) | ||
List(options Options) ([]v1alpha1.DeviceProfile, error) | ||
} | ||
|
||
// ValueDescriptorInterface defines the interfaces which used to create, delete, update, get and list valueDescriptor objects on edge-side platform | ||
type ValueDescriptorInterface interface { | ||
Create(valueDescriptor *v1alpha1.ValueDescriptor, options Options) (string, error) | ||
Delete(valueDescriptorName string, options Options) error | ||
Update(valueDescriptor *v1alpha1.ValueDescriptor, options Options) (string, error) | ||
Get(valueDescriptorName string, options Options) (*v1alpha1.ValueDescriptor, error) | ||
List(options Options) ([]v1alpha1.ValueDescriptor, error) | ||
} |