scommon

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: 12 Imported by: 0

Documentation

Overview

Package scommon ...

Index

Constants

This section is empty.

Variables

View Source
var (
	//IOReadAll  function pointer for the ioutil.ReadAll
	IOReadAll = ioutil.ReadAll
	//JSONUnmarshalFunc function pointer for the json.Unmarshal
	JSONUnmarshalFunc = json.Unmarshal
)

Functions

func GetPluginStatus

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

GetPluginStatus checks the status of given plugin in configured interval

func GetResourceInfoFromDevice

func GetResourceInfoFromDevice(ctx context.Context, req ResourceInfoRequest, saveRequired bool) (string, error)

GetResourceInfoFromDevice will contact to the and gets the Particual resource info from device If saveRequired is set to true the newly collected data will be saved in the DB. Some specific cases may not require the data to be stored in DB, eg: Delete volume requires reset of the BMC to take its effect. Before a reset, volumes retrieval request can provide the deleted volume. We can avoid storing such a data with the use of saveRequired.

func TrackConfigFileChanges

func TrackConfigFileChanges(configFilePath string, errChan chan error)

TrackConfigFileChanges monitors the odim config changes 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, smodel.Plugin) bool
	Plugin          smodel.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)
	GetPluginStatus func(context.Context, smodel.Plugin) bool
	ResourceName    string
}

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

type Schema

type Schema struct {
	SearchKeys    []map[string]map[string]string `json:"searchKeys"`
	ConditionKeys []string                       `json:"conditionKeys"`
	QueryKeys     []string                       `json:"queryKeys"`
}

Schema is used to define the allowed values for search/filter

var SF Schema

SF holds the schema data for search/filter

Jump to

Keyboard shortcuts

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