macbaremetal

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DirectionIngress = "ingress"
	DirectionEgress  = "egress"

	ProtocolAny  = -1
	ProtocolICMP = 1
	ProtocolTCP  = 6
	ProtocolUDP  = 17
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachedElasticIPService added in v0.2.0

type AttachedElasticIPService struct {
	// contains filtered or unexported fields
}

func NewAttachedElasticIPService added in v0.2.0

func NewAttachedElasticIPService(client goclient.Client, deviceID int) AttachedElasticIPService

func (AttachedElasticIPService) Attach added in v0.2.0

func (a AttachedElasticIPService) Attach(ctx context.Context, body ElasticIPAttach) (elasticIP ElasticIP, err error)

func (AttachedElasticIPService) Detach added in v0.2.0

func (a AttachedElasticIPService) Detach(ctx context.Context, id int) (err error)

func (AttachedElasticIPService) List added in v0.2.0

func (a AttachedElasticIPService) List(ctx context.Context, cursor goclient.Cursor) (list ElasticIPList, err error)

type AttachedNetworkInterface

type AttachedNetworkInterface struct {
	ID        int    `json:"id"`
	PrivateIP string `json:"private_ip"`
	PublicIP  string `json:"public_ip"`
}

type Device

type Device struct {
	ID                int                        `json:"id"`
	Name              string                     `json:"name"`
	Location          common.Location            `json:"location"`
	Product           common.Product             `json:"product"`
	Status            DeviceStatus               `json:"status"`
	OperatingSystem   DeviceOperatingSystem      `json:"operating_system"`
	Network           Network                    `json:"network"`
	Hostname          string                     `json:"hostname"`
	NetworkInterfaces []AttachedNetworkInterface `json:"network_interfaces"`
	Price             float64                    `json:"price"`
	MetalControl      string                     `json:"metal_control"`
	MetalControlTools string                     `json:"metal_control_tools"`
}

type DeviceAction

type DeviceAction struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Command string `json:"command"`
	Sorting int    `json:"sorting"`
}

type DeviceActionService added in v0.2.0

type DeviceActionService struct {
	// contains filtered or unexported fields
}

func NewDeviceActionService added in v0.2.0

func NewDeviceActionService(client goclient.Client, deviceID int) DeviceActionService

func (DeviceActionService) Run added in v0.2.0

func (d DeviceActionService) Run(ctx context.Context, body DeviceRunAction) (device Device, err error)

type DeviceCreate

type DeviceCreate struct {
	Name            string `json:"name"`
	LocationID      int    `json:"location_id"`
	ProductID       int    `json:"product_id"`
	NetworkID       int    `json:"network_id"`
	AttachElasticIP bool   `json:"attach_elastic_ip"`
	Password        string `json:"password"`
}

type DeviceList

type DeviceList struct {
	Items      []Device
	Pagination goclient.Pagination
}

type DeviceOperatingSystem

type DeviceOperatingSystem struct {
	OS      string `json:"os"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

type DeviceRunAction added in v0.2.0

type DeviceRunAction struct {
	Action string `json:"action"`
}

type DeviceRunWorkflow added in v0.2.0

type DeviceRunWorkflow struct {
	Workflow string `json:"workflow"`
}

type DeviceService

type DeviceService struct {
	// contains filtered or unexported fields
}

func NewDeviceService

func NewDeviceService(client goclient.Client) DeviceService

func (DeviceService) Create

func (d DeviceService) Create(ctx context.Context, body DeviceCreate) (order common.Ordering, err error)

func (DeviceService) Delete

func (d DeviceService) Delete(ctx context.Context, id int) (err error)

func (DeviceService) Get

func (d DeviceService) Get(ctx context.Context, id int) (device Device, err error)

func (DeviceService) GetVNC added in v0.2.0

func (d DeviceService) GetVNC(ctx context.Context, id int) (vnc DeviceVNCConnection, err error)

func (DeviceService) List

func (d DeviceService) List(ctx context.Context, cursor goclient.Cursor) (list DeviceList, err error)

func (DeviceService) Update

func (d DeviceService) Update(ctx context.Context, id int, body DeviceUpdate) (device Device, err error)

type DeviceStatus

type DeviceStatus struct {
	ID      int            `json:"id"`
	Name    string         `json:"name"`
	Key     string         `json:"key"`
	Actions []DeviceAction `json:"actions"`
}

type DeviceUpdate

type DeviceUpdate struct {
	Name string `json:"name,omitempty"`
}

type DeviceVNCConnection added in v0.2.0

type DeviceVNCConnection struct {
	Ref string `json:"ref"`
}

type DeviceWorkflow added in v0.2.0

type DeviceWorkflow struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	Command string `json:"command"`
	Sorting int    `json:"sorting"`
}

type DeviceWorkflowList added in v0.2.0

type DeviceWorkflowList struct {
	Items      []DeviceWorkflow
	Pagination goclient.Pagination
}

type DeviceWorkflowService added in v0.2.0

type DeviceWorkflowService struct {
	// contains filtered or unexported fields
}

func NewDeviceWorkflowService added in v0.2.0

func NewDeviceWorkflowService(client goclient.Client, deviceID int) DeviceWorkflowService

func (DeviceWorkflowService) List added in v0.2.0

func (DeviceWorkflowService) Run added in v0.2.0

func (d DeviceWorkflowService) Run(ctx context.Context, body DeviceRunWorkflow) (device Device, err error)

type ElasticIP

type ElasticIP struct {
	ID         int                 `json:"id"`
	Product    common.BriefProduct `json:"product"`
	Location   common.Location     `json:"location"`
	Price      float64             `json:"price"`
	PublicIP   string              `json:"public_ip"`
	PrivateIP  string              `json:"private_ip"`
	Attachment ElasticIPAttachment `json:"attached_device"`
}

type ElasticIPAttach added in v0.2.0

type ElasticIPAttach struct {
	ElasticIPID        int `json:"elastic_ip_id"`
	NetworkInterfaceID int `json:"network_interface_id"`
}

type ElasticIPAttachment

type ElasticIPAttachment struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type ElasticIPCreate

type ElasticIPCreate struct {
	LocationID int `json:"location_id,omitempty"`
}

type ElasticIPList

type ElasticIPList struct {
	Items      []ElasticIP
	Pagination goclient.Pagination
}

type ElasticIPService

type ElasticIPService struct {
	// contains filtered or unexported fields
}

func NewElasticIPService

func NewElasticIPService(client goclient.Client) ElasticIPService

func (ElasticIPService) Create

func (e ElasticIPService) Create(ctx context.Context, body ElasticIPCreate) (elasticIP ElasticIP, err error)

func (ElasticIPService) Delete

func (e ElasticIPService) Delete(ctx context.Context, id int) (err error)

func (ElasticIPService) List

func (e ElasticIPService) List(ctx context.Context, cursor goclient.Cursor) (list ElasticIPList, err error)

type Network

type Network struct {
	ID                  int             `json:"id"`
	Name                string          `json:"name"`
	Description         string          `json:"description"`
	Subnet              string          `json:"cidr"`
	Location            common.Location `json:"location"`
	DomainName          string          `json:"domain_name"`
	DomainNameServers   []string        `json:"domain_name_servers"`
	AllocationPoolStart string          `json:"allocation_pool_start"`
	AllocationPoolEnd   string          `json:"allocation_pool_end"`
	GatewayIP           string          `json:"gateway_ip"`
	UsedIPs             int             `json:"used_ips"`
	TotalIPs            int             `json:"total_ips"`
}

type NetworkCreate

type NetworkCreate struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	LocationID  int    `json:"location_id,omitempty"`
}

type NetworkInterface

type NetworkInterface struct {
	ID                int           `json:"id"`
	PrivateIP         string        `json:"private_ip"`
	MacAddress        string        `json:"mac_address"`
	Network           Network       `json:"network"`
	SecurityGroup     SecurityGroup `json:"security_group"`
	AttachedElasticIP ElasticIP     `json:"attached_elastic_ip"`
}

type NetworkInterfaceList

type NetworkInterfaceList struct {
	Items      []NetworkInterface
	Pagination goclient.Pagination
}

type NetworkInterfaceSecurityGroupUpdate

type NetworkInterfaceSecurityGroupUpdate struct {
	SecurityGroupID int `json:"security_group_id"`
}

type NetworkInterfaceService

type NetworkInterfaceService struct {
	// contains filtered or unexported fields
}

func NewNetworkInterfaceService

func NewNetworkInterfaceService(client goclient.Client, deviceID int) NetworkInterfaceService

func (NetworkInterfaceService) List

func (NetworkInterfaceService) UpdateSecurityGroup

func (n NetworkInterfaceService) UpdateSecurityGroup(ctx context.Context, id int, body NetworkInterfaceSecurityGroupUpdate) (networkInterface NetworkInterface, err error)

type NetworkList

type NetworkList struct {
	Items      []Network
	Pagination goclient.Pagination
}

type NetworkService

type NetworkService struct {
	// contains filtered or unexported fields
}

func NewNetworkService

func NewNetworkService(client goclient.Client) NetworkService

func (NetworkService) Create

func (n NetworkService) Create(ctx context.Context, body NetworkCreate) (network Network, err error)

func (NetworkService) Delete

func (n NetworkService) Delete(ctx context.Context, id int) (err error)

func (NetworkService) Get

func (n NetworkService) Get(ctx context.Context, id int) (network Network, err error)

func (NetworkService) List

func (n NetworkService) List(ctx context.Context, cursor goclient.Cursor) (list NetworkList, err error)

func (NetworkService) Update

func (n NetworkService) Update(ctx context.Context, id int, body NetworkUpdate) (network Network, err error)

type NetworkUpdate

type NetworkUpdate struct {
	Name              string   `json:"name,omitempty"`
	Description       string   `json:"description,omitempty"`
	DomainName        string   `json:"domain_name,omitempty"`
	DomainNameServers []string `json:"domain_name_servers,omitempty"`
}

type Router

type Router struct {
	ID          int             `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Location    common.Location `json:"location"`
	Public      bool            `json:"public"`
	SourceNAT   bool            `json:"snat"`
	PublicIP    string          `json:"public_ip"`
}

type RouterInterface

type RouterInterface struct {
	ID        int     `json:"id"`
	PrivateIP string  `json:"private_ip"`
	Network   Network `json:"network"`
}

type RouterInterfaceList

type RouterInterfaceList struct {
	Items      []RouterInterface
	Pagination goclient.Pagination
}

type RouterInterfaceService

type RouterInterfaceService struct {
	// contains filtered or unexported fields
}

func NewRouterInterfaceService

func NewRouterInterfaceService(client goclient.Client, routerID int) RouterInterfaceService

func (RouterInterfaceService) List

type RouterList

type RouterList struct {
	Items      []Router
	Pagination goclient.Pagination
}

type RouterService

type RouterService struct {
	// contains filtered or unexported fields
}

func NewRouterService

func NewRouterService(client goclient.Client) RouterService

func (RouterService) Get

func (r RouterService) Get(ctx context.Context, id int) (router Router, err error)

func (RouterService) List

func (r RouterService) List(ctx context.Context, cursor goclient.Cursor) (list RouterList, err error)

func (RouterService) RouterInterfaces

func (r RouterService) RouterInterfaces(routerID int) RouterInterfaceService

func (RouterService) Update

func (r RouterService) Update(ctx context.Context, id int, body RouterUpdate) (router Router, err error)

type RouterUpdate

type RouterUpdate struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type SecurityGroup

type SecurityGroup struct {
	ID          int     `json:"id"`
	Name        string  `json:"name"`
	Description string  `json:"description"`
	Default     bool    `json:"default"`
	Network     Network `json:"network"`
}

type SecurityGroupCreate

type SecurityGroupCreate struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	NetworkID   int    `json:"network_id"`
}

type SecurityGroupList

type SecurityGroupList struct {
	Items      []SecurityGroup
	Pagination goclient.Pagination
}

type SecurityGroupRule

type SecurityGroupRule struct {
	ID        int    `json:"id"`
	Direction string `json:"direction"`
	Protocol  int    `json:"protocol"`
	FromPort  int    `json:"from_port"`
	ToPort    int    `json:"to_port"`
	ICMPType  int    `json:"icmp_type"`
	ICMPCode  int    `json:"icmp_code"`
	IPRange   string `json:"ip_range"`
}

type SecurityGroupRuleList

type SecurityGroupRuleList struct {
	Items      []SecurityGroupRule
	Pagination goclient.Pagination
}

type SecurityGroupRuleOptions

type SecurityGroupRuleOptions struct {
	Direction string `json:"direction,omitempty"`
	Protocol  int    `json:"protocol,omitempty"`
	FromPort  int    `json:"from_port,omitempty"`
	ToPort    int    `json:"to_port,omitempty"`
	ICMPType  int    `json:"icmp_type,omitempty"`
	ICMPCode  int    `json:"icmp_code,omitempty"`
	IPRange   string `json:"ip_range,omitempty"`
}

type SecurityGroupRuleService

type SecurityGroupRuleService struct {
	// contains filtered or unexported fields
}

func NewSecurityGroupRuleService

func NewSecurityGroupRuleService(client goclient.Client, securityGroupID int) SecurityGroupRuleService

func (SecurityGroupRuleService) Create

func (SecurityGroupRuleService) Delete

func (s SecurityGroupRuleService) Delete(ctx context.Context, id int) (err error)

func (SecurityGroupRuleService) List

func (SecurityGroupRuleService) Update

type SecurityGroupService

type SecurityGroupService struct {
	// contains filtered or unexported fields
}

func NewSecurityGroupService

func NewSecurityGroupService(client goclient.Client) SecurityGroupService

func (SecurityGroupService) Create

func (s SecurityGroupService) Create(ctx context.Context, body SecurityGroupCreate) (securityGroup SecurityGroup, err error)

func (SecurityGroupService) Delete

func (s SecurityGroupService) Delete(ctx context.Context, id int) (err error)

func (SecurityGroupService) Get added in v0.2.5

func (s SecurityGroupService) Get(ctx context.Context, id int) (securityGroup SecurityGroup, err error)

func (SecurityGroupService) List

func (s SecurityGroupService) List(ctx context.Context, cursor goclient.Cursor) (list SecurityGroupList, err error)

func (SecurityGroupService) Rules

func (s SecurityGroupService) Rules(securityGroupID int) SecurityGroupRuleService

func (SecurityGroupService) Update

func (s SecurityGroupService) Update(ctx context.Context, id int, body SecurityGroupUpdate) (securityGroup SecurityGroup, err error)

type SecurityGroupUpdate

type SecurityGroupUpdate struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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