#rest api or python client library to set disk encryption keys

1 messages · Page 1 of 1 (latest)

vital moss
#

Hello I'm trying to use a native python solution to emulate the CLI command storage encryption disk modify -disk * -data-key-id <key> on 9.12 but I can't seem to figure out how. :

`resource=Disk()
resource.get(fields="key_id", name="1.0.0",)
Disk({'key_id': {'data': '', 'fips': '0x0'}, 'name': '1.0.0'})

resource.patch_collection(body={"key_id":{"data": encrypt_key, "fips": "0x0"}}, name="1.0.0",)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "venv/lib/python3.8/site-packages/netapp_ontap/resources/disk.py", line 985, in patch_collection
return super()._patch_collection(
File "venv/lib/python3.8/site-packages/netapp_ontap/utils.py", line 55, in wrapper
return on_api_fail(erro)
File "venv/lib/python3.8/site-packages/netapp_ontap/utils.py", line 78, in on_api_fail
raise NetAppRestError(cause=erro) from None
netapp_ontap.error.NetAppRestError: Caused by HTTPError('400 Client Error: Bad Request for url: https://xxxxx:443/api/storage/disks?name=*'): Field "key_id.data" cannot be set in this operation.`