dsl

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteThingToResource

func DeleteThingToResource(rc *resty.Client, thing Thing, ci ConnectionInfo, shouldCommit bool) (err error)

DeleteThingToResource - Use the Things Path function to build a DELETE REST request

func ExtractThingFromResource

func ExtractThingFromResource(rc *resty.Client, thing Thing, ci ConnectionInfo) (err error)

ExtractThingFromResource - Use the Things Path function to build a GET REST requests and unmarshal body to yaml

func PostThingToResource

func PostThingToResource(rc *resty.Client, thing Thing, ci ConnectionInfo, shouldCommit bool) (err error)

PostThingToResource - Use the Things Path function to build a POST REST requests and marshal body

func ReadThingFromFile

func ReadThingFromFile(thing Thing, filename string, readfile func(filename string) ([]byte, error)) (err error)

ReadThingFromFile - loads the file contents (yaml or json) into a thing, io.ReadFile passed so it can be UTed

func WriteThingToFile

func WriteThingToFile(thing Thing, fw io.Writer) (err error)

WriteThingToFile - marshsal a thing to yaml and write to file

Types

type Authentication

type Authentication struct {
	Password `json:"password,omitempty" yaml:"password,omitempty"`
}

Authentication - Collection type for Auth options

type Cisco

type Cisco struct {
	OperatingSystem string `json:"operating-system" yaml:"operating-system"`
}

Cisco - option to define the Operating system

type ConnectionInfo

type ConnectionInfo struct {
	Authority string
	Username  string
	Password  string
}

ConnectionInfo - used to describe the resource endpoints

type DGAuthentication

type DGAuthentication struct {
	Password struct {
		Password *string `json:"password"`
		Username *string `json:"username"`
	} `json:"password,omitempty" yaml:"password,omitempty"`
}

DGAuthentication - Option to Override the individual Device Username/Passwords

type Device

type Device struct {
	DeviceID        string  `json:"device-id" yaml:"device-id" csv:"device-id"`
	Host            string  `json:"host" csv:"host"`
	SystemID        *string `json:"system-id,omitempty" yaml:"system-id,omitempty" csv:"-"`
	*Authentication `json:"authentication,omitempty" yaml:"authentication,omitempty"`
	IAgent          *IAgent     `json:"iAgent,omitempty" yaml:"iAgent,omitempty" csv:"-"`
	OpenConfig      *OpenConfig `json:"open-config,omitempty" yaml:"open-config,omitempty" csv:"-"`
	Snmp            *Snmp       `json:"snmp,omitempty" yaml:"snmp,omitempty" csv:"-"`
	Vendor          *Vendor     `json:"vendor,omitempty" yaml:"vendor,omitempty" csv:"-"`
}

Device - info needed to Register a Device in Healthbot

func (*Device) Count

func (d *Device) Count() int

Count - no of components within a thing

func (*Device) InnerThings

func (d *Device) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*Device) Path

func (d *Device) Path() string

Path - resource path for Device

func (*Device) Unmarshal

func (d *Device) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the Device struct

type DeviceFacts

type DeviceFacts []struct {
	DeviceID string `json:"device-id" yaml:"device-id"`
	Facts    struct {
		Hostname  string `json:"hostname"`
		JunosInfo []struct {
			LastRebootReason string `json:"last-reboot-reason"`
			MastershipState  string `json:"mastership-state"`
			Model            string `json:"model"`
			Name             string `json:"name"`
			Status           string `json:"status"`
			UpTime           string `json:"up-time"`
		} `json:"junos-info"`
		Platform     string `json:"platform"`
		PlatformInfo []struct {
			Name     string `json:"name"`
			Platform string `json:"platform"`
		} `json:"platform-info"`
		Product      string `json:"product"`
		Release      string `json:"release"`
		SerialNumber string `json:"serial-number" yaml:"serial-number"`
	} `json:"facts,omitempty"`
}

DeviceFacts - Provides Device Facts

func (*DeviceFacts) Count

func (d *DeviceFacts) Count() int

Count - no of components within a thing

func (*DeviceFacts) InnerThings

func (d *DeviceFacts) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*DeviceFacts) Path

func (d *DeviceFacts) Path() string

Path - resource path for DeviceFacts

func (*DeviceFacts) Unmarshal

func (d *DeviceFacts) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the DeviceFacts struct

type DeviceGroup

type DeviceGroup struct {
	DeviceGroupName string            `json:"device-group-name" yaml:"device-group-name"`
	Description     *string           `json:"description,omitempty" yaml:"description,omitempty"`
	Devices         *[]string         `json:"devices,omitempty" yaml:"devices,omitempty"`
	Playbooks       *[]string         `json:"playbooks,omitempty" yaml:"playbooks,omitempty"`
	Authentication  *DGAuthentication `json:"authentication,omitempty" yaml:"authentication,omitempty"`
	NativeGpb       *NativeGpb        `json:"native-gpb,omitempty" yaml:"native-gpb,omitempty"`
}

DeviceGroup - info needed to Register a DeviceGroup in Healthbot

func (*DeviceGroup) Count

func (d *DeviceGroup) Count() int

Count - no of components within a thing

func (*DeviceGroup) InnerThings

func (d *DeviceGroup) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*DeviceGroup) Path

func (d *DeviceGroup) Path() string

Path - resource path for DeviceGroup

func (*DeviceGroup) Unmarshal

func (d *DeviceGroup) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the DeviceGroup struct

type DeviceGroups

type DeviceGroups struct {
	DeviceGroup []DeviceGroup `json:"device-group" yaml:"device-group"`
}

DeviceGroups - collection of Device Groups

func (*DeviceGroups) Count

func (d *DeviceGroups) Count() int

Count - no of components within a thing

func (*DeviceGroups) InnerThings

func (d *DeviceGroups) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*DeviceGroups) Path

func (d *DeviceGroups) Path() string

Path - resource path for DeviceGroups

func (*DeviceGroups) Unmarshal

func (d *DeviceGroups) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the DeviceGroups struct

type Devices

type Devices struct {
	Device []Device `json:"device"`
}

Devices - collection of Device

func (*Devices) Count

func (d *Devices) Count() int

Count - no of components within a thing

func (*Devices) InnerThings

func (d *Devices) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*Devices) Path

func (d *Devices) Path() string

Path - resource path for Devices

func (*Devices) Unmarshal

func (d *Devices) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the Devices struct

type IAgent

type IAgent struct {
	Port int `json:"port"`
}

IAgent - configure the NETCONF port

type Juniper

type Juniper struct {
	OperatingSystem string `json:"operating-system" yaml:"operating-system"`
}

Juniper - option to define the Operating system

type NativeGpb

type NativeGpb struct {
	Ports []int `json:"ports"`
}

NativeGpb - Override the default JTI Port(s)

type OpenConfig

type OpenConfig struct {
	Port int `json:"port"`
}

OpenConfig - configure the Open Config port

type Password

type Password struct {
	Username *string `json:"username" csv:"username,omitempty"`
	Password *string `json:"password" csv:"password,omitempty"`
}

Password - wrapper for uname/password

type Snmp

type Snmp struct {
	V2   *V2 `json:"v2,omitempty" yaml:"v2,omitempty"`
	Port int `json:"port,omitempty" yaml:"port,omitempty"`
}

Snmp - configure the SNMP port or Community String

type SystemDetails

type SystemDetails struct {
	ServerTime string `json:"server-time" yaml:"server-time"`
	Version    string `json:"version"`
}

SystemDetails - Provides some basic hb info

func (*SystemDetails) Count

func (sd *SystemDetails) Count() int

Count - no of components within a thing

func (*SystemDetails) InnerThings

func (sd *SystemDetails) InnerThings() []Thing

InnerThings - returns inner things or empty slice

func (*SystemDetails) Path

func (sd *SystemDetails) Path() string

Path - resource path for Devices

func (*SystemDetails) Unmarshal

func (sd *SystemDetails) Unmarshal(data []byte) error

Unmarshal - tries to Unmarshal yaml first, then json into the Devices struct

type Thing

type Thing interface {
	Unmarshal(data []byte) error
	Path() string
	Count() int           // no of components within a thing
	InnerThings() []Thing // if Things is a aggregation of Things
}

Thing - nouns that h7t act on

type Token

type Token struct {
	AccessToken string `json:"accessToken"`
}

func GetToken

func GetToken(rc *resty.Client, ci ConnectionInfo) (t *Token, err error)

GetToken added for HB 3.0

type V2

type V2 struct {
	Community string `json:"community"`
}

V2 - configure the SNMP community string

type Vendor

type Vendor struct {
	Juniper *Juniper `json:"juniper,omitempty" yaml:"juniper,omitempty"`
	Cisco   *Cisco   `json:"cisco,omitempty" yaml:"cisco,omitempty"`
}

Vendor - Configure the Vendor information

Jump to

Keyboard shortcuts

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