service

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecodeBodyFn = func(body io.Reader, v interface{}) error {
	return json.NewDecoder(body).Decode(v)
}

DecodeBodyFn reads the next JSON encoding of data and store the result in value pointed by v

View Source
var HTTPWrite = func(w *http.ResponseWriter, data []byte) (int, error) {
	(*w).WriteHeader(http.StatusOK)
	return (*w).Write([]byte(data))
}

HTTPWrite writes the data to the connection npart of any http request

View Source
var MarshalFn = func(v interface{}) ([]byte, error) {
	return json.Marshal(v)
}

MarshalFn returns the JSON encoding of v

View Source
var UnMarshalFn = func(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}

UnMarshalFn parse the JSON encoding of data and the result in value pointed by v

Functions

This section is empty.

Types

type Service

type Service struct {
	VolumeFinder VolumeInfoGetter
	CertFile     string
	KeyFile      string
	Port         int
	Logger       *logrus.Logger
	EnableDebug  bool
}

Service contains data required by the service

func (*Service) Routes

func (s *Service) Routes() *mux.Router

Routes contains the list of routes for the service

func (*Service) Run

func (s *Service) Run() error

Run will start the service and listen for HTTP requests

type TableResponse

type TableResponse struct {
	Columns []map[string]string `json:"columns"`
	Rows    [][]string          `json:"rows"`
	Type    string              `json:"type"`
}

TableResponse is the expected response for getting a list of volumes (reference: https://grafana.com/grafana/plugins/grafana-simple-json-datasource)

type VolumeInfoGetter

type VolumeInfoGetter interface {
	GetPersistentVolumes(ctx context.Context) ([]k8s.VolumeInfo, error)
}

VolumeInfoGetter is an interface used to get a list of volume information

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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