Documentation ¶
Index ¶
- Variables
- type CloudAPI
- func (c *CloudAPI) AddMachineTags(machineID string, tags map[string]string) (map[string]string, error)
- func (c *CloudAPI) AddNIC(machineID, networkID string) (*cloudapi.NIC, error)
- func (c *CloudAPI) CountMachines() (int, error)
- func (c *CloudAPI) CreateFabricNetwork(vlanID int16, opts cloudapi.CreateFabricNetworkOpts) (*cloudapi.FabricNetwork, error)
- func (c *CloudAPI) CreateFabricVLAN(vlan cloudapi.FabricVLAN) (*cloudapi.FabricVLAN, error)
- func (c *CloudAPI) CreateFirewallRule(rule string, enabled bool) (*cloudapi.FirewallRule, error)
- func (c *CloudAPI) CreateKey(keyName, key string) (*cloudapi.Key, error)
- func (c *CloudAPI) CreateMachine(name, pkg, image string, networks []string, metadata, tags map[string]string) (*cloudapi.Machine, error)
- func (c *CloudAPI) DeleteAllMachineMetadata(machineID string) error
- func (c *CloudAPI) DeleteFabricNetwork(vlanID int16, networkID string) error
- func (c *CloudAPI) DeleteFabricVLAN(vlanID int16) error
- func (c *CloudAPI) DeleteFirewallRule(fwRuleID string) error
- func (c *CloudAPI) DeleteKey(keyName string) error
- func (c *CloudAPI) DeleteMachine(machineID string) error
- func (c *CloudAPI) DeleteMachineMetadata(machineID string, key string) error
- func (c *CloudAPI) DeleteMachineTag(machineID, tagKey string) error
- func (c *CloudAPI) DeleteMachineTags(machineID string) error
- func (c *CloudAPI) DisableFirewallMachine(machineID string) error
- func (c *CloudAPI) DisableFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
- func (c *CloudAPI) EnableFirewallMachine(machineID string) error
- func (c *CloudAPI) EnableFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
- func (c *CloudAPI) GetFabricNetwork(vlanID int16, networkID string) (*cloudapi.FabricNetwork, error)
- func (c *CloudAPI) GetFabricVLAN(vlanID int16) (*cloudapi.FabricVLAN, error)
- func (c *CloudAPI) GetFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
- func (c *CloudAPI) GetImage(imageID string) (*cloudapi.Image, error)
- func (c *CloudAPI) GetKey(keyName string) (*cloudapi.Key, error)
- func (c *CloudAPI) GetMachine(machineID string) (*cloudapi.Machine, error)
- func (c *CloudAPI) GetMachineMetadata(machineID string) (map[string]string, error)
- func (c *CloudAPI) GetMachineTag(machineID, tagKey string) (string, error)
- func (c *CloudAPI) GetNIC(machineID, MAC string) (*cloudapi.NIC, error)
- func (c *CloudAPI) GetNetwork(networkID string) (*cloudapi.Network, error)
- func (c *CloudAPI) GetPackage(packageName string) (*cloudapi.Package, error)
- func (c *CloudAPI) ListFabricNetworks(vlanID int16) ([]cloudapi.FabricNetwork, error)
- func (c *CloudAPI) ListFabricVLANs() ([]cloudapi.FabricVLAN, error)
- func (c *CloudAPI) ListFirewallRuleMachines(fwRuleID string) ([]*cloudapi.Machine, error)
- func (c *CloudAPI) ListFirewallRules() ([]*cloudapi.FirewallRule, error)
- func (c *CloudAPI) ListImages(filters map[string]string) ([]cloudapi.Image, error)
- func (c *CloudAPI) ListKeys() ([]cloudapi.Key, error)
- func (c *CloudAPI) ListMachineFirewallRules(machineID string) ([]*cloudapi.FirewallRule, error)
- func (c *CloudAPI) ListMachineTags(machineID string) (map[string]string, error)
- func (c *CloudAPI) ListMachines(filters map[string]string) ([]*cloudapi.Machine, error)
- func (c *CloudAPI) ListNICs(machineID string) ([]cloudapi.NIC, error)
- func (c *CloudAPI) ListNetworks() ([]cloudapi.Network, error)
- func (c *CloudAPI) ListPackages(filters map[string]string) ([]cloudapi.Package, error)
- func (c *CloudAPI) RebootMachine(machineID string) error
- func (c *CloudAPI) RemoveNIC(machineID, MAC string) error
- func (c *CloudAPI) RenameMachine(machineID, newName string) error
- func (c *CloudAPI) ReplaceMachineTags(machineID string, tags map[string]string) (map[string]string, error)
- func (c *CloudAPI) ResizeMachine(machineID, packageName string) error
- func (c *CloudAPI) SetupHTTP(mux *httprouter.Router)
- func (c *CloudAPI) StartMachine(machineID string) error
- func (c *CloudAPI) StopMachine(machineID string) error
- func (c *CloudAPI) UpdateFabricVLAN(new cloudapi.FabricVLAN) (*cloudapi.FabricVLAN, error)
- func (c *CloudAPI) UpdateFirewallRule(fwRuleID, rule string, enabled bool) (*cloudapi.FirewallRule, error)
- func (c *CloudAPI) UpdateMachineMetadata(machineID string, metadata map[string]string) (map[string]string, error)
- type ErrorResponse
- type MethodNotAllowed
- type NotFound
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotAllowed is returned when the request's method is not allowed ErrNotAllowed = &ErrorResponse{ http.StatusMethodNotAllowed, "Method is not allowed", "text/plain; charset=UTF-8", "MethodNotAllowedError", nil, nil, } // ErrNotFound is returned when the requested resource is not found ErrNotFound = &ErrorResponse{ http.StatusNotFound, "Resource Not Found", "text/plain; charset=UTF-8", "NotFoundError", nil, nil, } // ErrBadRequest is returned when the request is malformed or incorrect ErrBadRequest = &ErrorResponse{ http.StatusBadRequest, "Malformed request url", "text/plain; charset=UTF-8", "BadRequestError", nil, nil, } )
Functions ¶
This section is empty.
Types ¶
type CloudAPI ¶
type CloudAPI struct { localservices.ServiceInstance // contains filtered or unexported fields }
CloudAPI is the API test double
func (*CloudAPI) AddMachineTags ¶
func (c *CloudAPI) AddMachineTags(machineID string, tags map[string]string) (map[string]string, error)
AddMachineTags adds additional tags to the specified machine. This API lets you append new tags, not overwrite existing tags.
func (*CloudAPI) CountMachines ¶
CountMachines returns a count of machines the double knows about
func (*CloudAPI) CreateFabricNetwork ¶
func (c *CloudAPI) CreateFabricNetwork(vlanID int16, opts cloudapi.CreateFabricNetworkOpts) (*cloudapi.FabricNetwork, error)
CreateFabricNetwork creates a new fabric network
func (*CloudAPI) CreateFabricVLAN ¶
func (c *CloudAPI) CreateFabricVLAN(vlan cloudapi.FabricVLAN) (*cloudapi.FabricVLAN, error)
CreateFabricVLAN creates a new VLAN with the specified options
func (*CloudAPI) CreateFirewallRule ¶
CreateFirewallRule creates a new firewall rule and returns it
func (*CloudAPI) CreateMachine ¶
func (c *CloudAPI) CreateMachine(name, pkg, image string, networks []string, metadata, tags map[string]string) (*cloudapi.Machine, error)
CreateMachine creates a new machine in the double. It will be running immediately.
func (*CloudAPI) DeleteAllMachineMetadata ¶
DeleteAllMachineMetadata deletes all metadata keys from the specified machine.
func (*CloudAPI) DeleteFabricNetwork ¶
DeleteFabricNetwork deletes an existing fabric network
func (*CloudAPI) DeleteFabricVLAN ¶
DeleteFabricVLAN delets a given VLAN as specified by ID
func (*CloudAPI) DeleteFirewallRule ¶
DeleteFirewallRule deletes the given firewall rule
func (*CloudAPI) DeleteMachine ¶
DeleteMachine deletes the given machine from the double
func (*CloudAPI) DeleteMachineMetadata ¶
DeleteMachineMetadata deletes a single metadata key from the specified machine
func (*CloudAPI) DeleteMachineTag ¶
func (*CloudAPI) DeleteMachineTags ¶
DeleteMachineTags deletes all tags from the specified machine.
func (*CloudAPI) DisableFirewallMachine ¶
DisableFirewallMachine disables the firewall for the given machine
func (*CloudAPI) DisableFirewallRule ¶
func (c *CloudAPI) DisableFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
DisableFirewallRule disables the given firewall rule
func (*CloudAPI) EnableFirewallMachine ¶
EnableFirewallMachine enables the firewall for the given machine
func (*CloudAPI) EnableFirewallRule ¶
func (c *CloudAPI) EnableFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
EnableFirewallRule enables the given firewall rule
func (*CloudAPI) GetFabricNetwork ¶
func (c *CloudAPI) GetFabricNetwork(vlanID int16, networkID string) (*cloudapi.FabricNetwork, error)
GetFabricNetwork gets a single network by VLAN and Network IDs
func (*CloudAPI) GetFabricVLAN ¶
func (c *CloudAPI) GetFabricVLAN(vlanID int16) (*cloudapi.FabricVLAN, error)
GetFabricVLAN retrieves a single VLAN by ID
func (*CloudAPI) GetFirewallRule ¶
func (c *CloudAPI) GetFirewallRule(fwRuleID string) (*cloudapi.FirewallRule, error)
GetFirewallRule gets a single firewall rule by ID
func (*CloudAPI) GetMachine ¶
GetMachine gets a single machine by ID from the double
func (*CloudAPI) GetMachineMetadata ¶
GetMachineMetadata returns the complete set of metadata associated with the specified machine.
func (*CloudAPI) GetMachineTag ¶
GetMachineTag returns the value for a single tag on the specified machine.
func (*CloudAPI) GetNetwork ¶
GetNetwork gets a network by ID
func (*CloudAPI) GetPackage ¶
GetPackage gets a single package in the double
func (*CloudAPI) ListFabricNetworks ¶
func (c *CloudAPI) ListFabricNetworks(vlanID int16) ([]cloudapi.FabricNetwork, error)
ListFabricNetworks lists the networks inside the given VLAN
func (*CloudAPI) ListFabricVLANs ¶
func (c *CloudAPI) ListFabricVLANs() ([]cloudapi.FabricVLAN, error)
ListFabricVLANs lists VLANs
func (*CloudAPI) ListFirewallRuleMachines ¶
ListFirewallRuleMachines should list the machines that are affected by a given firewall rule. In this double, it just returns all the machines.
func (*CloudAPI) ListFirewallRules ¶
func (c *CloudAPI) ListFirewallRules() ([]*cloudapi.FirewallRule, error)
ListFirewallRules gets a list of firewall rules from the double
func (*CloudAPI) ListImages ¶
ListImages returns a list of images in the double
func (*CloudAPI) ListMachineFirewallRules ¶
func (c *CloudAPI) ListMachineFirewallRules(machineID string) ([]*cloudapi.FirewallRule, error)
ListMachineFirewallRules returns a list of firewall rules that apply to the given machine
func (*CloudAPI) ListMachineTags ¶
ListMachineTags returns the complete set of tags associated with the specified machine.
func (*CloudAPI) ListMachines ¶
ListMachines returns a list of machines in the double
func (*CloudAPI) ListNetworks ¶
ListNetworks returns a list of networks that the double knows about
func (*CloudAPI) ListPackages ¶
ListPackages lists packages in the double
func (*CloudAPI) RebootMachine ¶
RebootMachine changes a machine's state to "running" and updates Updated
func (*CloudAPI) RenameMachine ¶
RenameMachine changes a machine's name
func (*CloudAPI) ReplaceMachineTags ¶
func (c *CloudAPI) ReplaceMachineTags(machineID string, tags map[string]string) (map[string]string, error)
ReplaceMachineTags replaces existing tags for the specified machine. This API lets you overwrite existing tags, not append to existing tags.
func (*CloudAPI) ResizeMachine ¶
ResizeMachine changes a machine's package to a new size. Unlike the real API, this method lets you downsize machines.
func (*CloudAPI) SetupHTTP ¶
func (c *CloudAPI) SetupHTTP(mux *httprouter.Router)
SetupHTTP attaches all the needed handlers to provide the HTTP API.
func (*CloudAPI) StartMachine ¶
StartMachine changes a machine's state to "running"
func (*CloudAPI) StopMachine ¶
StopMachine changes a machine's status to "stopped"
func (*CloudAPI) UpdateFabricVLAN ¶
func (c *CloudAPI) UpdateFabricVLAN(new cloudapi.FabricVLAN) (*cloudapi.FabricVLAN, error)
UpdateFabricVLAN updates a given VLAN with new fields
func (*CloudAPI) UpdateFirewallRule ¶
func (c *CloudAPI) UpdateFirewallRule(fwRuleID, rule string, enabled bool) (*cloudapi.FirewallRule, error)
UpdateFirewallRule makes changes to a given firewall rule
func (*CloudAPI) UpdateMachineMetadata ¶
func (c *CloudAPI) UpdateMachineMetadata(machineID string, metadata map[string]string) (map[string]string, error)
UpdateMachineMetadata updates the metadata for a given machine. Any metadata keys passed in here are created if they do not exist, and overwritten if they do.
type ErrorResponse ¶
ErrorResponse defines a single HTTP error response.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
func (*ErrorResponse) ServeHTTP ¶
func (e *ErrorResponse) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MethodNotAllowed ¶
type MethodNotAllowed struct{}
func (MethodNotAllowed) ServeHTTP ¶
func (MethodNotAllowed) ServeHTTP(w http.ResponseWriter, r *http.Request)