Top-level APIs.
This class provides following APIs:
Constructor and description |
---|
UpCloud
(AbstractSession SESSION) |
Type Params | Return Type | Name and description |
---|---|---|
|
def |
account(def... args) Fetch UpCloud API account information for the session. |
|
def |
create(Resource resource, def... args) Create a resource. |
|
def |
ipAddresses(def... args) Fetch a list of all IP addresses associated with this session. |
|
def |
plans(def... args) Fetch a list of available plans. |
|
def |
prices(def... args) Fetch UpCloud prices for all zones. |
|
def |
serverSizes(def... args) Fetch a list of available server configurations. |
|
def |
servers(def... args) Fetch a list of all servers associated with this session. |
|
def |
storages(def... args) Fetch a list of all storages. |
|
def |
tags(def... args) Fetch a list of all tags associated with this account. |
|
def |
timezones(def... args) Fetch a list of available timezones. |
|
def |
zones(def... args) Fetch UpCloud zone list. |
Fetch UpCloud API account information for the session.
A 200 OK
response will include an instance of Account in the
account
property.
upcloud.account { resp, err ->
assert resp?.account instanceof Account
}
args
- Request callbacks for the GET /account
call.Create a resource.
For Server creation, a 202 Accepted
response will include an
instance of Server in the server
property. The
Server.state property will be maintenance
since it will take
awhile to create the server.
For Storage creation, a 201 Created
response will include an
instance of Storage in the storage
property.
For IpAddress creation, a 201 Created
response will include an
instance of IpAddress in the ipAddress
property.
For Tag creation, a 200 OK
response will include an instance
of Tag in the tag
property.
resource
- Resource to create.args
- Request callbacks for the POST
call.Fetch a list of all IP addresses associated with this session.
A 200 OK
response will include a list of IpAddress instances
in the ipAddresses
property.
upcloud.ipAddresses { resp, err ->
assert resp?.ipAddresses instanceof List
assert rest.ipAddresses.every { it instanceof IpAddress }
}
args
- Request callbacks for the GET /ip_address
call.Fetch a list of available plans.
A 200 OK
response will include a list of Plan instances in
the plans
property.
upcloud.plans { resp, err ->
assert resp?.plans instanceof List
assert rest.plans.every { it instanceof Plan }
}
args
- Request callbacks for the GET /plan
call.Fetch UpCloud prices for all zones.
A 200 OK
response will include a list of Zone instances in
the prices
property.
upcloud.prices { resp, err ->
assert resp?.prices instanceof List
assert rest.prices.every { it instanceof Zone }
}
When zones are listed via this API, they will not include Zone.id properties, but Zone.name properties instead. They are the same.
args
- Request callbacks for the GET /price
call.Fetch a list of available server configurations.
A 200 OK
response will include a list of ServerSize instances
in the serverSizes
property.
upcloud.serverSizes { resp, err ->
assert resp?.serverSizes instanceof List
assert rest.serverSizes.every { it instanceof ServerSize }
}
args
- Request callbacks for the GET /server_size
call.Fetch a list of all servers associated with this session.
A 200 OK
response will include a list of Server instances
in the servers
property.
upcloud.servers { resp, err ->
assert resp?.servers instanceof List
assert rest.servers.every { it instanceof Server }
}
Only the servers' most relevant information is returned by this operation. Further details on individual servers can be requested with the Server.load API.
args
- Request callbacks for the GET /server
call.Fetch a list of all storages.
A 200 OK
response will include a list of Storage instances
in the storages
property.
upcloud.storages { resp, err ->
assert resp?.storages instanceof List
assert resp.storages.every { it instanceof Storage }
}
A keyword argument type
can be used to narrow down the list. The type can be access type
(public
or private
), or storage type (normal
, backup
, cdrom
, or
template
), or favorite
.
upcloud.storages type: "template" { resp, err ->
}
Only the storages' most relevant information is returned by this operation. Further details on individual storage can be requested with the Storage.load API.
args.type
- Optional filter for storages: public
, private
, normal
, backup
,
cdrom
, template
, or favorite
.args
- Request callbacks for the GET /storage
call.Fetch a list of all tags associated with this account.
A 200 OK
response will include a list of Tag instances in the
tags
property.
upcloud.tags { resp, err ->
assert resp?.tags instanceof List
assert resp.tags.every { it instanceof Tag }
}
args
- Request callbacks for the GET /tag
call.Fetch a list of available timezones.
A 200 OK
response will include a list of Strings in the timezones
property.
upcloud.timezones { resp, err ->
assert resp?.timezones instanceof List
assert rest.timezones.every { it instanceof String }
}
args
- Request callbacks for the GET /timezone
call.Fetch UpCloud zone list.
A 200 OK
response will include a list of Zone instances in
the zones
property.
upcloud.zones { resp, err ->
assert resp?.zones instanceof List
assert rest.zones.every { it instanceof Zone }
}
When zones are listed via this API, they will not include Zone.name properties, but Zone.id properties instead. They are the same.
args
- Request callbacks for the GET /zone
call.