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. To view the contents of
the capability
package, see the
capability
package reference.
.
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:
You can separately query for the availability of Datastore reads and writes. The following sample shows how to detect the availability of Datastore writes and, during downtime, provide a message to users:
Using the Capabilities API in Go 1.11
The capability.Enabled
function returns true if the provided API and capability are available. You must
pass either a capability name (such as "write"
) or the wildcard "*"
to query
all capabilities of the API.
Supported capabilities
The API currently supports the following capabilities:
Capability | Arguments to Enabled |
---|---|
Availability of the blobstore | "blobstore", "*" |
Datastore reads | "datastore_v3", "*" |
Datastore writes | "datastore_v3", "write" |
Availability of the Mail service | "mail", "*" |
Availability of the Memcache service | "memcache", "*" |
Availability of the Task Queue service | "taskqueue", "*" |
Availability of the URL Fetch service | "urlfetch", "*" |