dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts@v1.0.2/clients/interfaces/device.go (about)

     1  //
     2  // Copyright (C) 2020 IOTech Ltd
     3  //
     4  // SPDX-License-Identifier: Apache-2.0
     5  
     6  package interfaces
     7  
     8  import (
     9  	"context"
    10  
    11  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/dtos/common"
    12  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/dtos/requests"
    13  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/dtos/responses"
    14  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/errors"
    15  )
    16  
    17  // DeviceClient defines the interface for interactions with the Device endpoint on the EdgeX Foundry core-metadata service.
    18  type DeviceClient interface {
    19  	// Add adds new devices.
    20  	Add(ctx context.Context, reqs []requests.AddDeviceRequest) ([]common.BaseWithIdResponse, errors.EdgeX)
    21  	// Update updates devices.
    22  	Update(ctx context.Context, reqs []requests.UpdateDeviceRequest) ([]common.BaseResponse, errors.EdgeX)
    23  	// AllDevices returns all devices. Devices can also be filtered by labels.
    24  	// The result can be limited in a certain range by specifying the offset and limit parameters.
    25  	// offset: The number of items to skip before starting to collect the result set. Default is 0.
    26  	// limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20.
    27  	AllDevices(ctx context.Context, labels []string, offset int, limit int) (responses.MultiDevicesResponse, errors.EdgeX)
    28  	// DeviceNameExists checks whether the device exists.
    29  	DeviceNameExists(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX)
    30  	// DeviceByName returns a device by device name.
    31  	DeviceByName(ctx context.Context, name string) (responses.DeviceResponse, errors.EdgeX)
    32  	// DeleteByName deletes a device by device name.
    33  	DeleteDeviceByName(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX)
    34  	// DevicesByProfileName returns devices associated with the specified device profile.
    35  	// The result can be limited in a certain range by specifying the offset and limit parameters.
    36  	// offset: The number of items to skip before starting to collect the result set. Default is 0.
    37  	// limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20.
    38  	DevicesByProfileName(ctx context.Context, name string, offset int, limit int) (responses.MultiDevicesResponse, errors.EdgeX)
    39  	// DevicesByServiceName returns devices associated with the specified device service.
    40  	// The result can be limited in a certain range by specifying the offset and limit parameters.
    41  	// offset: The number of items to skip before starting to collect the result set. Default is 0.
    42  	// limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20.
    43  	DevicesByServiceName(ctx context.Context, name string, offset int, limit int) (responses.MultiDevicesResponse, errors.EdgeX)
    44  	DevicesByParentDeviceName(ctx context.Context, name string, offset int, limit int) (res responses.MultiLinksResponse, err errors.EdgeX)
    45  
    46  	LogicalDeleteDeviceByName(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX)
    47  	LogicalRestoreDeviceByName(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX)
    48  }