blob: a2348c5d46a2c46f60150f0a1feefcacd28a6023 [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 },
329 OkCodes: []int{200, 202},
330 DumpReqJson: true,
331 })
332 })
333
334 if err != nil {
335 return "", err
336 }
337 location, err := response.HttpResponse.Location()
338 if err != nil {
339 return "", err
340 }
341
342 // Return the last element of the location which is the image id
343 locationArr := strings.Split(location.Path, "/")
344 return locationArr[len(locationArr)-1], err
345}
346
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -0700347// RaxBandwidth provides measurement of server bandwidth consumed over a given audit interval.
348type RaxBandwidth struct {
349 AuditPeriodEnd string `json:"audit_period_end"`
350 AuditPeriodStart string `json:"audit_period_start"`
351 BandwidthInbound int64 `json:"bandwidth_inbound"`
352 BandwidthOutbound int64 `json:"bandwidth_outbound"`
353 Interface string `json:"interface"`
354}
355
356// A VersionedAddress denotes either an IPv4 or IPv6 (depending on version indicated)
357// address.
358type VersionedAddress struct {
359 Addr string `json:"addr"`
360 Version int `json:"version"`
361}
362
363// An AddressSet provides a set of public and private IP addresses for a resource.
364// Each address has a version to identify if IPv4 or IPv6.
365type AddressSet struct {
366 Public []VersionedAddress `json:"public"`
367 Private []VersionedAddress `json:"private"`
368}
369
370// Server records represent (virtual) hardware instances (not configurations) accessible by the user.
371//
372// The AccessIPv4 / AccessIPv6 fields provides IP addresses for the server in the IPv4 or IPv6 format, respectively.
373//
374// Addresses provides addresses for any attached isolated networks.
375// The version field indicates whether the IP address is version 4 or 6.
376//
377// Created tells when the server entity was created.
378//
379// The Flavor field includes the flavor ID and flavor links.
380//
381// The compute provisioning algorithm has an anti-affinity property that
382// attempts to spread customer VMs across hosts.
383// Under certain situations,
384// VMs from the same customer might be placed on the same host.
385// The HostId field represents the host your server runs on and
386// can be used to determine this scenario if it is relevant to your application.
387// Note that HostId is unique only per account; it is not globally unique.
Mark Peeka2818af2013-08-24 15:01:12 -0700388//
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -0700389// Id provides the server's unique identifier.
390// This field must be treated opaquely.
391//
392// Image indicates which image is installed on the server.
393//
394// Links provides one or more means of accessing the server.
395//
396// Metadata provides a small key-value store for application-specific information.
397//
398// Name provides a human-readable name for the server.
399//
400// Progress indicates how far along it is towards being provisioned.
401// 100 represents complete, while 0 represents just beginning.
402//
403// Status provides an indication of what the server's doing at the moment.
404// A server will be in ACTIVE state if it's ready for use.
405//
406// OsDcfDiskConfig indicates the server's boot volume configuration.
407// Valid values are:
408// AUTO
409// ----
410// The server is built with a single partition the size of the target flavor disk.
411// The file system is automatically adjusted to fit the entire partition.
412// This keeps things simple and automated.
413// AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
414// This is the default setting for applicable Rackspace base images.
415//
416// MANUAL
417// ------
418// The server is built using whatever partition scheme and file system is in the source image.
419// If the target flavor disk is larger,
420// the remaining disk space is left unpartitioned.
421// This enables images to have non-EXT3 file systems, multiple partitions, and so on,
422// and enables you to manage the disk configuration.
423//
424// RaxBandwidth provides measures of the server's inbound and outbound bandwidth per interface.
425//
426// OsExtStsPowerState provides an indication of the server's power.
427// This field appears to be a set of flag bits:
428//
429// ... 4 3 2 1 0
430// +--//--+---+---+---+---+
431// | .... | 0 | S | 0 | I |
432// +--//--+---+---+---+---+
433// | |
434// | +--- 0=Instance is down.
435// | 1=Instance is up.
436// |
437// +----------- 0=Server is switched ON.
438// 1=Server is switched OFF.
439// (note reverse logic.)
440//
441// Unused bits should be ignored when read, and written as 0 for future compatibility.
442//
443// OsExtStsTaskState and OsExtStsVmState work together
444// to provide visibility in the provisioning process for the instance.
445// Consult Rackspace documentation at
446// http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_extensions.html#ext_status
447// for more details. It's too lengthy to include here.
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -0700448type Server struct {
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -0700449 AccessIPv4 string `json:"accessIPv4"`
450 AccessIPv6 string `json:"accessIPv6"`
451 Addresses AddressSet `json:"addresses"`
452 Created string `json:"created"`
453 Flavor FlavorLink `json:"flavor"`
454 HostId string `json:"hostId"`
455 Id string `json:"id"`
456 Image ImageLink `json:"image"`
457 Links []Link `json:"links"`
458 Metadata interface{} `json:"metadata"`
459 Name string `json:"name"`
460 Progress int `json:"progress"`
461 Status string `json:"status"`
462 TenantId string `json:"tenant_id"`
463 Updated string `json:"updated"`
464 UserId string `json:"user_id"`
465 OsDcfDiskConfig string `json:"OS-DCF:diskConfig"`
466 RaxBandwidth []RaxBandwidth `json:"rax-bandwidth:bandwidth"`
467 OsExtStsPowerState int `json:"OS-EXT-STS:power_state"`
468 OsExtStsTaskState string `json:"OS-EXT-STS:task_state"`
469 OsExtStsVmState string `json:"OS-EXT-STS:vm_state"`
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -0700470}
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700471
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700472// NewServerSettings structures record those fields of the Server structure to change
473// when updating a server (see UpdateServer method).
474type NewServerSettings struct {
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700475 Name string `json:"name,omitempty"`
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700476 AccessIPv4 string `json:"accessIPv4,omitempty"`
477 AccessIPv6 string `json:"accessIPv6,omitempty"`
478}
479
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700480// NewServer structures are used for both requests and responses.
481// The fields discussed below are relevent for server-creation purposes.
482//
483// The Name field contains the desired name of the server.
484// Note that (at present) Rackspace permits more than one server with the same name;
485// however, software should not depend on this.
486// Not only will Rackspace support thank you, so will your own devops engineers.
487// A name is required.
488//
489// The ImageRef field contains the ID of the desired software image to place on the server.
490// This ID must be found in the image slice returned by the Images() function.
491// This field is required.
492//
493// The FlavorRef field contains the ID of the server configuration desired for deployment.
494// This ID must be found in the flavor slice returned by the Flavors() function.
495// This field is required.
496//
497// For OsDcfDiskConfig, refer to the Image or Server structure documentation.
498// This field defaults to "AUTO" if not explicitly provided.
499//
500// Metadata contains a small key/value association of arbitrary data.
501// Neither Rackspace nor OpenStack places significance on this field in any way.
502// This field defaults to an empty map if not provided.
503//
504// Personality specifies the contents of certain files in the server's filesystem.
505// The files and their contents are mapped through a slice of FileConfig structures.
506// If not provided, all filesystem entities retain their image-specific configuration.
507//
508// Networks specifies an affinity for the server's various networks and interfaces.
509// Networks are identified through UUIDs; see NetworkConfig structure documentation for more details.
510// If not provided, network affinity is determined automatically.
511//
512// The AdminPass field may be used to provide a root- or administrator-password
513// during the server provisioning process.
514// If not provided, a random password will be automatically generated and returned in this field.
515//
516// The following fields are intended to be used to communicate certain results about the server being provisioned.
517// When attempting to create a new server, these fields MUST not be provided.
518// They'll be filled in by the response received from the Rackspace APIs.
519//
520// The Id field contains the server's unique identifier.
521// The identifier's scope is best assumed to be bound by the user's account, unless other arrangements have been made with Rackspace.
522//
523// Any Links provided are used to refer to the server specifically by URL.
524// These links are useful for making additional REST calls not explicitly supported by Gorax.
525type NewServer struct {
Mark Peeka739f222013-08-17 19:06:15 -0700526 Name string `json:"name,omitempty"`
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700527 ImageRef string `json:"imageRef,omitempty"`
528 FlavorRef string `json:"flavorRef,omitempty"`
529 Metadata interface{} `json:"metadata,omitempty"`
530 Personality []FileConfig `json:"personality,omitempty"`
531 Networks []NetworkConfig `json:"networks,omitempty"`
532 AdminPass string `json:"adminPass,omitempty"`
Mark Peeka2818af2013-08-24 15:01:12 -0700533 KeyPairName string `json:"key_name,omitempty"`
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -0700534 Id string `json:"id,omitempty"`
535 Links []Link `json:"links,omitempty"`
536 OsDcfDiskConfig string `json:"OS-DCF:diskConfig,omitempty"`
537}
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700538
539// ResizeRequest structures are used internally to encode to JSON the parameters required to resize a server instance.
540// Client applications will not use this structure (no API accepts an instance of this structure).
541// See the Region method ResizeServer() for more details on how to resize a server.
542type ResizeRequest struct {
Samuel A. Falvo II20f1aa42013-07-31 14:32:03 -0700543 Name string `json:"name,omitempty"`
544 FlavorRef string `json:"flavorRef"`
545 DiskConfig string `json:"OS-DCF:diskConfig,omitempty"`
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -0700546}
Mark Peek6b57c232013-08-24 19:03:26 -0700547
548type CreateImage struct {
549 Name string `json:"name"`
550 Metadata map[string]string `json:"metadata,omitempty"`
551}