tcommon

package
v0.0.0-...-81c02da Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package tcommon ...

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigFilePath holds the value of odim config file path
	ConfigFilePath string
)

Functions

func GetPluginStatus

func GetPluginStatus(ctx context.Context, plugin tmodel.Plugin) bool

GetPluginStatus checks the status of given plugin in configured interval

func GetResourceInfoFromDevice

func GetResourceInfoFromDevice(ctx context.Context, req ResourceInfoRequest) ([]byte, error)

GetResourceInfoFromDevice will contact to the southbound client and gets the Particular resource info from device

func TrackConfigFileChanges

func TrackConfigFileChanges(errChan chan error)

TrackConfigFileChanges monitors the host file using fsnotfiy

Types

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)
	GetPluginStatus func(context.Context, tmodel.Plugin) bool
	Plugin          tmodel.Plugin
	HTTPMethodType  string
}

PluginContactRequest hold the request of contact plugin

type ResourceInfoRequest

type ResourceInfoRequest struct {
	URL                 string
	ContactClient       func(context.Context, string, string, string, string, interface{}, map[string]string) (*http.Response, error)
	DevicePassword      func([]byte) ([]byte, error)
	GetPluginStatus     func(context.Context, tmodel.Plugin) bool
	ResourceName        string
	GetAllKeysFromTable func(context.Context, string, common.DbType) ([]string, error)
	GetPluginData       func(string) (tmodel.Plugin, *errors.Error)
	GetResource         func(context.Context, string, string, common.DbType) (string, *errors.Error)
	GenericSave         func(context.Context, []byte, string, string) error
}

ResourceInfoRequest hold the request of getting Resource

type ResponseStatus

type ResponseStatus struct {
	StatusCode    int32
	StatusMessage string
}

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