- Type parameter T is the return type of the
request methodType Params | Return Type | Name and description |
---|---|---|
|
T |
DELETE(Map<?, Closure<Void>> cbs, String path, Closure<Void> cb = null) Performs a HTTP DELETE method. |
|
T |
DELETE(String path, Closure<Void> cb = null) Calls DELETE with an empty map as additional request callbacks. |
|
T |
DELETE(String path, Map<?, Closure<Void>> cbs, Closure<Void> cb = null) Calls DELETE with given arguments in correct order. |
|
T |
GET(Map<?, Closure<Void>> cbs, String path, Closure<Void> cb = null) Performs a HTTP GET method. |
|
T |
GET(String path, Closure<Void> cb = null) Calls GET with an empty map as additional request callbacks. |
|
T |
GET(String path, Map<?, Closure<Void>> cbs, Closure<Void> cb = null) Calls GET with given arguments in correct order. |
|
T |
POST(Map<?, Closure<Void>> cbs, String path, Resource resource, Closure<Void> cb = null) Performs a HTTP POST method. |
|
T |
POST(String path, Resource resource, Closure<Void> cb = null) Calls POST with an empty map as additional request callbacks. |
|
T |
POST(String path, Resource resource, Map<?, Closure<Void>> cbs, Closure<Void> cb = null) Calls POST with given arguments in correct order. |
|
T |
PUT(Map<?, Closure<Void>> cbs, String path, Resource resource, Closure<Void> cb = null) Performs a HTTP PUT method. |
|
T |
PUT(String path, Resource resource, Closure<Void> cb = null) Calls PUT with an empty map as additional request callbacks. |
|
T |
PUT(String path, Resource resource, Map<?, Closure<Void>> cbs, Closure<Void> cb = null) Calls PUT with given arguments in correct order. |
|
T |
request(Map<?, Closure<Void>> cbs, String method, String path, Resource resource, Closure<Void> cb) Perform a HTTP request. |
Performs a HTTP DELETE method.
This method calls the
request method
with DELETE
method and null
resource.
This overload is used when the application code calls this directly. For example:
Resource lb = // obtain a LoadBalancer...
session.DELETE "/lb/${lb.uuid}", error: { log.fatal("${it.META}") }, { res, err ->
if (err)
log.warn("Network error: ${err.message}")
else
log.info("Load balancer deleted")
}
In the example above, there is a REST API endpoint that this library does not know about: /lb
.
Application can bypass the outdated library API and make REST API calls directly.
cbs
- Additional request callbacks.path
- Resource path relative to the API context path, i.e. without leading slash.cb
- Default request callback. Calls DELETE
with an empty map as additional request callbacks.
This overload is typically used by the higher level API traits when the application does not pass any additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.cb
- Default request callback. Calls DELETE
with given arguments in correct order.
This overload is typically used by the higher level API traits when the application does provide some additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.cbs
- Additional request callbacks.cb
- Default request callback.Performs a HTTP GET method.
This method calls the
request method
with GET
method and null
resource.
This overload is used when the application code calls this directly. For example:
session.GET '/lb', error: { log.fatal("${it.META}") }, { res, err ->
res.loadBalancers.each { lb ->
log.info("Load balancer: ${lb.name}")
}
}
In the example above, there is a REST API endpoint that this library does not know about: /lb
.
Application can bypass the outdated library API and make REST API calls directly.
cbs
- Additional request callbacks.path
- Resource path relative to the API context path, i.e. without leading slash.cb
- Default request callback. Calls GET
with an empty map as additional request callbacks.
This overload is typically used by the higher level API traits when the application does not pass any additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.cb
- Default request callback. Calls GET
with given arguments in correct order.
This overload is typically used by the higher level API traits when the application does provide some additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.cbs
- Additional request callbacks.cb
- Default request callback.Performs a HTTP POST method.
This method calls the
request method
with POST
method.
This overload is used when the application code calls this directly. For example:
import static fi.linuxbox.upcloud.builder.ResourceBuilder.build
def lb = build 'LoadBalancer' {
name = 'web'
method = 'random'
backends = [
"192.168.1.120:80",
"192.168.1.121:80"
]
}
session.POST '/lb', lb, error: { log.warn("${it.META}") }, { res, err ->
if (err)
log.warn("Network error: ${err.message}")
else
log.info("Load balancer created")
}
In the example above, there is a REST API endpoint that this library does not know about: /lb
.
Application can bypass the outdated library API and POST the custom resource to the REST API directly.
cbs
- Additional request callbacks.path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cb
- Default request callback. Calls POST
with an empty map as additional request callbacks.
This overload is typically used by the higher level API traits when the application does not pass any additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cb
- Default request callback. Calls POST
with given arguments in correct order.
This overload is typically used by the higher level API traits when the application does provide some additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cbs
- Additional request callbacks.cb
- Default request callback.Performs a HTTP PUT method.
This method calls the
request method
with PUT
method.
This overload is used when the application code calls this directly. For example:
import static fi.linuxbox.upcloud.builder.ResourceBuilder.configure
Resource lb = // obtain a LoadBalancer...
lb = configure lb {
method = 'round-robin'
}
session.PUT "/lb/${lb.uuid}", lb, error: { log.fatal("${it.META}") }, { res, err ->
if (err)
log.warn("Network error: ${err.message}")
else
log.info("Load balancer updated")
}
In the example above, there is a REST API endpoint that this library does not know about: /lb
.
Application can bypass the outdated library API and PUT the custom resource to the REST API directly.
cbs
- Additional request callbacks.path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cb
- Default request callback. Calls PUT
with an empty map as additional request callbacks.
This overload is typically used by the higher level API traits when the application does not pass any additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cb
- Default request callback. Calls PUT
with given arguments in correct order.
This overload is typically used by the higher level API traits when the application does provide some additional request callbacks.
path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cbs
- Additional request callbacks.cb
- Default request callback.Perform a HTTP request.
cbs
- Additional request callbacks.method
- HTTP method.path
- Resource path relative to the API context path, i.e. without leading slash.resource
- Resource to send or null
.cb
- Default request callback.