ucommon

package
v0.0.0-...-8d2fcc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package ucommon ...

Index

Constants

This section is empty.

Variables

View Source
var (
	// CallPluginFunc function  pointer for calling the plugin
	CallPluginFunc = callPlugin
	// IOUtilReadAllFunc function  pointer for calling the files
	IOUtilReadAllFunc = ioutil.ReadAll
)
View Source
var (
	// ConfigFilePath holds the value of odim config file path
	ConfigFilePath string
)

Functions

func TrackConfigFileChanges

func TrackConfigFileChanges(errChan chan error)

Types

type CommonInterface

type CommonInterface struct {
	GetTarget     func(string) (*umodel.Target, *errors.Error)
	GetPluginData func(string) (umodel.Plugin, *errors.Error)
	ContactPlugin func(context.Context, PluginContactRequest, string) ([]byte, string, ResponseStatus, error)
}

CommonInterface holds the pointers for functions with DB opearations

func (*CommonInterface) GetResourceInfoFromDevice

func (i *CommonInterface) GetResourceInfoFromDevice(ctx context.Context, req ResourceInfoRequest) (string, error)

GetResourceInfoFromDevice will contact to the and gets the Particual resource info from device

type PluginContactRequest

type PluginContactRequest struct {
	Token          string
	OID            string
	DeviceInfo     interface{}
	BasicAuth      map[string]string
	ContactClient  func(context.Context, string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	PostBody       interface{}
	Plugin         umodel.Plugin
	HTTPMethodType string
}

PluginContactRequest hold the request of contact plugin

type ResourceInfoRequest

type ResourceInfoRequest struct {
	URL            string
	UUID           string
	SystemID       string
	ContactClient  func(context.Context, string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	DevicePassword func([]byte) ([]byte, error)
	ResourceName   string
}

ResourceInfoRequest hold the request of getting Resource

type ResponseStatus

type ResponseStatus struct {
	StatusCode    int32
	StatusMessage string
	MsgArgs       []interface{}
}

ResponseStatus holds the response of Contact Plugin

func ContactPlugin

func ContactPlugin(ctx context.Context, req PluginContactRequest, errorMessage string) ([]byte, string, ResponseStatus, error)

ContactPlugin is commons which handles the request and response of Contact Plugin usage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL