utils

package
v0.0.0-...-3b0daf1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoProps  = "NoProperties"
	NoConfig = "NoConfiguration"
)

Variables

View Source
var ErrAttributeNotFound = errors.New("miner configuration attribute not found")

Functions

func DocumentUrlDecode

func DocumentUrlDecode(content string) (string, error)

DocumentUrlDecode decodes a json formatted URL-encoded string and returns the decoded result.

func GetEquipAttribute

func GetEquipAttribute(
	equipments []shared.MinerConfigEquipment,
	info EquipmentInfo,
) string

GetEquipAttribute read from given equipments and return the attribute value that matches the given EquipmentInfo. If the attribute is not found, return the default value in equipment info.

func GetProperties

func GetProperties(
	serviceClient Client,
	identifier string,
	datum CacheInfo,
	constructors []PropsCrawlerConstructor,
) (shared.MinerResource, error)

Types

type AwsProfile

type AwsProfile struct {
	Profile string
	Regions []string
}

func ConfigAuth

func ConfigAuth(mineConfig shared.MinerConfig) (AwsProfile, error)

configAuth gets the authentication profile from the config and returns an awsProfile struct with the profile name for use in authenticating with AWS.

type CacheInfo

type CacheInfo struct {
	Alias   string
	Name    string
	Id      string
	Content string
}

type Client

type Client interface {
	Service() string
}

type Crawler

type Crawler interface {
	FetchConf(any) error
	Generate(CacheInfo) (shared.MinerResource, error)
}

func NewCrawler

func NewCrawler(
	ctx context.Context,
	serviceClient Client,
	resourceType string,
	resourcesMapping map[string]CrawlerConstructor,
) (Crawler, error)

type CrawlerConstructor

type CrawlerConstructor func(ctx context.Context, client Client) (Crawler, error)

type EquipmentInfo

type EquipmentInfo struct {
	AcceptVals []string
	DefaultVal string
	TargetType string
	TargetName string
	TargetAttr string
}

type MMError

type MMError struct {
	Category string
	Code     string
}

func (*MMError) Error

func (e *MMError) Error() string

type PropsCrawler

type PropsCrawler interface {
	PropertyType() string
	FetchConf(any) error
	Generate(CacheInfo) ([]shared.MinerProperty, error)
}

type PropsCrawlerConstructor

type PropsCrawlerConstructor func(serviceClient Client) (PropsCrawler, error)

Jump to

Keyboard shortcuts

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