tech note

インフラ技術や車についてつぶやいていくブログ

BIG-IP APIにてDataGroupを編集する方法

f:id:tea_cat:20180913022350j:plain

192.168.0.1,192.168.0.2をClass_hogeへ挿入

curl -ksu "$user":"$pass" "https://1.1.1.1/mgmt/tm/ltm/data-group/internal/~Common~Class_hoge" -H "Content-Type: application/json" -X PUT -d "{ \"records\" : [{\"name\": \"192.168.0.1\", \"data\": \"\" }{\"name\": \"192.168.0.2\", \"data\": \"\" }] }" | jq

192.168.0.1を削除

curl -ksu "$user":"$pass" "https://1.1.1.1/mgmt/tm/ltm/data-group/internal/~Common~Class_hoge" -H "Content-Type: application/json" -X PUT -d "{ \"records\" : [{\"name\": \"192.168.0.2\", \"data\": \"\" }] }" | jq

全部削除

curl -ksu "$user":"$pass" "https://1.1.1.1/mgmt/tm/ltm/data-group/internal/~Common~Class_hoge" -H "Content-Type: application/json" -X PUT -d "{ \"records\" : [] }" | jq