enterprise/store/v1
COMMERCIAL FEATURE: Access the datastore feature in the packaged Sensu Go distribution. For more information, read Get started with commercial features.
NOTE: Requests to enterprise/store/v1
API endpoints require you to authenticate with a Sensu API key or access token.
The code examples in this document use the environment variable $SENSU_API_KEY
to represent a valid API key in API requests.
Get all datastore providers
The /provider
API endpoint provides HTTP GET access to Sensu datastore data.
Example
The following example demonstrates a GET request to the /provider
API endpoint, resulting in a JSON map that contains a list of Sensu datastore providers.
curl -X GET \
http://127.0.0.1:8080/api/enterprise/store/v1/provider
-H "Authorization: Key $SENSU_API_KEY" \
The request results in a successful HTTP/1.1 200 OK
response and a JSON array that contains the datastore provider definitions:
[
{
"type": "PostgresConfig",
"api_version": "store/v1",
"metadata": {
"name": "my-postgres",
"created_by": "admin"
},
"spec": {
"dsn": "postgresql://user:secret@host:port/dbname",
"max_conn_lifetime": "5m",
"max_idle_conns": 2,
"pool_size": 20,
"strict": true,
"enable_round_robin": true
}
}
]
API Specification
/provider (GET) | |
---|---|
description | Returns the list of datastore providers. |
example url | http://hostname:8080/api/enterprise/store/v1/provider |
response type | Map |
response codes |
|
output |
|
Get a specific datastore provider
The /provider/:provider
API endpoint provides HTTP GET access to retrieve a Sensu datastore provider.
Example
The following example queries the /provider/:provider
API endpoint for a specific :provider
:
curl -X GET \
-H "Authorization: Key $SENSU_API_KEY" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres
The request will return a successful HTTP/1.1 200 OK
response and a JSON map that contains the requested :provider
definition (in this example, my-postgres
):
{
"type": "PostgresConfig",
"api_version": "store/v1",
"metadata": {
"name": "my-postgres",
"created_by": "admin"
},
"spec": {
"batch_buffer": 0,
"batch_size": 1,
"batch_workers": 0,
"dsn": "postgresql://user:secret@host:port/dbname",
"max_conn_lifetime": "5m",
"max_idle_conns": 2,
"pool_size": 20,
"strict": true,
"enable_round_robin": true
}
}
API Specification
/provider/:provider (GET) | |
---|---|
description | Returns the specified datastore provider. |
example url | http://hostname:8080/api/enterprise/store/v1/provider/my-postgres |
url parameters | Required: my-postgres (name of provider to retrieve). |
response codes |
|
output |
|
Create or update a datastore provider
The /provider/:provider
API endpoint provides HTTP PUT access to create or update a Sensu datastore provider.
Example
curl -X PUT \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres \
-H "Authorization: Key $SENSU_API_KEY" \
-d '{
"type": "PostgresConfig",
"api_version": "store/v1",
"metadata": {
"name": "my-postgres"
},
"spec": {
"batch_buffer": 0,
"batch_size": 1,
"batch_workers": 0,
"dsn": "postgresql://user:secret@host:port/dbname",
"max_conn_lifetime": "5m",
"max_idle_conns": 2,
"pool_size": 20,
"strict": true,
"enable_round_robin": true
}
}'
The request will return a successful HTTP/1.1 201 Created
response.
API Specification
/provider/:provider (PUT) | |
---|---|
description | Creates a datastore provider. |
example url | http://hostname:8080/api/enterprise/store/v1/provider/my-postgres |
url parameters | Required: my-postgres (name to use for provider). |
payload |
|
response codes |
|
Delete a datastore provider
The /provider/:provider
API endpoint provides HTTP DELETE access to remove a Sensu datastore provider.
Example
The following example shows a request to the /provider/:provider
API endpoint to remove the Sensu datastore provider with the ID my-postgres
, resulting in a successful HTTP/1.1 204 No Content
response.
curl -X DELETE \
-H "Authorization: Key $SENSU_API_KEY" \
http://127.0.0.1:8080/api/enterprise/store/v1/provider/my-postgres
API Specification
/provider/:provider (DELETE) | |
---|---|
description | Removes the specified datastore provider. |
example url | http://hostname:8080/api/enterprise/store/v1/provider/my-postgres |
url parameters | Required: my-postgres (name of provider to delete). |
response codes |
|