Documentation ¶
Index ¶
- Constants
- Variables
- func CheckRequiredFlags(flags *pflag.FlagSet) error
- type Appliance
- type ApplianceDocker
- type ApplianceDynamips
- type ApplianceImage
- type ApplianceIou
- type ApplianceQemu
- type ApplianceVersion
- type Appliances
- type Compute
- type Computes
- type Gns3
- func (g *Gns3) Appliances() *Appliances
- func (g *Gns3) Computes() *Computes
- func (g *Gns3) Delete(path string) error
- func (g *Gns3) Get(path string, data interface{}) error
- func (g *Gns3) Links(id string) *Links
- func (g *Gns3) Nodes(id string) *Nodes
- func (g *Gns3) Post(path string, contentType string, in interface{}, out interface{}) error
- func (g *Gns3) Projects() *Projects
- func (g *Gns3) Put(path string, contentType string, in interface{}, out interface{}) error
- func (g *Gns3) Server() *Server
- func (g *Gns3) Templates() *Templates
- type HttpError
- type Link
- type LinkLabel
- type Links
- type Network
- type Node
- type NodeRef
- type Nodes
- type Port
- type Project
- type Projects
- func (p *Projects) Close(id string) (string, error)
- func (p *Projects) Create(project *Project) (*Project, error)
- func (p *Projects) Delete(id string) (string, error)
- func (p *Projects) Get(id string) (*Project, error)
- func (p *Projects) List() ([]Project, error)
- func (p *Projects) Open(id string) error
- type Server
- type ServerVersion
- type Template
- type TemplateDocker
- type TemplateQemu
- type Templates
Constants ¶
View Source
const ( ComputesPath = "v2/computes" ComputePath = "v2/computes/%s" )
View Source
const ( TypeNat = "nat" TypeEthernetSwitch = "eithernet_switch" TypeVpcs = "vpcs" TypeRouter = "router" TypeFirewall = "firewall" TypeMultilayerSwitch = "multilayer_switch" CategoryMultilayerSwitch = "multilayer_switch" CategorySwitch = "switch" CategoryGuest = "guest" CategoryRouter = "router" CategoryFirewall = "firewall" SymbolDockerGuest = ":/symbols/classic/docker_guest.svg" SymbolQemuGuest = ":/symbols/classic/qemu_guest.svg" SymbolRouter = ":/symbols/classic/router.svg" SymbolEthernetSwitch = ":/symbols/classic/ethernet_switch.svg" SymbolMultilayerSwitch = ":/symbols/classic/multilayer_switch.svg" SymbolFirewall = ":/symbols/classic_firewall.svg" SymbolCloud = ":/symbols/classic/cloud.svg" SymbolVpcs = ":/symbols/classic/vpcs_guest.svg" TemplateTypeQemu = "qemu" TemplateTypeIou = "iou" TemplateTypeDynamips = "dynamips" TemplateTypeDocker = "docker" )
View Source
const ( LinksPath = "v2/projects/%s/links" LinkPath = "v2/projects/%s/links/%s" )
View Source
const ( NodesPath = "v2/projects/%s/nodes" NodePath = "v2/projects/%s/nodes/%s" )
View Source
const ( ProjectsPath = "v2/projects" ProjectPath = "v2/projects/%s" ProjectOpenPath = "v2/projects/%s/open" ProjectClosePath = "v2/projects/%s/close" )
View Source
const ( ServerShutdownPath = "v2/shutdown" ServerVersionPath = "v2/version" )
View Source
const (
AppliancesPath = "v2/appliances"
)
View Source
const ImageMd5Path = "%s/images/%s/%s.md5sum"
View Source
const ImagePath = "%s/images/%s/%s"
View Source
const (
TemplatesPath = "v2/templates"
)
Variables ¶
View Source
var ( ErrNotFound = errors.New("not-found") ErrMd5Mismatch = errors.New("md5-mismatch") ErrNoProjectSpecified = errors.New("no-project-specified") )
View Source
var (
ImageTypes = map[string]string{TemplateTypeQemu: "QEMU", TemplateTypeDynamips: "IOS", TemplateTypeIou: "IOU", TemplateTypeDocker: "DOCKER"}
)
Functions ¶
func CheckRequiredFlags ¶
Types ¶
type Appliance ¶
type Appliance struct { Builtin bool `json:"builtin,omitempty" yaml:"builtin"` Category string `json:"category,omitempty" yaml:"category"` Description string `json:"description,omitempty" yaml:"description"` DocumentationUrl string `json:"documentation_url,omitempty" yaml:"documentation_url"` Images []*ApplianceImage `json:"images,omitempty" yaml:"images"` Maintainer string `json:"maintainer,omitempty" yaml:"maintainer"` MaintaineEmail string `json:"maintainer_email,omitempty" yaml:"maintainer_email"` RegistryVersion int `json:"registry_version,omitempty" yaml:"registry_version"` ProductName string `json:"product_name,omitempty" yaml:"product_name"` ProductUrl string `json:"product_url,omitempty" yaml:"product_url"` Name string `json:"name,omitempty" yaml:"name"` Symbol string `json:"symbol,omitempty" yaml:"symbol"` Status string `json:"status,omitempty" yaml:"status"` FirstPortName string `json:"first_port_name,omitempty" yaml:"first_port_name"` PortNameFormat string `json:"port_name_format,omitempty" yaml:"port_name_format"` Qemu *ApplianceQemu `json:"qemu,omitempty" yaml:"qemu"` Docker *ApplianceDocker `json:"docker,omitempty" yaml:"docker"` Iou *ApplianceIou `json:"iou,omitempty" yaml:"iou"` Dynamips *ApplianceDynamips `json:"dynamips,omitempty" yaml:"dynamips"` Usage string `json:"usage,omitempty" yaml:"usage"` VendorName string `json:"vendor_name,omitempty" yaml:"vendor_name"` VendorUrl string `json:"vendor_url,omitempty" yaml:"vendor_url"` Versions []*ApplianceVersion `json:"versions,omitempty" yaml:"versions"` }
type ApplianceDocker ¶
type ApplianceDocker struct { Image string `json:"image,omitempty" yaml:"image,omitempty"` Usage string `json:"usage,omitempty" yaml:"usage,omitempty"` Adapters int `json:"adapters,omitempty" yaml:"adapters,omitempty"` StartCommand string `json:"start_command,omitempty" yaml:"start_command,omitempty"` Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` ConsoleType string `json:"console_type,omitempty" yaml:"console_type,omitempty"` ConsoleAutoStart bool `json:"console_auto_start,omitempty" yaml:"console_auto_start,omitempty"` ConsoleHttpPort int `json:"console_http_port,omitempty" yaml:"console_http_port,omitempty"` ConsoleHttpPath string `json:"console_http_path,omitempty" yaml:"console_http_path,omitempty"` ConsoleResolution string `json:"console_resolution,omitempty" yaml:"console_resolution,omitempty"` ExtraHosts string `json:"extra_hosts,omitempty" yaml:"extra_hosts,omitempty"` ExtraVolumes []string `json:"extra_volumes,omitempty" yaml:"extra_volumes,omitempty"` CustomAdapters []*struct { Schema string `json:"$schema,omitempty" yaml:"$schema,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Type any `json:"type,omitempty" yaml:"type,omitempty"` Properties any `json:"properties,omitempty" yaml:"properties,omitempty"` Required []string `json:"required,omitempty" yaml:"required,omitempty"` AdditionalProperties bool `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` } `json:"custom_adapters,omitempty" yaml:"custom_adapters,omitempty"` }
type ApplianceDynamips ¶
type ApplianceDynamips struct{}
type ApplianceImage ¶
type ApplianceImage struct { DirectDownloadUrl string `json:"direct_download_url,omitempty" yaml:"direct_download_url"` DownloadUrl string `json:"download_url,omitempty" yaml:"download_url"` Filename string `json:"filename,omitempty" yaml:"filename"` FileSize int64 `json:"filesize,omitempty" yaml:"filesize"` Md5Sum string `json:"md5sum,omitempty" yaml:"md5sum"` Version string `json:"version,omitempty" yaml:"version"` }
type ApplianceIou ¶
type ApplianceIou struct{}
type ApplianceQemu ¶
type ApplianceQemu struct { AdapterType string `json:"adapter_type,omitempty" yaml:"adapter_type"` Adapters int `json:"adapters,omitempty" yaml:"adapters"` Arch string `json:"arch,omitempty" yaml:"arch"` BootPriority string `json:"boot_priority,omitempty" yaml:"boot_priority"` ConsoleType string `json:"console_type,omitempty" yaml:"console_type"` HdaDiskInterface string `json:"hda_disk_interface,omitempty" yaml:"hda_disk_interface"` Kvm string `json:"kvm,omitempty" yaml:"kvm"` KernelCommandLine string `json:"kernel_command_line,omitempty" yaml:"kernel_command_line"` Options string `json:"options,omitempty" yaml:"options"` Ram int64 `json:"ram,omitempty" yaml:"ram"` }
type ApplianceVersion ¶
type ApplianceVersion struct { Images struct { CdromImage string `json:"cdrom_image,omitempty" yaml:"cdrom_image"` BiosImage string `json:"bios_image,omitempty" yaml:"bios_image"` HdaDiskImage string `json:"hda_disk_image,omitempty" yaml:"hda_disk_image"` } `json:"images,omitempty" yaml:"images"` Name string `json:"name,omitempty" yaml:"name"` }
type Appliances ¶
type Appliances struct {
// contains filtered or unexported fields
}
func (*Appliances) List ¶
func (a *Appliances) List() ([]Appliance, error)
type Compute ¶
type Compute struct { Capabilities map[string]interface{} `json:"capabilities,omitempty" yaml:"capabilities"` ComputeId string `json:"compute_id,omitempty" yaml:"compute_id"` Connected bool `json:"connected,omitempty" yaml:"connected"` CpuUsagePercent float64 `json:"cpu_usage_percent,omitempty" yaml:"cpu_usage_percent"` Host string `json:"host,omitempty" yaml:"host"` LastError string `json:"last_error,omitempty" yaml:"last_error"` MemoryUsagePercent float64 `json:"memory_usage_percent,omitempty" yaml:"memory_usage_percent"` Name string `json:"name,omitempty" yaml:"name"` Port int `json:"port,omitempty" yaml:"port"` Protocol string `json:"protocol,omitempty" yaml:"protocol"` User string `json:"user,omitempty" yaml:"user"` }
type Gns3 ¶
type Gns3 struct { }
func (*Gns3) Appliances ¶
func (g *Gns3) Appliances() *Appliances
type Link ¶
type Link struct { CaptureComputeId string `json:"capture_compute_id,omitempty" yaml:"capture_compute_id"` CaptureFileName string `json:"capture_file_name,omitempty" yaml:"capture_file_name"` CaptureFilePath string `json:"capture_file_path,omitempty" yaml:"capture_file_path"` Capturing bool `json:"capturing,omitempty" yaml:"capturing"` Filters map[string]interface{} `json:"filters,omitempty" yaml:"filters"` LinkId string `json:"link_id,omitempty" yaml:"link_id"` LinkType string `json:"link_type,omitempty" yaml:"link_type"` Nodes []NodeRef `json:"nodes,omitempty" yaml:"nodes"` ProjectId string `json:"project_id,omitempty" yaml:"project_id"` Suspend bool `json:"suspend,omitempty" yaml:"suspend"` }
type Network ¶
type Network struct { ApiVersion string `json:"apiVersion" yaml:"apiVersion"` Kind string `json:"kind" yaml:"kind"` Metadata struct { Name string `json:"name" yaml:"name"` } `json:"metadata" yaml:"metadata"` Spec struct { Appliances []string `json:"appliances,omitempty" yaml:"appliances,omitempty"` Nodes []struct { Name string `json:"name,omitempty" yaml:"name"` Type string `json:"type,omitempty" yaml:"type,omitempty"` Template string `json:"template,omitempty" yaml:"template,omitempty"` ComputeId string `json:"compute_id,omitempty" yaml:"compute_id"` X int `json:"x,omitempty" yaml:"x"` Y int `json:"y,omitempty" yaml:"y"` Z int `json:"z,omitempty" yaml:"z"` Config *struct { Name string `json:"name,omitempty" yaml:"name"` Address string `json:"address,omitempty" yaml:"address"` Netmask string `json:"netmask,omitempty" yaml:"netmask"` Gateway string `json:"gateway,omitempty" yaml:"gateway"` } `json:"config,omitempty" yaml:"config"` } `json:"nodes" yaml:"nodes"` Links []struct { AEnd struct { Name string `json:"name,omitempty" yaml:"name"` Adapter int `json:"adapter,omitempty" yaml:"adapter"` Port int `json:"port,omitempty" yaml:"port"` } `json:"aEnd,omitempty" yaml:"aEnd"` ZEnd struct { Name string `json:"name,omitempty" yaml:"name"` Adapter int `json:"adapter,omitempty" yaml:"adapter"` Port int `json:"port,omitempty" yaml:"port"` } `json:"zEnd,omitempty" yaml:"zEnd"` } `json:"links" yaml:"links"` } `json:"spec" yaml:"spec"` }
type Node ¶
type Node struct { CommandLine string `json:"command_line,omitempty" yaml:"command_line,omitempty"` ComputeId string `json:"compute_id,omitempty" yaml:"compute_id,omitempty"` Console int `json:"console,omitempty" yaml:"console,omitempty"` ConsoleAutoStart bool `json:"console_auto_start,omitempty" yaml:"console_auto_start,omitempty"` ConsoleHost string `json:"console_host,omitempty" yaml:"console_host,omitempty"` ConsoleType string `json:"console_type,omitempty" yaml:"console_type,omitempty"` CustomAdapters []map[string]interface{} `json:"custom_adapters,omitempty" yaml:"custom_adapters,omitempty"` FirstPortName string `json:"first_port_name,omitempty" yaml:"first_port_name,omitempty"` Height int `json:"height,omitempty" yaml:"height,omitempty"` Label map[string]interface{} `json:"label,omitempty" yaml:"label,omitempty"` Locked bool `json:"locked,omitempty" yaml:"locked,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` NodeDirectory string `json:"node_directory,omitempty" yaml:"node_directory,omitempty"` NodeId string `json:"node_id,omitempty" yaml:"node_id,omitempty"` NodeType string `json:"node_type,omitempty" yaml:"node_type,omitempty"` PortNameFormat string `json:"port_name_format,omitempty" yaml:"port_name_format,omitempty"` PortSegmentSize int `json:"port_segment_size,omitempty" yaml:"port_segment_size,omitempty"` Ports []*Port `json:"ports,omitempty" yaml:"ports,omitempty"` ProjectId string `json:"project_id,omitempty" yaml:"project_id,omitempty"` Properties map[string]interface{} `json:"properties,omitempty" yaml:"properties,omitempty"` Status string `json:"status,omitempty" yaml:"status,omitempty"` Symbol string `json:"symbol,omitempty" yaml:"symbol,omitempty"` TemplateId string `json:"template_id,omitempty" yaml:"template_id,omitempty"` Width int `json:"width,omitempty" yaml:"width,omitempty"` X int `json:"x,omitempty" yaml:"x,omitempty"` Y int `json:"y,omitempty" yaml:"y,omitempty"` Z int `json:"z,omitempty" yaml:"z,omitempty"` }
type Nodes ¶
type Nodes struct {
// contains filtered or unexported fields
}
func (*Nodes) CreateUsingTemplate ¶
type Port ¶
type Port struct { AdapterNumber int `json:"adapter_number,omitempty" yaml:"adapter_number,omitempty"` DataLinkTypes map[string]interface{} `json:"data_link_types,omitempty" yaml:"data_link_types,omitempty"` LinkType string `json:"link_type,omitempty" yaml:"link_type,omitempty"` Name string `json:"name,omitempty" yaml:"name,omitempty"` PortNumber int `json:"port_number,omitempty" yaml:"port_number,omitempty"` ShortName string `json:"short_name,omitempty" yaml:"short_name,omitempty"` MacAddress string `json:"mac_address,omitempty" yaml:"mac_address,omitempty"` IpAddress string `json:"ip_address,omitempty" yaml:"ip_address,omitempty"` }
type Project ¶
type Project struct { AutoClose bool `json:"auto_close,omitempty"` AutoOpen bool `json:"auto_open,omitempty"` AutoStart bool `json:"auto_start,omitempty"` DrawingGridSize int `json:"drawing_grid_size,omitempty"` Filename string `json:"filename,omitempty"` GridSize int `json:"grid_size,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` ProjectId string `json:"project_id,omitempty"` SceneHeight int `json:"scene_height,omitempty"` SceneWidth int `json:"scene_width,omitempty"` ShowGrid bool `json:"show_grid,omitempty"` ShowInterfaceLabels bool `json:"show_interface_labels,omitempty"` ShowLayers bool `json:"show_layers,omitempty"` SnapToGrid bool `json:"snap_to_grid,omitempty"` Status string `json:"status,omitempty"` Zoom int `json:"zoom,omitempty"` }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Version ¶
func (s *Server) Version() (*ServerVersion, error)
type ServerVersion ¶
type Template ¶
type Template struct { Builtin bool `json:"builtin,omitempty" yaml:"builtin"` Category string `json:"category,omitempty" yaml:"category"` ComputeId string `json:"compute_id,omitempty" yaml:"compute_id"` DefaultNameFormat string `json:"default_name_format,omitempty" yaml:"default_name_format"` FirstPortName string `json:"first_port_name,omitempty" yaml:"first_port_name"` Name string `json:"name,omitempty" yaml:"name"` Symbol string `json:"symbol,omitempty" yaml:"symbol"` TemplateId string `json:"template_id,omitempty" yaml:"template_id"` TemplateType string `json:"template_type,omitempty" yaml:"template_type"` Usage string `json:"usage,omitempty" yaml:"usage"` Qemu *TemplateQemu `json:"-" yaml:"qemu"` Docker *TemplateDocker `json:"-" yaml:"docker"` }
func (Template) MarshalJSON ¶
func (*Template) UnmarshalJSON ¶
type TemplateDocker ¶
type TemplateDocker struct { Image string `json:"image,omitempty" yaml:"image,omitempty"` Usage string `json:"usage,omitempty" yaml:"usage,omitempty"` Adapters int `json:"adapters,omitempty" yaml:"adapters,omitempty"` StartCommand string `json:"start_command,omitempty" yaml:"start_command,omitempty"` Environment string `json:"environment,omitempty" yaml:"environment,omitempty"` ConsoleType string `json:"console_type,omitempty" yaml:"console_type,omitempty"` ConsoleAutoStart bool `json:"console_auto_start,omitempty" yaml:"console_auto_start,omitempty"` ConsoleHttpPort int `json:"console_http_port,omitempty" yaml:"console_http_port,omitempty"` ConsoleHttpPath string `json:"console_http_path,omitempty" yaml:"console_http_path,omitempty"` ConsoleResolution string `json:"console_resolution,omitempty" yaml:"console_resolution,omitempty"` ExtraHosts string `json:"extra_hosts,omitempty" yaml:"extra_hosts,omitempty"` ExtraVolumes []string `json:"extra_volumes,omitempty" yaml:"extra_volumes,omitempty"` CustomAdapters []*struct { Schema string `json:"$schema,omitempty" yaml:"$schema,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Type any `json:"type,omitempty" yaml:"type,omitempty"` Properties any `json:"properties,omitempty" yaml:"properties,omitempty"` Required []string `json:"required,omitempty" yaml:"required,omitempty"` AdditionalProperties bool `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` } `json:"custom_adapters,omitempty" yaml:"custom_adapters,omitempty"` }
type TemplateQemu ¶
type TemplateQemu struct { Options string `json:"options,omitempty" yaml:"options"` KernelCommandLine string `json:"kernel_command_line,omitempty" yaml:"kernel_command_line"` AdapterType string `json:"adapter_type,omitempty" yaml:"adapter_type"` Adapters int `json:"adapters,omitempty" yaml:"adapters"` BootPriority string `json:"boot_priority,omitempty" yaml:"boot_priority"` ConsoleType string `json:"console_type,omitempty" yaml:"console_type"` HdaDiskInterface string `json:"hda_disk_interface,omitempty" yaml:"hda_disk_interface"` Ram int64 `json:"ram,omitempty" yaml:"ram"` Path string `json:"qemu_path,omitempty" yaml:"qemu_path"` PortNameFormat string `json:"port_name_format,omitempty" yaml:"port_name_format"` BiosImage string `json:"bios_image,omitempty" yaml:"bios_image"` HdaDiskImage string `json:"hda_disk_image,omitempty" yaml:"hda_disk_image"` CdromImage string `json:"cdrom_image,omitempty" yaml:"cdrom_image"` }
Click to show internal directories.
Click to hide internal directories.