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
79 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,79 @@ | ||
/* | ||
Copyright 2021 The Kubernetes authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package clients | ||
|
||
import ( | ||
"context" | ||
"github.com/openyurtio/device-controller/api/v1alpha1" | ||
) | ||
|
||
// 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(ctx context.Context, device *v1alpha1.Device, options Options) (*v1alpha1.Device, error) | ||
Delete(ctx context.Context, name string, option Options) error | ||
Update(ctx context.Context, device *v1alpha1.Device, options Options) (*v1alpha1.Device, error) | ||
Get(ctx context.Context, name string, options Options) (*v1alpha1.Device, error) | ||
List(ctx context.Context, 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(ctx context.Context, propertyName string, d *v1alpha1.Device, options Options) (*v1alpha1.ActualPropertyState, error) | ||
SetPropertyState(ctx context.Context, propertyName string, d *v1alpha1.Device, options Options) error | ||
ListPropertiesState(ctx context.Context, d *v1alpha1.Device) (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(ctx context.Context, deviceService *v1alpha1.DeviceService, options Options) (*v1alpha1.DeviceService, error) | ||
Delete(ctx context.Context, name string, option Options) error | ||
Update(ctx context.Context, deviceService *v1alpha1.DeviceService, options Options) (*v1alpha1.DeviceService, error) | ||
Get(ctx context.Context, name string, options Options) (*v1alpha1.DeviceService, error) | ||
List(ctx context.Context, 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(ctx context.Context, addressable *v1alpha1.Addressable, options Options) (*v1alpha1.Addressable, error) | ||
DeleteAddressable(ctx context.Context, name string, options Options) error | ||
UpdateAddressable(ctx context.Context, device *v1alpha1.Addressable, options Options) (*v1alpha1.Addressable, error) | ||
GetAddressable(ctx context.Context, name string, options Options) (*v1alpha1.Addressable, error) | ||
ListAddressables(ctx context.Context, 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(ctx context.Context, deviceProfile *v1alpha1.DeviceProfile, options Options) (*v1alpha1.DeviceProfile, error) | ||
Delete(ctx context.Context, name string, options Options) error | ||
Update(ctx context.Context, deviceProfile *v1alpha1.DeviceProfile, options Options) (*v1alpha1.DeviceProfile, error) | ||
Get(ctx context.Context, name string, options Options) (*v1alpha1.DeviceProfile, error) | ||
List(ctx context.Context, 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(ctx context.Context, valueDescriptor *v1alpha1.ValueDescriptor, options Options) (*v1alpha1.ValueDescriptor, error) | ||
Delete(ctx context.Context, name string, options Options) error | ||
Update(ctx context.Context, valueDescriptor *v1alpha1.ValueDescriptor, options Options) (*v1alpha1.ValueDescriptor, error) | ||
Get(ctx context.Context, name string, options Options) (*v1alpha1.ValueDescriptor, error) | ||
List(ctx context.Context, options Options) ([]v1alpha1.ValueDescriptor, error) | ||
} |