...
The following curl commands can be used to upload a Day 2 Configuration template.
Command to POST (create
...
) Template:
Code Block |
---|
|
curl -i -d @create_config_template.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/-template/ |
With the following JSON content (create_config_template.json )
Code Block |
---|
language | js |
---|
linenumbers | true |
---|
|
{
"name": "kafka_token_1"
"description": "testing Kafka Day 2 config configuration",
"rb-name": "kafka",
"rb-version": "1.0",
} |
Command to UPLOAD Template:
Code Block |
---|
|
curl -i --data-binary @kafka-config.tar.gz -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/-template/{name} |
Command to GET Templates:
Code Block |
---|
|
# Get all Templates
curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/-template
# Get one Template
curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/-template/{name} |
Command to DELETE Templates:
Code Block |
---|
|
curl -i -X DELETE http://localhost:8081/rb/definition/{name}/{version}/profile/{name}/config/-template/{name} |
Example
Example Contents of Tar File
...
In Day2 apply configuration API each instance of configuration is identified by rb_name, rb_version and profile_name. The body of the API contains set of parameter and value list.
CRUD Operations
Command to POST (create
...
) Configuration Values
Code Block |
---|
|
curl -i -d @values.json -X POST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"template-name": "kafka_token"
"config-name": "kafka_token_1"
"description":"testing Kafka Day 2 config configuration",
"values":{
"namespace":"kafka",
"topic":{
"name":"orders",
"cluster":"my-cluster",
"partitions":10,
"replicas":2
}
}
} |
...
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"rb-name":"kafka",
"rb-version":"kafka-config-1",
"profile-name":"1234567890",
"template-name": "kafka-token"
"config-name": "kafka_token_1"
"config-version":"1.0"
}
} |
POST used for both loading new configuration values and also modifying the existing configuration values
Command to GET Configuration Values
Code Block |
---|
|
# Get all Values
curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value
# Get one Value with config versionname
curl -i http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{template-name}/value/{config-versionname} |
Command to DELETE Configuration Values
Code Block |
---|
|
curl -i -X DELETE http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name} |
Command to
...
PUT (Modify) Configuration Values
Code Block |
---|
|
curl -i -d @values.json -X DELETEPUT http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/config/{name} |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"template-name": "kafka_token"
"config-name": "kafka_token_1"
"description":"testing Kafka Day 2 config configuration",
"values":{
"namespace":"kafka",
"topic":{
"name}/value/{config-version} |
...
":"orders",
"cluster":"my-cluster",
"partitions":20,
"replicas":2
}
}
} |
This command returns the following JSON which contains config-version.
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"rb-name":"kafka",
"rb-version":"kafka-config-1",
"profile-name":"1234567890",
"template-name": "kafka-token"
"config-name": "kafka_token_1"
"config-version":"3"
}
} |
Command to TAG configuration Values
This will add the tag name to the current config version
Code Block |
---|
|
curl -i -d @values.json -X DELETEPOST http://localhost:8081/v1/rb/definition/{name}/{version}/profile/{name}/tagit |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"tag-name": "my-tag"
} |
Command to ROLLBACK configuration Values
Rollbacks configuration to a config version or a tag.
Code Block |
---|
|
curl -i -d @values.json -X POST http://localhost:8081/{template-name}/value/{config-version} |
...
v1/rb/definition/{name}/{version}/profile/{name}/rollback |
With the following JSON content (values.json )
Code Block |
---|
language | js |
---|
title | Profile JSON Body |
---|
|
{
"anyOf": [
{
"config-version": "<value>"
},
{
"config-tag": "<tag name>"
}
]
} |