cd coredns-api/
bash scripts/code_build.sh
or
bash script/docker_build.sh
- SERVER
This API server's IP address. - PORT
This API server's HTTP listen port. - CONF_PATH
File path of coredns conf. - HOSTS_DIR
Directory path of coredns hosts files.
vim docker-compose.yml
docker-compose up
Swagger is available on http://${SERVER}:${PORT}/swagger/index.html
.
request
curl -X POST http://127.0.0.1:8080/v1/domains \
-H "Accept: application/json" \
-d '{"domain": "hogehoge.hoge",
"tenants": ["df397e50-8006-450e-b18b-5c5bd940baff", "02c03bd4-fe2e-45f2-85b6-b535af15215d"]}'
response
HTTP/1.1 201 Created
Content-Type: application/json
{"domain": "hogehoge.hoge", "uuid": "aea6cf49-2912-42af-b903-dae1312f64d9", "hosts": [], "tenants": ["df397e50-8006-450e-b18b-5c5bd940baff", "02c03bd4-fe2e-45f2-85b6-b535af15215d"]}
request
curl -X PATCH http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID} \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"tenants": ["df397e50-8006-450e-b18b-5c5bd940baff", "02c03bd4-fe2e-45f2-85b6-b535af15215d"]}'
or
curl -X PATCH http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"address": "172.21.1.2"}'
request
curl -X DELETE http://127.0.0.1:8080/v1/domains/{DMAIN_UUID} \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff"
response
HTTP/1.1 204 No Content
Content-Length: 0
request
curl -X GET http://127.0.0.1:8080/v1/domains \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff"
response
HTTP/1.1 200 OK
Content-Type: application/json
{
"domains": [
{"domain": "hogehoge.hoge", "uuid": "aea6cf49-2912-42af-b903-dae1312f64d9"},
{"domain": "fugafuga.hoge", "uuid": "1cf4caeb-f474-44d1-8eda-b9596cc22f00"}
]
}
request
curl -X GET http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID} \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff"
response
HTTP/1.1 200 OK
Content-Type: application/json
{
"domain": "hogehoge.hoge",
"uuid": "aea6cf49-2912-42af-b903-dae1312f64d9",
"hosts": [
{
"hostname": "hogeserver2",
"address": "172.21.1.2",
"uuid": "a51d334d-567c-4566-b1ff-186446403d3a"
}
]
}
request
curl -X POST http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"hostname": "hogeserver1", "address": "172.21.1.1"}'
response
HTTP/1.1 201 Created
Content-Type: application/json
{
"domain": "hogehoge.hoge",
"hosts": {
"hostname": "hogeserver1",
"address": "172.21.1.1",
"uuid": "a51d334d-567c-4566-b1ff-186446403d3a"
}
}
request
curl -X PATCH http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"hostname": "hogeserver2"}'
or
curl -X PATCH http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"address": "172.21.1.2"}'
or
curl -X PATCH http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Accept: application/json" \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff" \
-d '{"hostname": "hogeserver2", "address": "172.21.1.2"}'
response
HTTP/1.1 200 OK
Content-Type: application/json
{
"domain": "hogehoge.hoge",
"hosts": {
"hostname": "hogeserver2",
"address": "172.21.1.2",
"uuid": "a51d334d-567c-4566-b1ff-186446403d3a"
}
}
request
curl -X DELETE http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff"
response
HTTP/1.1 204 No Content
Content-Length: 0
request
curl -X GET http://127.0.0.1:8080/v1/domains/{DOMAIN_UUID}/hosts/{HOST_UUID} \
-H "Tenant: df397e50-8006-450e-b18b-5c5bd940baff"
response
HTTP/1.1 200 OK
Content-Type: application/json
{
"domain": "hogehoge.hoge",
"uuid": "aea6cf49-2912-42af-b903-dae1312f64d9",
"hosts": [
{
"hostname": "hogeserver2",
"address": "172.21.1.2",
"uuid": "a51d334d-567c-4566-b1ff-186446403d3a"
}
]
}
dig @127.0.0.1 hogeserver1.hogehoge.hoge
build command
bash scripts/code_build.sh
get tenant list, and its accessible domains.
bash scripts/tenant_list.sh
- Use goroutine to update filesystem sequentially.