OLD | NEW |
| (Empty) |
1 // Nova double testing service - mimics OpenStack Nova compute service | |
2 // for testing goose against close-to-live API. | |
3 | |
4 package novaservice | |
5 | |
6 import ( | |
7 "launchpad.net/goose/nova" | |
8 "net/http" | |
9 ) | |
10 | |
11 // NovaService presents an direct-API to manipulate the internal | |
12 // state, as well as an HTTP API double for OpenStack Nova. | |
13 type NovaService interface { | |
14 // buildFlavorLinks populates the Links field as needed. | |
15 buildFlavorLinks(flavor *nova.FlavorDetail) | |
16 | |
17 // addFlavor creates a new flavor. | |
18 addFlavor(flavor nova.FlavorDetail) error | |
19 | |
20 // getFlavor retrieves an existing flavor by ID. | |
21 getFlavor(flavorId string) (*nova.FlavorDetail, error) | |
22 | |
23 // getFlavorAsEntity returns the stored FlavorDetail as Entity. | |
24 getFlavorAsEntity(flavorId string) (*nova.Entity, error) | |
25 | |
26 // allFlavors returns a list of all existing flavors. | |
27 allFlavors() []nova.FlavorDetail | |
28 | |
29 // allFlavorsAsEntities returns all flavors as Entity structs. | |
30 allFlavorsAsEntities() []nova.Entity | |
31 | |
32 // removeFlavor deletes an existing flavor. | |
33 removeFlavor(flavorId string) error | |
34 | |
35 // buildServerLinks populates the Links field as needed. | |
36 buildServerLinks(server *nova.ServerDetail) | |
37 | |
38 // addServer creates a new server. | |
39 addServer(server nova.ServerDetail) error | |
40 | |
41 // getServer retrieves an existing server by ID. | |
42 getServer(serverId string) (*nova.ServerDetail, error) | |
43 | |
44 // getServerAsEntity returns the stored ServerDetail as Entity. | |
45 getServerAsEntity(serverId string) (*nova.Entity, error) | |
46 | |
47 // allServers returns a list of all existing servers. | |
48 allServers() []nova.ServerDetail | |
49 | |
50 // allServersAsEntities returns all servers as Entity structs. | |
51 allServersAsEntities() []nova.Entity | |
52 | |
53 // removeServer deletes an existing server. | |
54 removeServer(serverId string) error | |
55 | |
56 // addSecurityGroup creates a new security group. | |
57 addSecurityGroup(group nova.SecurityGroup) error | |
58 | |
59 // getSecurityGroup retrieves an existing group by ID. | |
60 getSecurityGroup(groupId int) (*nova.SecurityGroup, error) | |
61 | |
62 // allSecurityGroups returns a list of all existing groups. | |
63 allSecurityGroups() []nova.SecurityGroup | |
64 | |
65 // removeSecurityGroup deletes an existing group. | |
66 removeSecurityGroup(groupId int) error | |
67 | |
68 // addSecurityGroupRule creates a new rule in an existing group. | |
69 addSecurityGroupRule(ruleId int, rule nova.RuleInfo) error | |
70 | |
71 // hasSecurityGroupRule returns whether the given group contains the rul
e. | |
72 hasSecurityGroupRule(groupId, ruleId int) bool | |
73 | |
74 // getSecurityGroupRule retrieves an existing rule by ID. | |
75 getSecurityGroupRule(ruleId int) (*nova.SecurityGroupRule, error) | |
76 | |
77 // removeSecurityGroupRule deletes an existing rule from its group. | |
78 removeSecurityGroupRule(ruleId int) error | |
79 | |
80 // addServerSecurityGroup attaches an existing server to a group. | |
81 addServerSecurityGroup(serverId string, groupId int) error | |
82 | |
83 // hasServerSecurityGroup returns whether the given server belongs to th
e group. | |
84 hasServerSecurityGroup(serverId string, groupId int) bool | |
85 | |
86 // removeServerSecurityGroup detaches an existing server from a group. | |
87 removeServerSecurityGroup(serverId string, groupId int) error | |
88 | |
89 // addFloatingIP creates a new floating IP address in the pool. | |
90 addFloatingIP(ip nova.FloatingIP) error | |
91 | |
92 // hasFloatingIP returns whether the given floating IP address exists. | |
93 hasFloatingIP(address string) bool | |
94 | |
95 // getFloatingIP retrieves the floating IP by ID. | |
96 getFloatingIP(ipId int) (*nova.FloatingIP, error) | |
97 | |
98 // allFloatingIPs returns a list of all created floating IPs. | |
99 allFloatingIPs() []nova.FloatingIP | |
100 | |
101 // removeFloatingIP deletes an existing floating IP by ID. | |
102 removeFloatingIP(ipId int) error | |
103 | |
104 // addServerFloatingIP attaches an existing floating IP to a server. | |
105 addServerFloatingIP(serverId string, ipId int) error | |
106 | |
107 // hasServerFloatingIP verifies the given floating IP belongs to a serve
r. | |
108 hasServerFloatingIP(serverId, address string) bool | |
109 | |
110 // removeServerFloatingIP deletes an attached floating IP from a server. | |
111 removeServerFloatingIP(serverId string, ipId int) error | |
112 | |
113 // ServeHTTP is the main entry point in the HTTP request processing. | |
114 ServeHTTP(w http.ResponseWriter, r *http.Request) | |
115 } | |
OLD | NEW |