-
Notifications
You must be signed in to change notification settings - Fork 10
Rest: databag templates api
Svyatoslav Reyentenko edited this page Mar 20, 2013
·
11 revisions
Databag template impose some structure for the databags and environment configurations created on their base. New object retain a link to template, hence cannot be modified in an arbirtrary ways. Databag template contains following fields:
Field | Type | Mandatory | Description |
---|---|---|---|
id | String | Y | Free form template identifier. Must be unique across the Genesis installation |
scope | String | Y | Template scope. May be one of following:
|
name | String | Y | Databag template name for the better UI recognition |
databag-name | String | N | Default name for the newly created databag |
default-tags | List of strings | N | Default set of tags for the newly created databags |
properties | Map of property definitions | N | Property definition for newly created databag (see below) |
Predefined properties are the map where key is databag variable name, and value is a structure with the following fields:
Field | Type | Mandatory | Description |
---|---|---|---|
default | String | Y | Default value for a property. UI use it to codepopulate new variable value |
required | Boolean | N | If set to true, databag must include that key on creation and on update. |
validation | Map of validation rules | N |
Validation rules for the property. Format is {"message":"rule"} Following rules are supported currently:
|
{
"id": "1-system",
"name": "System level template",
"scope": "system",
"default-tags": ["foo", "bar"],
"databag-name": "tdb",
"properties": {
"validated": {"description": "This is a long key", "default": 1234, "validation": {"Must be integer value >= 0": "int_nonnegative"}},
"required": {"description": "This is an other key", "default": "aaa", "required": true}
}
}
Path: /rest/dbtempates
Type: GET
{
"links" : [
{
"rel" : "self",
"href" : "http://localhost:8081/rest/dbtemplates",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
}
],
"items" : [
{
"rel" : "collection",
"href" : "http://localhost:8081/rest/dbtemplates/environment",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
},
{
"rel" : "collection",
"href" : "http://localhost:8081/rest/dbtemplates/project",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
},
{
"rel" : "collection",
"href" : "http://localhost:8081/rest/dbtemplates/system",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
}
]
}
Path: /rest/dbtemplates/(scope)
Type: GET
Path variables
Variable | Mandatory | Description |
---|---|---|
scope | Y | Template scope |
{
"items" : [
{
"defaultName" : "email",
"name" : "System wide email settings",
"id" : "system-email",
"links" : [],
"properties" : [
{
"required" : false,
"value" : "",
"name" : "genesisUrl"
}
],
"tags" : [
""
],
"scope" : "system"
}
],
"links" : [
{
"rel" : "self",
"href" : "http://localhost:8081/rest/dbtemplates/system",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
}
]
}
Path: /rest/dbtemplates/(scope)/(templateId)
Type: GET
Path variables
Variable | Mandatory | Description |
---|---|---|
scope | Y | Template scope |
templateId | Y | Template id |
{
"defaultName" : "email",
"name" : "System wide email settings",
"id" : "system-email",
"links" : [
{
"rel" : "self",
"href" : "http://localhost:8081/rest/dbtemplates/system/system-email",
"methods" : [
"get"
],
"type" : "application/vnd.griddynamics.genesis.DatabagTemplate+json"
}
],
"properties" : [
{
"required" : false,
"value" : "",
"name" : "genesisUrl"
}
],
"tags" : [
""
],
"scope" : "system"
}