rest

package
v0.0.0-...-5546796 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Constraints  Constraints
	Description  string
	Display      bool
	ID           int64
	Multi        bool
	Name         string
	Required     bool
	ResourceName string `json:"resource_name"`
	SiteID       int64  `json:"site_id"`
}

Attribute contains Attribute definition

func (Attribute) GetAll

func (a Attribute) GetAll() ([]Resource, error)

GetAll queries NSoT for all Attributes

func (*Attribute) MarshalJSON

func (mj *Attribute) MarshalJSON() ([]byte, error)

func (*Attribute) MarshalJSONBuf

func (mj *Attribute) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Attribute) Plural

func (a *Attribute) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Attribute) String

func (a *Attribute) String() string

func (*Attribute) UnmarshalJSON

func (uj *Attribute) UnmarshalJSON(input []byte) error

func (*Attribute) UnmarshalJSONFFLexer

func (uj *Attribute) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Attributes

type Attributes []Attribute

Attributes contains multiple Attributes

type Change

type Change struct {
	ChangeAt     time.Time `json:"change_at"`
	Event        string
	ID           int64
	Resource     interface{}
	ResourceID   int64  `json:"resource_id"`
	ResourceName string `json:"resource_name"`
	Site         Site
	User         User
}

Change contains Change definition

func (Change) GetAll

func (c Change) GetAll() ([]Resource, error)

GetAll queries NSoT for all Changes

func (*Change) MarshalJSON

func (mj *Change) MarshalJSON() ([]byte, error)

func (*Change) MarshalJSONBuf

func (mj *Change) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Change) Plural

func (c *Change) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Change) UnmarshalJSON

func (uj *Change) UnmarshalJSON(input []byte) error

func (*Change) UnmarshalJSONFFLexer

func (uj *Change) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Changes

type Changes []Change

Changes contains multiple Changes

type Circuit

type Circuit struct {
	AEndpoint  int64 `json:"a_endpoint"`
	Attributes map[string]string
	ID         int64
	Name       string
	ZEndpoint  int64 `json:"z_endpoint"`
}

Circuit contains Circuit definition

func (Circuit) GetAll

func (c Circuit) GetAll() ([]Resource, error)

GetAll queries NSoT for all Circuits

func (*Circuit) MarshalJSON

func (mj *Circuit) MarshalJSON() ([]byte, error)

func (*Circuit) MarshalJSONBuf

func (mj *Circuit) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Circuit) Plural

func (c *Circuit) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Circuit) String

func (c *Circuit) String() string

func (*Circuit) UnmarshalJSON

func (uj *Circuit) UnmarshalJSON(input []byte) error

func (*Circuit) UnmarshalJSONFFLexer

func (uj *Circuit) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Circuits

type Circuits []Circuit

Circuits contains multiple Circuits

type Constraints

type Constraints struct {
	AllowEmpty  bool `json:"allow_empty"`
	Pattern     string
	ValidValues []interface{} `json:"valid_values"`
}

Constraints contains Attribute Constraints

func (*Constraints) MarshalJSON

func (mj *Constraints) MarshalJSON() ([]byte, error)

func (*Constraints) MarshalJSONBuf

func (mj *Constraints) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Constraints) UnmarshalJSON

func (uj *Constraints) UnmarshalJSON(input []byte) error

func (*Constraints) UnmarshalJSONFFLexer

func (uj *Constraints) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Device

type Device struct {
	Attributes map[string]string
	Hostname   string
	ID         int64
	SiteID     int64 `json:"site_id"`
}

Device contains Device definition

func (Device) GetAll

func (d Device) GetAll() ([]Resource, error)

GetAll queries NSoT for all Devices

func (*Device) MarshalJSON

func (mj *Device) MarshalJSON() ([]byte, error)

func (*Device) MarshalJSONBuf

func (mj *Device) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Device) Plural

func (d *Device) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Device) String

func (d *Device) String() string

func (*Device) UnmarshalJSON

func (uj *Device) UnmarshalJSON(input []byte) error

func (*Device) UnmarshalJSONFFLexer

func (uj *Device) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Devices

type Devices []Device

Devices contains multiple Devices

type HardwareAddr

type HardwareAddr struct{ net.HardwareAddr }

HardwareAddr is a wrapper around net.HardwareAddr to provide (Un)Marshaling ffjson: skip

func (*HardwareAddr) MarshalJSON

func (mac *HardwareAddr) MarshalJSON() (text []byte, err error)

MarshalJSON converts from []byte into meaningful type

func (*HardwareAddr) UnmarshalJSON

func (mac *HardwareAddr) UnmarshalJSON(text []byte) (err error)

UnmarshalJSON converts from []byte into meaningful type

type IP

type IP struct{ net.IP }

IP is a wrapper around net.IP to provide (Un)Marshaling ffjson: skip

func (*IP) MarshalJSON

func (ip *IP) MarshalJSON() (text []byte, err error)

MarshalJSON converts from []byte into meaningful type

func (*IP) UnmarshalJSON

func (ip *IP) UnmarshalJSON(text []byte) (err error)

UnmarshalJSON converts from []byte into meaningful type

type IPNet

type IPNet struct{ net.IPNet }

IPNet is a wrapper around net.IPNet to provide (Un)Marshaling ffjson: skip

func (*IPNet) MarshalJSON

func (n *IPNet) MarshalJSON() (text []byte, err error)

MarshalJSON converts from []byte into meaningful type

func (*IPNet) UnmarshalJSON

func (n *IPNet) UnmarshalJSON(text []byte) (err error)

UnmarshalJSON converts from []byte into meaningful type

type Interface

type Interface struct {
	Addresses   []IP
	Attributes  map[string]string
	Description string
	Device      int64
	ID          int64
	MacAddress  HardwareAddr `json:"mac_address"`
	Name        string
	Networks    []IPNet
	ParentID    int64 `json:"parent_id"`
	Speed       int64
	Type        int64
}

Interface contains Interface definition

func (Interface) GetAll

func (i Interface) GetAll() ([]Resource, error)

GetAll queries NSoT for all Interfaces

func (*Interface) MarshalJSON

func (mj *Interface) MarshalJSON() ([]byte, error)

func (*Interface) MarshalJSONBuf

func (mj *Interface) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Interface) Plural

func (i *Interface) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Interface) String

func (i *Interface) String() string

func (*Interface) UnmarshalJSON

func (uj *Interface) UnmarshalJSON(input []byte) error

func (*Interface) UnmarshalJSONFFLexer

func (uj *Interface) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Interfaces

type Interfaces []Interface

Interfaces contains multiple Interfaces

type Network

type Network struct {
	Attributes     map[string]string
	ID             int64
	IPVersion      string `json:"ip_version"`
	IsIP           bool   `json:"is_ip"`
	NetworkAddress IP     `json:"network_address"`
	ParentID       int64  `json:"parent_id"`
	PrefixLength   int    `json:"prefix_length"`
	SiteID         int64  `json:"site_id"`
	State          string
}

Network contains Network definition

func (Network) GetAll

func (n Network) GetAll() ([]Resource, error)

GetAll queries NSoT for all Networks

func (*Network) MarshalJSON

func (mj *Network) MarshalJSON() ([]byte, error)

func (*Network) MarshalJSONBuf

func (mj *Network) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Network) Network

func (n *Network) Network() net.IPNet

Network returns net.IPNet

func (*Network) Plural

func (n *Network) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Network) String

func (n *Network) String() string

func (*Network) UnmarshalJSON

func (uj *Network) UnmarshalJSON(input []byte) error

func (*Network) UnmarshalJSONFFLexer

func (uj *Network) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Networks

type Networks []Network

Networks contains multiple Networks

type Permissions

type Permissions map[string]struct {
	Permissions []string
	SiteID      int64 `json:"site_id"`
	UserID      int64 `json:"user_id"`
}

Permissions contains Permissions for a User

type Resource

type Resource interface {
	Plural() string
	GetAll() ([]Resource, error)
}

Resource defines common methods that the resources should have

type Resources

type Resources []Resource

Resources contains multiple Resources

type Site

type Site struct {
	Description string
	ID          int64
	Name        string
}

Site contains Site definition

func (Site) GetAll

func (s Site) GetAll() ([]Resource, error)

GetAll queries NSoT for all Sites

func (*Site) MarshalJSON

func (mj *Site) MarshalJSON() ([]byte, error)

func (*Site) MarshalJSONBuf

func (mj *Site) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Site) Plural

func (s *Site) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Site) String

func (s *Site) String() string

func (*Site) UnmarshalJSON

func (uj *Site) UnmarshalJSON(input []byte) error

func (*Site) UnmarshalJSONFFLexer

func (uj *Site) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Sites

type Sites []Site

Sites contains multiple Sites

type Time

type Time struct{ time.Time }

Time is a wrapper around time.Time to provide (Un)Marshaling ffjson: skip

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() (text []byte, err error)

MarshalJSON converts from []byte into meaningful type

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(text []byte) (err error)

UnmarshalJSON converts from []byte into meaningful type

type User

type User struct {
	Email       conf.Email
	ID          int64
	Permissions Permissions
}

User contains User definition

func (User) GetAll

func (u User) GetAll() ([]Resource, error)

GetAll queries NSoT for all Users

func (*User) MarshalJSON

func (mj *User) MarshalJSON() ([]byte, error)

func (*User) MarshalJSONBuf

func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*User) Plural

func (u *User) Plural() string

Plural returns string representing lowercase-plural resource name

func (*User) String

func (u *User) String() string

func (*User) UnmarshalJSON

func (uj *User) UnmarshalJSON(input []byte) error

func (*User) UnmarshalJSONFFLexer

func (uj *User) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Users

type Users []User

Users contains multiple Users

type Value

type Value struct {
	Attribute    int64
	ID           int64
	Name         string
	ResourceID   int64  `json:"resource_id"`
	ResourceName string `json:"resource_name"`
	Value        string
}

Value contains Value definition

func (Value) GetAll

func (v Value) GetAll() ([]Resource, error)

GetAll queries NSoT for all Values

func (*Value) MarshalJSON

func (mj *Value) MarshalJSON() ([]byte, error)

func (*Value) MarshalJSONBuf

func (mj *Value) MarshalJSONBuf(buf fflib.EncodingBuffer) error

func (*Value) Plural

func (v *Value) Plural() string

Plural returns string representing lowercase-plural resource name

func (*Value) UnmarshalJSON

func (uj *Value) UnmarshalJSON(input []byte) error

func (*Value) UnmarshalJSONFFLexer

func (uj *Value) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

type Values

type Values []Value

Values contains multiple Values

Jump to

Keyboard shortcuts

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