The Capabilities Go API
With the Capabilities API, your application can detect outages and scheduled downtime for specific API capabilities. You can use this API to reduce downtime in your application by detecting when a capability is unavailable and then bypassing it.
For example, if you use the Datastore API, you can use the Capabilities API to detect when the Datastore API is unavailable and report an error to the user:
func handler(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
if !capability.Enabled(c, "datastore", "*") {
http.Error(w, "This service is currently unavailable.", 503)
return
}
// do datastore lookup ...
}
Using the Capabilities API in Go
The capability.Enabled
function returns true if the provided API and capability are available.
Supported Capabilities
The API currently supports the following capabilities:
Capability |
Argument to Enabled |
Availability of the blobstore |
|
Datastore reads |
|
Datastore writes |
|
Availability of the Mail service |
|
Availability of the Memcache service |
|
Availability of the Task Queue service |
|
Availability of the URL Fetch service |
|