#clientmatch parameter in export policy creation

1 messages · Page 1 of 1 (latest)

oak raptor
#

I wrote this code to generate an export policy but each time i run it i get this 400 error saying "clientmatch is a required filed".
I dont know what exactly is missing and in what format do I add it so please offer me some guideance, as the client list of dicts apparently is incorect for ontap 9.11 which is what im running

def create_export_policy(svm_uuid, name, hostname=None, ip=None):
    resource = ExportPolicy()
    resource.name = name
    resource.rules = [
        {
            # "client": [{"match": f"{hostname}"}, {"match": f"{ip}"}],
            "clientmatch": [f"{ip}/22"],
            "ro_rule": ["sys"],
            "rw_rule": ["sys"],
            "su_rule": ["sys"],
        },
    ]
    resource.svm = {"uuid": svm_uuid}

    resource.protocols = ["nfs"]

    try:
        resource.post()
    except Exception as e:
        print(e)
raven shard
#

I don't know the python API very well but I guess the clientmatch goes somewhere else than in the "rules" member? it's not technically a "rule". maybe resource.clientmatch = ... or something?