blob: 626e531322f62682fec52b32480d169327c6900b [file] [log] [blame]
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -07001package gophercloud
2
3// AccessProvider instances encapsulate a Keystone authentication interface.
4type AccessProvider interface {
5 // FirstEndpointUrlByCriteria searches through the service catalog for the first
6 // matching entry endpoint fulfilling the provided criteria. If nothing found,
7 // return "". Otherwise, return either the public or internal URL for the
8 // endpoint, depending on both its existence and the setting of the ApiCriteria.UrlChoice
9 // field.
10 FirstEndpointUrlByCriteria(ApiCriteria) string
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070011
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070012 // AuthToken provides a copy of the current authentication token for the user's credentials.
Samuel A. Falvo II659e14b2013-07-16 12:04:54 -070013 // Note that AuthToken() will not automatically refresh an expired token.
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070014 AuthToken() string
Samuel A. Falvo II659e14b2013-07-16 12:04:54 -070015
16 // Revoke allows you to terminate any program's access to the OpenStack API by token ID.
17 Revoke(string) error
Samuel A. Falvo II9e64f6b2013-07-16 14:26:50 -070018
19 // Reauthenticate attempts to acquire a new authentication token, if the feature is enabled by
20 // AuthOptions.AllowReauth.
21 Reauthenticate() error
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070022}
23
Samuel A. Falvo II1dd740a2013-07-08 15:48:40 -070024// CloudServersProvider instances encapsulate a Cloud Servers API, should one exist in the service catalog
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070025// for your provider.
Samuel A. Falvo II1dd740a2013-07-08 15:48:40 -070026type CloudServersProvider interface {
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070027 // Servers
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070028
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070029 // ListServers provides a complete list of servers hosted by the user
30 // in a given region. This function differs from ListServersLinksOnly()
31 // in that it returns all available details for each server returned.
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -070032 ListServers() ([]Server, error)
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070033
34 // ListServers provides a complete list of servers hosted by the user
35 // in a given region. This function differs from ListServers() in that
36 // it returns only IDs and links to each server returned.
37 //
38 // This function should be used only under certain circumstances.
39 // It's most useful for checking to see if a server with a given ID exists,
40 // or that you have permission to work with that server. It's also useful
41 // when the cost of retrieving the server link list plus the overhead of manually
42 // invoking ServerById() for each of the servers you're interested in is less than
43 // just calling ListServers() to begin with. This may be a consideration, for
44 // example, with mobile applications.
45 //
46 // In other cases, you probably should just call ListServers() and cache the
47 // results to conserve overall bandwidth and reduce your access rate on the API.
Samuel A. Falvo II5c305e12013-07-25 19:19:43 -070048 ListServersLinksOnly() ([]Server, error)
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070049
50 // ServerById will retrieve a detailed server description given the unique ID
51 // of a server. The ID can be returned by either ListServers() or by ListServersLinksOnly().
Samuel A. Falvo II02f5e832013-07-10 13:52:27 -070052 ServerById(id string) (*Server, error)
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070053
54 // CreateServer requests a new server to be created by the cloud server provider.
55 // The user must pass in a pointer to an initialized NewServerContainer structure.
56 // Please refer to the NewServerContainer documentation for more details.
57 //
58 // If the NewServer structure's AdminPass is empty (""), a password will be
59 // automatically generated by your OpenStack provider, and returned through the
60 // AdminPass field of the result. Take care, however; this will be the only time
61 // this happens. No other means exists in the public API to acquire a password
62 // for a pre-existing server. If you lose it, you'll need to call SetAdminPassword()
63 // to set a new one.
Samuel A. Falvo IIe91ff6d2013-07-11 15:46:10 -070064 CreateServer(ns NewServer) (*NewServer, error)
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070065
66 // DeleteServerById requests that the server with the assigned ID be removed
67 // from your account. The delete happens asynchronously.
Samuel A. Falvo II286e4de2013-07-12 11:33:31 -070068 DeleteServerById(id string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070069
70 // SetAdminPassword requests that the server with the specified ID have its
71 // administrative password changed. For Linux, BSD, or other POSIX-like
72 // system, this password corresponds to the root user. For Windows machines,
73 // the Administrator password will be affected instead.
Samuel A. Falvo II5c305e12013-07-25 19:19:43 -070074 SetAdminPassword(id string, pw string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070075
76 // ResizeServer can be a short-hand for RebuildServer where only the size of the server
77 // changes. Note that after the resize operation is requested, you will need to confirm
78 // the resize has completed for changes to take effect permanently. Changes will assume
79 // to be confirmed even without an explicit confirmation after 24 hours from the initial
80 // request.
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -070081 ResizeServer(id, newName, newFlavor, newDiskConfig string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070082
83 // RevertResize will reject a server's resized configuration, thus
84 // rolling back to the original server.
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -070085 RevertResize(id string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070086
87 // ConfirmResizeServer will acknowledge a server's resized configuration.
Samuel A. Falvo II8512e9a2013-07-26 22:53:29 -070088 ConfirmResize(id string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070089
90 // RebootServer requests that the server with the specified ID be rebooted.
91 // Two reboot mechanisms exist.
92 //
93 // - Hard. This will physically power-cycle the unit.
94 // - Soft. This will attempt to use the server's software-based mechanisms to restart
95 // the machine. E.g., "shutdown -r now" on Linux.
Samuel A. Falvo IIadbecf92013-07-30 13:13:59 -070096 RebootServer(id string, hard bool) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -070097
98 // RescueServer requests that the server with the specified ID be placed into
99 // a state of maintenance. The server instance is replaced with a new instance,
100 // of the same flavor and image. This new image will have the boot volume of the
101 // original machine mounted as a secondary device, so that repair and administration
102 // may occur. Use UnrescueServer() to restore the server to its previous state.
103 // Note also that many providers will impose a time limit for how long a server may
104 // exist in rescue mode! Consult the API documentation for your provider for
105 // details.
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700106 RescueServer(id string) (string, error)
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700107
108 // UnrescueServer requests that a server in rescue state be placed into its nominal
109 // operating state.
Samuel A. Falvo II15da6ab2013-07-30 14:02:11 -0700110 UnrescueServer(id string) error
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700111
112 // UpdateServer alters one or more fields of the identified server's Server record.
113 // However, not all fields may be altered. Presently, only Name, AccessIPv4, and
114 // AccessIPv6 fields may be altered. If unspecified, or set to an empty or zero
115 // value, the corresponding field remains unaltered.
116 //
117 // This function returns the new set of server details if successful.
Samuel A. Falvo II72ac2dd2013-07-31 13:45:05 -0700118 UpdateServer(id string, newValues NewServerSettings) (*Server, error)
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -0700119
Samuel A. Falvo II414c15c2013-08-01 15:16:46 -0700120 // RebuildServer reprovisions a server to the specifications given by the
121 // NewServer structure. The following fields are guaranteed to be recognized:
122 //
123 // Name (required) AccessIPv4
124 // imageRef (required) AccessIPv6
125 // AdminPass (required) Metadata
126 // Personality
127 //
128 // Other providers may reserve the right to act on additional fields.
129 RebuildServer(id string, ns NewServer) (*Server, error)
130
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700131 // Images
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -0700132
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700133 // ListImages yields the list of available operating system images. This function
134 // returns full details for each image, if available.
135 ListImages() ([]Image, error)
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -0700136
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700137 // Flavors
Samuel A. Falvo IIbc3f10f2013-07-11 17:13:24 -0700138
Samuel A. Falvo II94761be2013-07-31 14:31:17 -0700139 // ListFlavors yields the list of available system flavors. This function
140 // returns full details for each flavor, if available.
141 ListFlavors() ([]Flavor, error)
Samuel A. Falvo II2e2b8772013-07-04 15:40:15 -0700142}