blob: 6ca8d24dcc6c36bda57f9cd6410e7d34af05ae45 [file] [log] [blame]
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -07001// TODO(sfalvo): Remove Rackspace-specific Server structure fields and refactor them into a provider-specific access method.
2// Be sure to update godocs accordingly.
3
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -07004package gophercloud
5
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -07006import (
Samuel A. Falvo II5c305e12013-07-25 19:19:43 -07007 "fmt"
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -07008 "github.com/racker/perigee"
Mark Peek6b57c232013-08-24 19:03:26 -07009 "strings"
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070010)
11
Samuel A. Falvo II1dd740a2013-07-08 15:48:40 -070012// genericServersProvider structures provide the implementation for generic OpenStack-compatible
13// CloudServersProvider interfaces.
14type genericServersProvider struct {
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070015 // endpoint refers to the provider's API endpoint base URL. This will be used to construct
16 // and issue queries.
17 endpoint string
18
19 // Test context (if any) in which to issue requests.
20 context *Context
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070021
22 // access associates this API provider with a set of credentials,
23 // which may be automatically renewed if they near expiration.
24 access AccessProvider
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070025}
26
Samuel A. Falvo II1dd740a2013-07-08 15:48:40 -070027// See the CloudServersProvider interface for details.
Samuel A. Falvo IIa0a55842013-07-24 13:14:17 -070028func (gcp *genericServersProvider) ListServersLinksOnly() ([]Server, error) {
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070029 var ss []Server
30
Samuel A. Falvo II7bd1fba2013-07-16 17:30:43 -070031 err := gcp.context.WithReauth(gcp.access, func() error {
32 url := gcp.endpoint + "/servers"
33 return perigee.Get(url, perigee.Options{
34 CustomClient: gcp.context.httpClient,
35 Results: &struct{ Servers *[]Server }{&ss},
36 MoreHeaders: map[string]string{
37 "X-Auth-Token": gcp.access.AuthToken(),
38 },
39 })
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070040 })
41 return ss, err
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070042}
43
Samuel A. Falvo II02f5e832013-07-10 13:52:27 -070044// See the CloudServersProvider interface for details.
Samuel A. Falvo IIa0a55842013-07-24 13:14:17 -070045func (gcp *genericServersProvider) ListServers() ([]Server, error) {
46 var ss []Server
47
48 err := gcp.context.WithReauth(gcp.access, func() error {
49 url := gcp.endpoint + "/servers/detail"
50 return perigee.Get(url, perigee.Options{
51 CustomClient: gcp.context.httpClient,
52 Results: &struct{ Servers *[]Server }{&ss},
53 MoreHeaders: map[string]string{
54 "X-Auth-Token": gcp.access.AuthToken(),
55 },
56 })
57 })
58 return ss, err
59}
60
61// See the CloudServersProvider interface for details.
Samuel A. Falvo II02f5e832013-07-10 13:52:27 -070062func (gsp *genericServersProvider) ServerById(id string) (*Server, error) {
63 var s *Server
64
Samuel A. Falvo II7bd1fba2013-07-16 17:30:43 -070065 err := gsp.context.WithReauth(gsp.access, func() error {
66 url := gsp.endpoint + "/servers/" + id
67 return perigee.Get(url, perigee.Options{
68 Results: &struct{ Server **Server }{&s},
69 MoreHeaders: map[string]string{
70 "X-Auth-Token": gsp.access.AuthToken(),
71 },
72 })
Samuel A. Falvo II02f5e832013-07-10 13:52:27 -070073 })
74 return s, err
75}
76
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -070077// See the CloudServersProvider interface for details.
78func (gsp *genericServersProvider) CreateServer(ns NewServer) (*NewServer, error) {
79 var s *NewServer
80
Samuel A. Falvo II7bd1fba2013-07-16 17:30:43 -070081 err := gsp.context.WithReauth(gsp.access, func() error {
82 ep := gsp.endpoint + "/servers"
83 return perigee.Post(ep, perigee.Options{
84 ReqBody: &struct {
85 Server *NewServer `json:"server"`
86 }{&ns},
87 Results: &struct{ Server **NewServer }{&s},
88 MoreHeaders: map[string]string{
89 "X-Auth-Token": gsp.access.AuthToken(),
90 },
91 OkCodes: []int{202},
92 })
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -070093 })
Samuel A. Falvo II7bd1fba2013-07-16 17:30:43 -070094
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -070095 return s, err
96}
97
Samuel A. Falvo II286e4de2013-07-12 11:33:31 -070098// See the CloudServersProvider interface for details.
99func (gsp *genericServersProvider) DeleteServerById(id string) error {
Samuel A. Falvo II7bd1fba2013-07-16 17:30:43 -0700100 err := gsp.context.WithReauth(gsp.access, func() error {
101 url := gsp.endpoint + "/servers/" + id
102 return perigee.Delete(url, perigee.Options{
103 MoreHeaders: map[string]string{
104 "X-Auth-Token": gsp.access.AuthToken(),
105 },
106 OkCodes: []int{204},
107 })
Samuel A. Falvo II286e4de2013-07-12 11:33:31 -0700108 })
109 return err
110}
111
Samuel A. Falvo II5c305e12013-07-25 19:19:43 -0700112// See the CloudServersProvider interface for details.
113func (gsp *genericServersProvider) SetAdminPassword(id, pw string) error {
114 err := gsp.context.WithReauth(gsp.access, func() error {
115 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
116 return perigee.Post(url, perigee.Options{
117 ReqBody: &struct {
118 ChangePassword struct {
119 AdminPass string `json:"adminPass"`
120 } `json:"changePassword"`
121 }{
122 struct {
123 AdminPass string `json:"adminPass"`
124 }{pw},
125 },
126 OkCodes: []int{202},
127 MoreHeaders: map[string]string{
128 "X-Auth-Token": gsp.access.AuthToken(),
129 },
130 })
131 })
132 return err
133}
134
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700135// See the CloudServersProvider interface for details.
136func (gsp *genericServersProvider) ResizeServer(id, newName, newFlavor, newDiskConfig string) error {
137 err := gsp.context.WithReauth(gsp.access, func() error {
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700138 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
139 rr := ResizeRequest{
140 Name: newName,
141 FlavorRef: newFlavor,
142 DiskConfig: newDiskConfig,
143 }
144 return perigee.Post(url, perigee.Options{
145 ReqBody: &struct {
146 Resize ResizeRequest `json:"resize"`
147 }{rr},
148 OkCodes: []int{202},
149 MoreHeaders: map[string]string{
150 "X-Auth-Token": gsp.access.AuthToken(),
151 },
152 })
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700153 })
154 return err
155}
156
157// See the CloudServersProvider interface for details.
158func (gsp *genericServersProvider) RevertResize(id string) error {
159 err := gsp.context.WithReauth(gsp.access, func() error {
160 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
161 return perigee.Post(url, perigee.Options{
162 ReqBody: &struct {
163 RevertResize *int `json:"revertResize"`
164 }{nil},
165 OkCodes: []int{202},
166 MoreHeaders: map[string]string{
167 "X-Auth-Token": gsp.access.AuthToken(),
168 },
169 })
170 })
171 return err
172}
173
174// See the CloudServersProvider interface for details.
175func (gsp *genericServersProvider) ConfirmResize(id string) error {
176 err := gsp.context.WithReauth(gsp.access, func() error {
177 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
178 return perigee.Post(url, perigee.Options{
179 ReqBody: &struct {
180 ConfirmResize *int `json:"confirmResize"`
181 }{nil},
182 OkCodes: []int{204},
183 MoreHeaders: map[string]string{
184 "X-Auth-Token": gsp.access.AuthToken(),
185 },
186 })
187 })
188 return err
189}
190
Samuel A. Falvo IIadbecf92013-07-30 13:13:59 -0700191// See the CloudServersProvider interface for details
192func (gsp *genericServersProvider) RebootServer(id string, hard bool) error {
193 return gsp.context.WithReauth(gsp.access, func() error {
194 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
195 types := map[bool]string{false: "SOFT", true: "HARD"}
196 return perigee.Post(url, perigee.Options{
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700197 ReqBody: &struct {
Samuel A. Falvo IIadbecf92013-07-30 13:13:59 -0700198 Reboot struct {
199 Type string `json:"type"`
200 } `json:"reboot"`
201 }{
202 struct {
203 Type string `json:"type"`
204 }{types[hard]},
205 },
206 OkCodes: []int{202},
207 MoreHeaders: map[string]string{
208 "X-Auth-Token": gsp.access.AuthToken(),
209 },
210 })
211 })
212}
213
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700214// See the CloudServersProvider interface for details
215func (gsp *genericServersProvider) RescueServer(id string) (string, error) {
216 var pw *string
217
218 err := gsp.context.WithReauth(gsp.access, func() error {
219 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
220 return perigee.Post(url, perigee.Options{
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700221 ReqBody: &struct {
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700222 Rescue string `json:"rescue"`
223 }{"none"},
224 MoreHeaders: map[string]string{
225 "X-Auth-Token": gsp.access.AuthToken(),
226 },
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700227 Results: &struct {
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700228 AdminPass **string `json:"adminPass"`
229 }{&pw},
230 })
231 })
232 return *pw, err
233}
234
235// See the CloudServersProvider interface for details
236func (gsp *genericServersProvider) UnrescueServer(id string) error {
237 return gsp.context.WithReauth(gsp.access, func() error {
238 url := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
239 return perigee.Post(url, perigee.Options{
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700240 ReqBody: &struct {
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700241 Unrescue *int `json:"unrescue"`
242 }{nil},
243 MoreHeaders: map[string]string{
244 "X-Auth-Token": gsp.access.AuthToken(),
245 },
246 OkCodes: []int{202},
247 })
248 })
249}
250
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700251// See the CloudServersProvider interface for details
252func (gsp *genericServersProvider) UpdateServer(id string, changes NewServerSettings) (*Server, error) {
253 var svr *Server
254 err := gsp.context.WithReauth(gsp.access, func() error {
255 url := fmt.Sprintf("%s/servers/%s", gsp.endpoint, id)
256 return perigee.Put(url, perigee.Options{
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700257 ReqBody: &struct {
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700258 Server NewServerSettings `json:"server"`
259 }{changes},
260 MoreHeaders: map[string]string{
261 "X-Auth-Token": gsp.access.AuthToken(),
262 },
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700263 Results: &struct {
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700264 Server **Server `json:"server"`
265 }{&svr},
266 })
267 })
268 return svr, err
269}
270
Samuel A. Falvo II414c15c2013-08-01 15:16:46 -0700271// See the CloudServersProvider interface for details.
Samuel A. Falvo IIf3391602013-08-14 14:53:32 -0700272func (gsp *genericServersProvider) RebuildServer(id string, ns NewServer) (*Server, error) {
Samuel A. Falvo II414c15c2013-08-01 15:16:46 -0700273 var s *Server
274
275 err := gsp.context.WithReauth(gsp.access, func() error {
276 ep := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
277 return perigee.Post(ep, perigee.Options{
278 ReqBody: &struct {
279 Rebuild *NewServer `json:"rebuild"`
280 }{&ns},
281 Results: &struct{ Server **Server }{&s},
282 MoreHeaders: map[string]string{
283 "X-Auth-Token": gsp.access.AuthToken(),
284 },
285 OkCodes: []int{202},
286 })
287 })
288
289 return s, err
290}
291
Samuel A. Falvo IIe21808f2013-08-14 14:48:09 -0700292// See the CloudServersProvider interface for details.
293func (gsp *genericServersProvider) ListAddresses(id string) (AddressSet, error) {
294 var pas *AddressSet
295 var statusCode int
296
297 err := gsp.context.WithReauth(gsp.access, func() error {
298 ep := fmt.Sprintf("%s/servers/%s/ips", gsp.endpoint, id)
299 return perigee.Get(ep, perigee.Options{
300 Results: &struct{ Addresses **AddressSet }{&pas},
301 MoreHeaders: map[string]string{
302 "X-Auth-Token": gsp.access.AuthToken(),
303 },
Samuel A. Falvo IIf3391602013-08-14 14:53:32 -0700304 OkCodes: []int{200, 203},
Samuel A. Falvo IIe21808f2013-08-14 14:48:09 -0700305 StatusCode: &statusCode,
306 })
307 })
308
309 if err != nil {
310 if statusCode == 203 {
311 err = WarnUnauthoritative
312 }
313 }
314
315 return *pas, err
316}
317
Mark Peek6b57c232013-08-24 19:03:26 -0700318// See the CloudServersProvider interface for details.
319func (gsp *genericServersProvider) CreateImage(id string, ci CreateImage) (string, error) {
320 response, err := gsp.context.ResponseWithReauth(gsp.access, func() (*perigee.Response, error) {
321 ep := fmt.Sprintf("%s/servers/%s/action", gsp.endpoint, id)
322 return perigee.Request("POST", ep, perigee.Options{
323 ReqBody: &struct {
324 CreateImage *CreateImage `json:"createImage"`
325 }{&ci},
326 MoreHeaders: map[string]string{
327 "X-Auth-Token": gsp.access.AuthToken(),
328 },
Mark Peek7d3e09d2013-08-27 07:57:18 -0700329 OkCodes: []int{200, 202},
Mark Peek6b57c232013-08-24 19:03:26 -0700330 })
331 })
332
333 if err != nil {
334 return "", err
335 }
336 location, err := response.HttpResponse.Location()
337 if err != nil {
338 return "", err
339 }
340
341 // Return the last element of the location which is the image id
342 locationArr := strings.Split(location.Path, "/")
343 return locationArr[len(locationArr)-1], err
344}
345
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -0700346// RaxBandwidth provides measurement of server bandwidth consumed over a given audit interval.
347type RaxBandwidth struct {
348 AuditPeriodEnd string `json:"audit_period_end"`
349 AuditPeriodStart string `json:"audit_period_start"`
350 BandwidthInbound int64 `json:"bandwidth_inbound"`
351 BandwidthOutbound int64 `json:"bandwidth_outbound"`
352 Interface string `json:"interface"`
353}
354
355// A VersionedAddress denotes either an IPv4 or IPv6 (depending on version indicated)
356// address.
357type VersionedAddress struct {
358 Addr string `json:"addr"`
359 Version int `json:"version"`
360}
361
362// An AddressSet provides a set of public and private IP addresses for a resource.
363// Each address has a version to identify if IPv4 or IPv6.
364type AddressSet struct {
365 Public []VersionedAddress `json:"public"`
366 Private []VersionedAddress `json:"private"`
367}
368
369// Server records represent (virtual) hardware instances (not configurations) accessible by the user.
370//
371// The AccessIPv4 / AccessIPv6 fields provides IP addresses for the server in the IPv4 or IPv6 format, respectively.
372//
373// Addresses provides addresses for any attached isolated networks.
374// The version field indicates whether the IP address is version 4 or 6.
375//
376// Created tells when the server entity was created.
377//
378// The Flavor field includes the flavor ID and flavor links.
379//
380// The compute provisioning algorithm has an anti-affinity property that
381// attempts to spread customer VMs across hosts.
382// Under certain situations,
383// VMs from the same customer might be placed on the same host.
384// The HostId field represents the host your server runs on and
385// can be used to determine this scenario if it is relevant to your application.
386// Note that HostId is unique only per account; it is not globally unique.
Mark Peeka2818af2013-08-24 15:01:12 -0700387//
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -0700388// Id provides the server's unique identifier.
389// This field must be treated opaquely.
390//
391// Image indicates which image is installed on the server.
392//
393// Links provides one or more means of accessing the server.
394//
395// Metadata provides a small key-value store for application-specific information.
396//
397// Name provides a human-readable name for the server.
398//
399// Progress indicates how far along it is towards being provisioned.
400// 100 represents complete, while 0 represents just beginning.
401//
402// Status provides an indication of what the server's doing at the moment.
403// A server will be in ACTIVE state if it's ready for use.
404//
405// OsDcfDiskConfig indicates the server's boot volume configuration.
406// Valid values are:
407// AUTO
408// ----
409// The server is built with a single partition the size of the target flavor disk.
410// The file system is automatically adjusted to fit the entire partition.
411// This keeps things simple and automated.
412// AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
413// This is the default setting for applicable Rackspace base images.
414//
415// MANUAL
416// ------
417// The server is built using whatever partition scheme and file system is in the source image.
418// If the target flavor disk is larger,
419// the remaining disk space is left unpartitioned.
420// This enables images to have non-EXT3 file systems, multiple partitions, and so on,
421// and enables you to manage the disk configuration.
422//
423// RaxBandwidth provides measures of the server's inbound and outbound bandwidth per interface.
424//
425// OsExtStsPowerState provides an indication of the server's power.
426// This field appears to be a set of flag bits:
427//
428// ... 4 3 2 1 0
429// +--//--+---+---+---+---+
430// | .... | 0 | S | 0 | I |
431// +--//--+---+---+---+---+
432// | |
433// | +--- 0=Instance is down.
434// | 1=Instance is up.
435// |
436// +----------- 0=Server is switched ON.
437// 1=Server is switched OFF.
438// (note reverse logic.)
439//
440// Unused bits should be ignored when read, and written as 0 for future compatibility.
441//
442// OsExtStsTaskState and OsExtStsVmState work together
443// to provide visibility in the provisioning process for the instance.
444// Consult Rackspace documentation at
445// http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_extensions.html#ext_status
446// for more details. It's too lengthy to include here.
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -0700447type Server struct {
Mark Peek22efb6c2013-08-26 13:50:22 -0700448 AccessIPv4 string `json:"accessIPv4"`
449 AccessIPv6 string `json:"accessIPv6"`
450 Addresses AddressSet `json:"addresses"`
451 Created string `json:"created"`
452 Flavor FlavorLink `json:"flavor"`
453 HostId string `json:"hostId"`
454 Id string `json:"id"`
455 Image ImageLink `json:"image"`
456 Links []Link `json:"links"`
457 Metadata map[string]string `json:"metadata"`
458 Name string `json:"name"`
459 Progress int `json:"progress"`
460 Status string `json:"status"`
461 TenantId string `json:"tenant_id"`
462 Updated string `json:"updated"`
463 UserId string `json:"user_id"`
464 OsDcfDiskConfig string `json:"OS-DCF:diskConfig"`
465 RaxBandwidth []RaxBandwidth `json:"rax-bandwidth:bandwidth"`
466 OsExtStsPowerState int `json:"OS-EXT-STS:power_state"`
467 OsExtStsTaskState string `json:"OS-EXT-STS:task_state"`
468 OsExtStsVmState string `json:"OS-EXT-STS:vm_state"`
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -0700469}
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700470
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700471// NewServerSettings structures record those fields of the Server structure to change
472// when updating a server (see UpdateServer method).
473type NewServerSettings struct {
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700474 Name string `json:"name,omitempty"`
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700475 AccessIPv4 string `json:"accessIPv4,omitempty"`
476 AccessIPv6 string `json:"accessIPv6,omitempty"`
477}
478
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700479// NewServer structures are used for both requests and responses.
480// The fields discussed below are relevent for server-creation purposes.
481//
482// The Name field contains the desired name of the server.
483// Note that (at present) Rackspace permits more than one server with the same name;
484// however, software should not depend on this.
485// Not only will Rackspace support thank you, so will your own devops engineers.
486// A name is required.
487//
488// The ImageRef field contains the ID of the desired software image to place on the server.
489// This ID must be found in the image slice returned by the Images() function.
490// This field is required.
491//
492// The FlavorRef field contains the ID of the server configuration desired for deployment.
493// This ID must be found in the flavor slice returned by the Flavors() function.
494// This field is required.
495//
496// For OsDcfDiskConfig, refer to the Image or Server structure documentation.
497// This field defaults to "AUTO" if not explicitly provided.
498//
499// Metadata contains a small key/value association of arbitrary data.
500// Neither Rackspace nor OpenStack places significance on this field in any way.
501// This field defaults to an empty map if not provided.
502//
503// Personality specifies the contents of certain files in the server's filesystem.
504// The files and their contents are mapped through a slice of FileConfig structures.
505// If not provided, all filesystem entities retain their image-specific configuration.
506//
507// Networks specifies an affinity for the server's various networks and interfaces.
508// Networks are identified through UUIDs; see NetworkConfig structure documentation for more details.
509// If not provided, network affinity is determined automatically.
510//
511// The AdminPass field may be used to provide a root- or administrator-password
512// during the server provisioning process.
513// If not provided, a random password will be automatically generated and returned in this field.
514//
515// The following fields are intended to be used to communicate certain results about the server being provisioned.
516// When attempting to create a new server, these fields MUST not be provided.
517// They'll be filled in by the response received from the Rackspace APIs.
518//
519// The Id field contains the server's unique identifier.
520// The identifier's scope is best assumed to be bound by the user's account, unless other arrangements have been made with Rackspace.
521//
522// Any Links provided are used to refer to the server specifically by URL.
523// These links are useful for making additional REST calls not explicitly supported by Gorax.
524type NewServer struct {
Mark Peek22efb6c2013-08-26 13:50:22 -0700525 Name string `json:"name,omitempty"`
526 ImageRef string `json:"imageRef,omitempty"`
527 FlavorRef string `json:"flavorRef,omitempty"`
528 Metadata map[string]string `json:"metadata,omitempty"`
529 Personality []FileConfig `json:"personality,omitempty"`
530 Networks []NetworkConfig `json:"networks,omitempty"`
531 AdminPass string `json:"adminPass,omitempty"`
532 KeyPairName string `json:"key_name,omitempty"`
533 Id string `json:"id,omitempty"`
534 Links []Link `json:"links,omitempty"`
535 OsDcfDiskConfig string `json:"OS-DCF:diskConfig,omitempty"`
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700536}
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700537
538// ResizeRequest structures are used internally to encode to JSON the parameters required to resize a server instance.
539// Client applications will not use this structure (no API accepts an instance of this structure).
540// See the Region method ResizeServer() for more details on how to resize a server.
541type ResizeRequest struct {
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700542 Name string `json:"name,omitempty"`
543 FlavorRef string `json:"flavorRef"`
544 DiskConfig string `json:"OS-DCF:diskConfig,omitempty"`
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700545}
Mark Peek6b57c232013-08-24 19:03:26 -0700546
547type CreateImage struct {
548 Name string `json:"name"`
549 Metadata map[string]string `json:"metadata,omitempty"`
550}