haci

package
v0.0.0-...-9d6a3f2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(network string) (Network, error)
	List(supernet string) ([]Network, error)
	Assign(supernet string, description string, cidr int, tags []string) (Network, error)
	Delete(network string) error
	Add(network, description string, tags []string) error
	Search(description string, exact bool) ([]Network, error)
	Reset() error
	String() string
}

type FakeClient

type FakeClient struct {
	UseFirst  bool
	Supernets map[string]*FakeSupernet
	Added     map[string]Network
}

A very simple and limited client for unit tests.

func NewFakeClient

func NewFakeClient() *FakeClient

Create a new HaCi fake client.

func NewFakeClientUsesFirst

func NewFakeClientUsesFirst() *FakeClient

Create a new HaCi fake client that assigns the first (network address) of a network.

func (*FakeClient) Add

func (c *FakeClient) Add(network, description string, tags []string) error

func (*FakeClient) Assign

func (c *FakeClient) Assign(supernet, description string, cidr int, tags []string) (network1 Network, err error)

func (*FakeClient) Delete

func (c *FakeClient) Delete(network string) error

func (*FakeClient) Get

func (c *FakeClient) Get(network string) (Network, error)

func (*FakeClient) List

func (c *FakeClient) List(supernet string) (networks []Network, err error)

func (*FakeClient) Reset

func (c *FakeClient) Reset() error

func (*FakeClient) Search

func (c *FakeClient) Search(description string, exact bool) (networks []Network, err error)

func (*FakeClient) String

func (c *FakeClient) String() string

type FakeSupernet

type FakeSupernet struct {
	Networks map[string]Network
	Network  net.IPNet
	Last     net.IP
}

type Network

type Network struct {
	CreateDate  string   `json:"createDate"`
	CreateFrom  string   `json:"createFrom"`
	Description string   `json:"description"`
	Network     string   `json:"network"`
	Tags        []string `json:"tags"`
}

func (Network) IP

func (n Network) IP() (string, error)

type WebClient

type WebClient struct {
	URL  string
	Root string
	// contains filtered or unexported fields
}

func NewWebClient

func NewWebClient(url, username, password, root string) (haci *WebClient, err error)

func (*WebClient) Add

func (c *WebClient) Add(network, description string, tags []string) error

func (*WebClient) Assign

func (c *WebClient) Assign(supernet, description string, cidr int, tags []string) (network1 Network, err error)

func (*WebClient) Delete

func (c *WebClient) Delete(network string) (err error)

func (*WebClient) Get

func (c *WebClient) Get(network string) (network1 Network, err error)

func (*WebClient) List

func (c *WebClient) List(supernet string) (networks []Network, err error)

func (*WebClient) Reset

func (c *WebClient) Reset() error

func (*WebClient) Search

func (c *WebClient) Search(description string, exact bool) (networks []Network, err error)

func (*WebClient) String

func (c *WebClient) String() string

Jump to

Keyboard shortcuts

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