#is "-records" available for REST to create a new export policy rule in multiple export policies?

1 messages · Page 1 of 1 (latest)

hoary rose
#

hi team, I am trying to find out if I can use the "records" option with the export-policy rule post API to create a new rule for multiple (different) export policies. there is a variable (policy.id) in the API "/protocols​/nfs​/export-policies​/{policy.id}​/rules". This is to provide access for a new compute node to multiple volumes, each volume has its own export-policy.

I am able to create multiple volumes using the following, but there is no variable in the volume creation API:

curl -X POST 'https://<mgmt-ip>/api/storage/volumes' -H 'accept: application/hal+json' -d '{ "records": [
{ "svm": { "name": "svm1" }, "name" : "vol1", "size": "1GB", "aggregates": [ { "name": "aggr1" } ] },
{ "svm": { "name": "svm1" }, "name" : "vol2", "size": "1GB", "aggregates": [ { "name": "aggr1" } ] } ] }'

crude laurel
hoary rose
#

thanks James for the feedbacks. Just wanted to make sure I understood what you said. your notes referenced the 'export-policy" API. I was asking about "export-policy rule" api.

with the "export-policy" API, I didn't have any issues with using the "multi record" option to create multiple policy with one API post call:

curl -X POST "https://cluster1/api/protocols/nfs/export-policies" -u <username>:<password> -k -d '{ "records": [
{ "svm": { "name": "svm1_cluster1" }, "name" : "pol1" },
{ "svm": { "name": "svm1_cluster1" }, "name" : "pol2" },
{ "svm": { "name": "svm1_cluster1" }, "name" : "pol3" },
{ "svm": { "name": "svm1_cluster1" }, "name" : "pol4" } ] }'

crude laurel
#

Whoops...
But... /protocols/nfs/export-policies POST and PATCH allow passing an array of rules to create or delete.

hoary rose
#

thanks James. sorry, I should have been clear in my postings that I need to create new rules for existing export-policies, but not creating new policies with new rules. So I have to use "/protocols​/nfs​/export-policies​/{policy.id}​/rules", not "/protocols/nfs/export-policies" - please correct me if I am wrong.