diff --git a/Cargo.lock b/Cargo.lock index 4c6c892656..597f5cbb85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -460,6 +460,18 @@ dependencies = [ "uuid", ] +[[package]] +name = "azure_security_keyvault_keys" +version = "0.1.0" +dependencies = [ + "azure_core", + "futures", + "serde", + "serde_json", + "time", + "typespec_client_core", +] + [[package]] name = "azure_security_keyvault_secrets" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index e77662b2ff..9c8a4f519f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "sdk/cosmos/azure_data_cosmos", "sdk/identity/azure_identity", "sdk/eventhubs/azure_messaging_eventhubs", + "sdk/keyvault/azure_security_keyvault_keys", "sdk/keyvault/azure_security_keyvault_secrets", "eng/test/mock_transport", "sdk/storage", diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index ee5593741b..ffeaee3340 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-rust": "0.7.0" + "@azure-tools/typespec-rust": "0.8.1" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", @@ -152,17 +152,17 @@ } }, "node_modules/@azure-tools/typespec-rust": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.7.0.tgz", - "integrity": "sha512-M+AWPLzZI6ZJa7l8hGQO4wBKPbc8ptQBQtBLqeunzKJ1lzD79jReLzBBXUtnQw+zlj9wXUt5kiM43Dqo6QX4aw==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-rust/-/typespec-rust-0.8.1.tgz", + "integrity": "sha512-TsNJ+Or1PrlMhdUmHRl6MLU1NVoTo3rfAqMzJTwGNio60b7EYpgCPs+ljU8VanUWnc80Ve/o2t+zQNGWrNK22Q==", "license": "MIT", "dependencies": { "@azure-tools/codegen": "~2.9.2", "@azure-tools/linq": "~3.1.263", - "js-yaml": "~4.1.0", + "js-yaml": "^4.1.0", "query-string": "9.1.1", "source-map-support": "0.5.21", - "vitest": "^1.6.0" + "vitest": "^1.6.1" }, "engines": { "node": ">=20.0.0" @@ -631,9 +631,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.30.1.tgz", - "integrity": "sha512-pSWY+EVt3rJ9fQ3IqlrEUtXh3cGqGtPDH1FQlNZehO2yYxCHEX1SPsz1M//NXwYfbTlcKr9WObLnJX9FsS9K1Q==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.1.tgz", + "integrity": "sha512-kwctwVlswSEsr4ljpmxKrRKp1eG1v2NAhlzFzDf1x1OdYaMjBYjDCbHkzWm57ZXzTwqn8stMXgROrnMw8dJK3w==", "cpu": [ "arm" ], @@ -644,9 +644,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.30.1.tgz", - "integrity": "sha512-/NA2qXxE3D/BRjOJM8wQblmArQq1YoBVJjrjoTSBS09jgUisq7bqxNHJ8kjCHeV21W/9WDGwJEWSN0KQ2mtD/w==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.1.tgz", + "integrity": "sha512-4H5ZtZitBPlbPsTv6HBB8zh1g5d0T8TzCmpndQdqq20Ugle/nroOyDMf9p7f88Gsu8vBLU78/cuh8FYHZqdXxw==", "cpu": [ "arm64" ], @@ -657,9 +657,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.30.1.tgz", - "integrity": "sha512-r7FQIXD7gB0WJ5mokTUgUWPl0eYIH0wnxqeSAhuIwvnnpjdVB8cRRClyKLQr7lgzjctkbp5KmswWszlwYln03Q==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.1.tgz", + "integrity": "sha512-f2AJ7Qwx9z25hikXvg+asco8Sfuc5NCLg8rmqQBIOUoWys5sb/ZX9RkMZDPdnnDevXAMJA5AWLnRBmgdXGEUiA==", "cpu": [ "arm64" ], @@ -670,9 +670,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.30.1.tgz", - "integrity": "sha512-x78BavIwSH6sqfP2xeI1hd1GpHL8J4W2BXcVM/5KYKoAD3nNsfitQhvWSw+TFtQTLZ9OmlF+FEInEHyubut2OA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.1.tgz", + "integrity": "sha512-+/2JBrRfISCsWE4aEFXxd+7k9nWGXA8+wh7ZUHn/u8UDXOU9LN+QYKKhd57sIn6WRcorOnlqPMYFIwie/OHXWw==", "cpu": [ "x64" ], @@ -683,9 +683,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.30.1.tgz", - "integrity": "sha512-HYTlUAjbO1z8ywxsDFWADfTRfTIIy/oUlfIDmlHYmjUP2QRDTzBuWXc9O4CXM+bo9qfiCclmHk1x4ogBjOUpUQ==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.1.tgz", + "integrity": "sha512-SUeB0pYjIXwT2vfAMQ7E4ERPq9VGRrPR7Z+S4AMssah5EHIilYqjWQoTn5dkDtuIJUSTs8H+C9dwoEcg3b0sCA==", "cpu": [ "arm64" ], @@ -696,9 +696,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.30.1.tgz", - "integrity": "sha512-1MEdGqogQLccphhX5myCJqeGNYTNcmTyaic9S7CG3JhwuIByJ7J05vGbZxsizQthP1xpVx7kd3o31eOogfEirw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.1.tgz", + "integrity": "sha512-L3T66wAZiB/ooiPbxz0s6JEX6Sr2+HfgPSK+LMuZkaGZFAFCQAHiP3dbyqovYdNaiUXcl9TlgnIbcsIicAnOZg==", "cpu": [ "x64" ], @@ -709,9 +709,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.30.1.tgz", - "integrity": "sha512-PaMRNBSqCx7K3Wc9QZkFx5+CX27WFpAMxJNiYGAXfmMIKC7jstlr32UhTgK6T07OtqR+wYlWm9IxzennjnvdJg==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.1.tgz", + "integrity": "sha512-UBXdQ4+ATARuFgsFrQ+tAsKvBi/Hly99aSVdeCUiHV9dRTTpMU7OrM3WXGys1l40wKVNiOl0QYY6cZQJ2xhKlQ==", "cpu": [ "arm" ], @@ -722,9 +722,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.30.1.tgz", - "integrity": "sha512-B8Rcyj9AV7ZlEFqvB5BubG5iO6ANDsRKlhIxySXcF1axXYUyqwBok+XZPgIYGBgs7LDXfWfifxhw0Ik57T0Yug==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.1.tgz", + "integrity": "sha512-m/yfZ25HGdcCSwmopEJm00GP7xAUyVcBPjttGLRAqZ60X/bB4Qn6gP7XTwCIU6bITeKmIhhwZ4AMh2XLro+4+w==", "cpu": [ "arm" ], @@ -735,9 +735,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.30.1.tgz", - "integrity": "sha512-hqVyueGxAj3cBKrAI4aFHLV+h0Lv5VgWZs9CUGqr1z0fZtlADVV1YPOij6AhcK5An33EXaxnDLmJdQikcn5NEw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.1.tgz", + "integrity": "sha512-Wy+cUmFuvziNL9qWRRzboNprqSQ/n38orbjRvd6byYWridp5TJ3CD+0+HUsbcWVSNz9bxkDUkyASGP0zS7GAvg==", "cpu": [ "arm64" ], @@ -748,9 +748,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.30.1.tgz", - "integrity": "sha512-i4Ab2vnvS1AE1PyOIGp2kXni69gU2DAUVt6FSXeIqUCPIR3ZlheMW3oP2JkukDfu3PsexYRbOiJrY+yVNSk9oA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.1.tgz", + "integrity": "sha512-CQ3MAGgiFmQW5XJX5W3wnxOBxKwFlUAgSXFA2SwgVRjrIiVt5LHfcQLeNSHKq5OEZwv+VCBwlD1+YKCjDG8cpg==", "cpu": [ "arm64" ], @@ -761,9 +761,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.30.1.tgz", - "integrity": "sha512-fARcF5g296snX0oLGkVxPmysetwUk2zmHcca+e9ObOovBR++9ZPOhqFUM61UUZ2EYpXVPN1redgqVoBB34nTpQ==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.1.tgz", + "integrity": "sha512-rSzb1TsY4lSwH811cYC3OC2O2mzNMhM13vcnA7/0T6Mtreqr3/qs6WMDriMRs8yvHDI54qxHgOk8EV5YRAHFbw==", "cpu": [ "loong64" ], @@ -774,9 +774,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.30.1.tgz", - "integrity": "sha512-GLrZraoO3wVT4uFXh67ElpwQY0DIygxdv0BNW9Hkm3X34wu+BkqrDrkcsIapAY+N2ATEbvak0XQ9gxZtCIA5Rw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.1.tgz", + "integrity": "sha512-fwr0n6NS0pG3QxxlqVYpfiY64Fd1Dqd8Cecje4ILAV01ROMp4aEdCj5ssHjRY3UwU7RJmeWd5fi89DBqMaTawg==", "cpu": [ "ppc64" ], @@ -787,9 +787,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.30.1.tgz", - "integrity": "sha512-0WKLaAUUHKBtll0wvOmh6yh3S0wSU9+yas923JIChfxOaaBarmb/lBKPF0w/+jTVozFnOXJeRGZ8NvOxvk/jcw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.1.tgz", + "integrity": "sha512-4uJb9qz7+Z/yUp5RPxDGGGUcoh0PnKF33QyWgEZ3X/GocpWb6Mb+skDh59FEt5d8+Skxqs9mng6Swa6B2AmQZg==", "cpu": [ "riscv64" ], @@ -800,9 +800,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.30.1.tgz", - "integrity": "sha512-GWFs97Ruxo5Bt+cvVTQkOJ6TIx0xJDD/bMAOXWJg8TCSTEK8RnFeOeiFTxKniTc4vMIaWvCplMAFBt9miGxgkA==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.1.tgz", + "integrity": "sha512-QlIo8ndocWBEnfmkYqj8vVtIUpIqJjfqKggjy7IdUncnt8BGixte1wDON7NJEvLg3Kzvqxtbo8tk+U1acYEBlw==", "cpu": [ "s390x" ], @@ -813,9 +813,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.30.1.tgz", - "integrity": "sha512-UtgGb7QGgXDIO+tqqJ5oZRGHsDLO8SlpE4MhqpY9Llpzi5rJMvrK6ZGhsRCST2abZdBqIBeXW6WPD5fGK5SDwg==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.1.tgz", + "integrity": "sha512-hzpleiKtq14GWjz3ahWvJXgU1DQC9DteiwcsY4HgqUJUGxZThlL66MotdUEK9zEo0PK/2ADeZGM9LIondE302A==", "cpu": [ "x64" ], @@ -826,9 +826,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.30.1.tgz", - "integrity": "sha512-V9U8Ey2UqmQsBT+xTOeMzPzwDzyXmnAoO4edZhL7INkwQcaW1Ckv3WJX3qrrp/VHaDkEWIBWhRwP47r8cdrOow==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.1.tgz", + "integrity": "sha512-jqtKrO715hDlvUcEsPn55tZt2TEiBvBtCMkUuU0R6fO/WPT7lO9AONjPbd8II7/asSiNVQHCMn4OLGigSuxVQA==", "cpu": [ "x64" ], @@ -839,9 +839,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.30.1.tgz", - "integrity": "sha512-WabtHWiPaFF47W3PkHnjbmWawnX/aE57K47ZDT1BXTS5GgrBUEpvOzq0FI0V/UYzQJgdb8XlhVNH8/fwV8xDjw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.1.tgz", + "integrity": "sha512-RnHy7yFf2Wz8Jj1+h8klB93N0NHNHXFhNwAmiy9zJdpY7DE01VbEVtPdrK1kkILeIbHGRJjvfBDBhnxBr8kD4g==", "cpu": [ "arm64" ], @@ -852,9 +852,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.30.1.tgz", - "integrity": "sha512-pxHAU+Zv39hLUTdQQHUVHf4P+0C47y/ZloorHpzs2SXMRqeAWmGghzAhfOlzFHHwjvgokdFAhC4V+6kC1lRRfw==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.1.tgz", + "integrity": "sha512-i7aT5HdiZIcd7quhzvwQ2oAuX7zPYrYfkrd1QFfs28Po/i0q6kas/oRrzGlDhAEyug+1UfUtkWdmoVlLJj5x9Q==", "cpu": [ "ia32" ], @@ -865,9 +865,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.30.1.tgz", - "integrity": "sha512-D6qjsXGcvhTjv0kI4fU8tUuBDF/Ueee4SVX79VfNDXZa64TfCW1Slkb6Z7O1p7vflqZjcmOVdZlqf8gvJxc6og==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.1.tgz", + "integrity": "sha512-k3MVFD9Oq+laHkw2N2v7ILgoa9017ZMF/inTtHzyTVZjYs9cSH18sdyAf6spBAJIGwJ5UaC7et2ZH1WCdlhkMw==", "cpu": [ "x64" ], @@ -1000,13 +1000,13 @@ } }, "node_modules/@vitest/expect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", - "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", "license": "MIT", "dependencies": { - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "chai": "^4.3.10" }, "funding": { @@ -1014,12 +1014,12 @@ } }, "node_modules/@vitest/runner": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", - "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", "license": "MIT", "dependencies": { - "@vitest/utils": "1.6.0", + "@vitest/utils": "1.6.1", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -1028,9 +1028,9 @@ } }, "node_modules/@vitest/snapshot": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", - "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", "license": "MIT", "dependencies": { "magic-string": "^0.30.5", @@ -1042,9 +1042,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", - "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", "license": "MIT", "dependencies": { "tinyspy": "^2.2.0" @@ -1054,9 +1054,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", - "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", "license": "MIT", "dependencies": { "diff-sequences": "^29.6.3", @@ -1434,9 +1434,9 @@ } }, "node_modules/fast-uri": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.5.tgz", - "integrity": "sha512-5JnBCWpFlMo0a3ciDy/JckMzzv1U9coZrIhedq+HXxxUfDTAiS0LA8OKVao4G9BxmCVck/jtA5r3KAtRWEyD8Q==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.6.tgz", + "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==", "funding": [ { "type": "github", @@ -1450,9 +1450,9 @@ "license": "BSD-3-Clause" }, "node_modules/fastq": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", - "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -2119,9 +2119,9 @@ } }, "node_modules/rollup": { - "version": "4.30.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.1.tgz", - "integrity": "sha512-mlJ4glW020fPuLi7DkM/lN97mYEZGWeqBnrljzN0gs7GLctqX3lNWxKQ7Gl712UAX+6fog/L3jh4gb7R6aVi3w==", + "version": "4.34.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.1.tgz", + "integrity": "sha512-iYZ/+PcdLYSGfH3S+dGahlW/RWmsqDhLgj1BT9DH/xXJ0ggZN7xkdP9wipPNjjNLczI+fmMLmTB9pye+d2r4GQ==", "license": "MIT", "dependencies": { "@types/estree": "1.0.6" @@ -2134,25 +2134,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.30.1", - "@rollup/rollup-android-arm64": "4.30.1", - "@rollup/rollup-darwin-arm64": "4.30.1", - "@rollup/rollup-darwin-x64": "4.30.1", - "@rollup/rollup-freebsd-arm64": "4.30.1", - "@rollup/rollup-freebsd-x64": "4.30.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.30.1", - "@rollup/rollup-linux-arm-musleabihf": "4.30.1", - "@rollup/rollup-linux-arm64-gnu": "4.30.1", - "@rollup/rollup-linux-arm64-musl": "4.30.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.30.1", - "@rollup/rollup-linux-powerpc64le-gnu": "4.30.1", - "@rollup/rollup-linux-riscv64-gnu": "4.30.1", - "@rollup/rollup-linux-s390x-gnu": "4.30.1", - "@rollup/rollup-linux-x64-gnu": "4.30.1", - "@rollup/rollup-linux-x64-musl": "4.30.1", - "@rollup/rollup-win32-arm64-msvc": "4.30.1", - "@rollup/rollup-win32-ia32-msvc": "4.30.1", - "@rollup/rollup-win32-x64-msvc": "4.30.1", + "@rollup/rollup-android-arm-eabi": "4.34.1", + "@rollup/rollup-android-arm64": "4.34.1", + "@rollup/rollup-darwin-arm64": "4.34.1", + "@rollup/rollup-darwin-x64": "4.34.1", + "@rollup/rollup-freebsd-arm64": "4.34.1", + "@rollup/rollup-freebsd-x64": "4.34.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.1", + "@rollup/rollup-linux-arm-musleabihf": "4.34.1", + "@rollup/rollup-linux-arm64-gnu": "4.34.1", + "@rollup/rollup-linux-arm64-musl": "4.34.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.1", + "@rollup/rollup-linux-riscv64-gnu": "4.34.1", + "@rollup/rollup-linux-s390x-gnu": "4.34.1", + "@rollup/rollup-linux-x64-gnu": "4.34.1", + "@rollup/rollup-linux-x64-musl": "4.34.1", + "@rollup/rollup-win32-arm64-msvc": "4.34.1", + "@rollup/rollup-win32-ia32-msvc": "4.34.1", + "@rollup/rollup-win32-x64-msvc": "4.34.1", "fsevents": "~2.3.2" } }, @@ -2180,9 +2180,9 @@ } }, "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -2447,9 +2447,9 @@ } }, "node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "5.4.14", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.14.tgz", + "integrity": "sha512-EK5cY7Q1D8JNhSaPKVK4pwBFvaTmZxEnoKXLG/U9gmdDcihQGNzFlgIvaxezFR4glP1LsuiedwMBqCXH3wZccA==", "license": "MIT", "dependencies": { "esbuild": "^0.21.3", @@ -2506,9 +2506,9 @@ } }, "node_modules/vite-node": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", - "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", "license": "MIT", "dependencies": { "cac": "^6.7.14", @@ -2528,16 +2528,16 @@ } }, "node_modules/vitest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", - "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", "license": "MIT", "dependencies": { - "@vitest/expect": "1.6.0", - "@vitest/runner": "1.6.0", - "@vitest/snapshot": "1.6.0", - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "acorn-walk": "^8.3.2", "chai": "^4.3.10", "debug": "^4.3.4", @@ -2551,7 +2551,7 @@ "tinybench": "^2.5.1", "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.6.0", + "vite-node": "1.6.1", "why-is-node-running": "^2.2.2" }, "bin": { @@ -2566,8 +2566,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.6.0", - "@vitest/ui": "1.6.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", "happy-dom": "*", "jsdom": "*" }, diff --git a/eng/emitter-package.json b/eng/emitter-package.json index de8bd2ff43..4f43ed41fd 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,7 +1,7 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-rust": "0.7.0" + "@azure-tools/typespec-rust": "0.8.1" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.50.0", @@ -14,4 +14,4 @@ "@typespec/versioning": "0.64.0", "@typespec/xml": "0.64.0" } -} \ No newline at end of file +} diff --git a/sdk/keyvault/.dict.txt b/sdk/keyvault/.dict.txt index df4c129d2d..8739c96fc5 100644 --- a/sdk/keyvault/.dict.txt +++ b/sdk/keyvault/.dict.txt @@ -1,2 +1,17 @@ +cbcpad +ciphertext +ckmaeskeywrap +ckmaeskeywrappad +ckmrsaaeskeywrap +deletedkeys deletedsecrets +echsm +oaep purgeable +rotationpolicy +rsaaeskeywrap +rsahsm +rsaoaep +rsnull +unwrapkey +wrapkey diff --git a/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml new file mode 100644 index 0000000000..4144026754 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "azure_security_keyvault_keys" +version = "0.1.0" +description = "Rust wrappers around Microsoft Azure REST APIs - Azure KeyVault Keys" +readme = "README.md" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true +homepage = "https://github.com/azure/azure-sdk-for-rust" +documentation = "https://docs.rs/azure_security_keyvault_keys" +keywords = ["sdk", "azure", "rest", "cloud", "keyvault", "security", "keys"] +categories = ["api-bindings"] + +[dependencies] +azure_core = { workspace = true } +futures = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +time = { workspace = true } +typespec_client_core = { workspace = true, features = ["derive"] } diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs new file mode 100644 index 0000000000..6d3135922e --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/key_client.rs @@ -0,0 +1,949 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::models::{ + BackupKeyResult, DeletedKeyBundle, DeletedKeyListResult, GetRandomBytesRequest, KeyBundle, + KeyCreateParameters, KeyImportParameters, KeyListResult, KeyOperationResult, + KeyOperationsParameters, KeyReleaseParameters, KeyReleaseResult, KeyRestoreParameters, + KeyRotationPolicy, KeySignParameters, KeyUpdateParameters, KeyVerifyParameters, + KeyVerifyResult, RandomBytes, +}; +use azure_core::credentials::TokenCredential; +use azure_core::{ + BearerTokenCredentialPolicy, ClientMethodOptions, ClientOptions, Context, Method, Pager, + Pipeline, Policy, Request, RequestContent, Response, Result, Url, +}; +use std::sync::Arc; +use typespec_client_core::fmt::SafeDebug; +use typespec_client_core::http::PagerResult; +use typespec_client_core::json; + +pub struct KeyClient { + api_version: String, + endpoint: Url, + pipeline: Pipeline, +} + +#[derive(Clone, SafeDebug)] +pub struct KeyClientOptions { + pub api_version: String, + pub client_options: ClientOptions, +} + +impl KeyClient { + pub fn new( + endpoint: &str, + credential: Arc, + options: Option, + ) -> Result { + let options = options.unwrap_or_default(); + let mut endpoint = Url::parse(endpoint)?; + endpoint.set_query(None); + let auth_policy: Arc = Arc::new(BearerTokenCredentialPolicy::new( + credential, + vec!["https://vault.azure.net/.default"], + )); + Ok(Self { + endpoint, + api_version: options.api_version, + pipeline: Pipeline::new( + option_env!("CARGO_PKG_NAME"), + option_env!("CARGO_PKG_VERSION"), + options.client_options, + Vec::default(), + vec![auth_policy], + ), + }) + } + + /// Returns the Url associated with this client. + pub fn endpoint(&self) -> &Url { + &self.endpoint + } + + /// Requests that a backup of the specified key be downloaded to the client. + /// + /// The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this operation does NOT return + /// key material in a form that can be used outside the Azure Key Vault system, the returned key material is either protected + /// to a Azure Key Vault HSM or to Azure Key Vault itself. The intent of this operation is to allow a client to GENERATE a + /// key in one Azure Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. The BACKUP + /// operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a key cannot + /// be backed up. BACKUP / RESTORE can be performed within geographical boundaries only; meaning that a BACKUP from one geographical + /// area cannot be restored to another geographical area. For example, a backup from the US geographical area cannot be restored + /// in an EU geographical area. This operation requires the key/backup permission. + pub async fn backup_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/backup"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Creates a new key, stores it, then returns key parameters and attributes to the client. + /// + /// The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure + /// Key Vault creates a new version of the key. It requires the keys/create permission. + pub async fn create_key( + &self, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/create"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Decrypts a single block of encrypted data. + /// + /// The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption key and specified algorithm. + /// This operation is the reverse of the ENCRYPT operation; only a single block of data may be decrypted, the size of this + /// block is dependent on the target key and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric + /// keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/decrypt + /// permission. Microsoft recommends not to use CBC algorithms for decryption without first ensuring the integrity of the + /// ciphertext using an HMAC, for example. See + /// for more information. + pub async fn decrypt( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/decrypt"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Deletes a key of any type from storage in Azure Key Vault. + /// + /// The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic + /// material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. + /// This operation requires the keys/delete permission. + pub async fn delete_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + /// + /// The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is stored in Azure Key Vault. + /// Note that the ENCRYPT operation only supports a single block of data, the size of which is dependent on the target key + /// and the encryption algorithm to be used. The ENCRYPT operation is only strictly necessary for symmetric keys stored in + /// Azure Key Vault since protection with an asymmetric key can be performed using public portion of the key. This operation + /// is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the + /// public key material. This operation requires the keys/encrypt permission. + pub async fn encrypt( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/encrypt"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Gets the public part of a deleted key. + /// + /// The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any + /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/get permission. + pub async fn get_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Lists the deleted keys in the specified vault. + /// + /// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. + /// This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled + /// for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + /// enabled vault. This operation requires the keys/list permission. + pub fn get_deleted_keys( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + first_url = first_url.join("deletedkeys")?; + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: DeletedKeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { response: rsp }, + }) + } + })) + } + + /// Gets the public part of a stored key. + /// + /// The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released + /// in the response. This operation requires the keys/get permission. + pub async fn get_key( + &self, + key_name: &str, + key_version: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Lists the policy for a key. + /// + /// The GetKeyRotationPolicy operation returns the specified key policy resources in the specified key vault. This operation + /// requires the keys/get permission. + pub async fn get_key_rotation_policy( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Retrieves a list of individual key versions with the same key name. + /// + /// The full key identifier, attributes, and tags are provided in the response. This operation requires the keys/list permission. + pub fn get_key_versions( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/versions"); + path = path.replace("{key-name}", key_name); + first_url = first_url.join(&path)?; + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { response: rsp }, + }) + } + })) + } + + /// List keys in the specified vault. + /// + /// Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a stored key. + /// The LIST operation is applicable to all key types, however only the base key identifier, attributes, and tags are provided + /// in the response. Individual versions of a key are not listed in the response. This operation requires the keys/list permission. + pub fn get_keys( + &self, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default().into_owned(); + let pipeline = self.pipeline.clone(); + let mut first_url = self.endpoint.clone(); + first_url = first_url.join("keys")?; + first_url + .query_pairs_mut() + .append_pair("api-version", &self.api_version); + if let Some(maxresults) = options.maxresults { + first_url + .query_pairs_mut() + .append_pair("maxresults", &maxresults.to_string()); + } + let api_version = self.api_version.clone(); + Ok(Pager::from_callback(move |next_link: Option| { + let url = match next_link { + Some(next_link) => { + let qp = next_link + .query_pairs() + .filter(|(name, _)| name.ne("api-version")); + let mut next_link = next_link.clone(); + next_link + .query_pairs_mut() + .clear() + .extend_pairs(qp) + .append_pair("api-version", &api_version); + next_link + } + None => first_url.clone(), + }; + let mut request = Request::new(url, Method::Get); + request.insert_header("accept", "application/json"); + let ctx = options.method_options.context.clone(); + let pipeline = pipeline.clone(); + async move { + let rsp: Response = pipeline.send(&ctx, &mut request).await?; + let (status, headers, body) = rsp.deconstruct(); + let bytes = body.collect().await?; + let res: KeyListResult = json::from_json(bytes.clone())?; + let rsp = Response::from_bytes(status, headers, bytes); + Ok(match res.next_link { + Some(next_link) => PagerResult::Continue { + response: rsp, + continuation: next_link.parse()?, + }, + None => PagerResult::Complete { response: rsp }, + }) + } + })) + } + + /// Get the requested number of bytes containing random values. + /// + /// Get the requested number of bytes containing random values from a managed HSM. + pub async fn get_random_bytes( + &self, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("rng")?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Imports an externally created key, stores it, and returns key parameters and attributes to the client. + /// + /// The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, + /// Azure Key Vault creates a new version of the key. This operation requires the keys/import permission. + pub async fn import_key( + &self, + key_name: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Permanently deletes the specified key. + /// + /// The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any + /// vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission. + pub async fn purge_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Delete); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Recovers the deleted key to its latest version. + /// + /// The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted + /// key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this + /// the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. + pub async fn recover_deleted_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("deletedkeys/{key-name}/recover"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Releases a key. + /// + /// The release key operation is applicable to all key types. The target key must be marked exportable. This operation requires + /// the keys/release permission. + pub async fn release( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/release"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Restores a backed up key to a vault. + /// + /// Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access + /// control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key + /// cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the + /// key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained + /// during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore + /// all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key + /// Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + /// in the target Key Vault. This operation requires the keys/restore permission. + pub async fn restore_key( + &self, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + url = url.join("keys/restore")?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Creates a new key version, stores it, then returns key parameters, attributes and policy to the client. + /// + /// The operation will rotate the key based on the key policy. It requires the keys/rotate permission. + pub async fn rotate_key( + &self, + key_name: &str, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotate"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + self.pipeline.send(&ctx, &mut request).await + } + + /// Creates a signature from a digest using the specified key. + /// + /// The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault since this operation uses + /// the private portion of the key. This operation requires the keys/sign permission. + pub async fn sign( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/sign"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + /// + /// The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the + /// reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault + /// since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. + pub async fn unwrap_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/unwrapkey"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// The update key operation changes specified attributes of a stored key and can be applied to any key type and key version + /// stored in Azure Key Vault. + /// + /// In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a + /// key itself cannot be changed. This operation requires the keys/update permission. + pub async fn update_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Patch); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Updates the rotation policy for a key. + /// + /// Set specified members in the key policy. Leave others as undefined. This operation requires the keys/update permission. + pub async fn update_key_rotation_policy( + &self, + key_name: &str, + key_rotation_policy: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/rotationpolicy"); + path = path.replace("{key-name}", key_name); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Put); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(key_rotation_policy); + self.pipeline.send(&ctx, &mut request).await + } + + /// Verifies a signature using a specified key. + /// + /// The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not strictly necessary for asymmetric + /// keys stored in Azure Key Vault since signature verification can be performed using the public portion of the key but this + /// operation is supported as a convenience for callers that only have a key-reference and not the public portion of the key. + /// This operation requires the keys/verify permission. + pub async fn verify( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/verify"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } + + /// Wraps a symmetric key using a specified key. + /// + /// The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in + /// an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection + /// with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric + /// keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation + /// requires the keys/wrapKey permission. + pub async fn wrap_key( + &self, + key_name: &str, + key_version: &str, + parameters: RequestContent, + options: Option>, + ) -> Result> { + let options = options.unwrap_or_default(); + let ctx = Context::with_context(&options.method_options.context); + let mut url = self.endpoint.clone(); + let mut path = String::from("keys/{key-name}/{key-version}/wrapkey"); + path = path.replace("{key-name}", key_name); + path = path.replace("{key-version}", key_version); + url = url.join(&path)?; + url.query_pairs_mut() + .append_pair("api-version", &self.api_version); + let mut request = Request::new(url, Method::Post); + request.insert_header("accept", "application/json"); + request.insert_header("content-type", "application/json"); + request.set_body(parameters); + self.pipeline.send(&ctx, &mut request).await + } +} + +impl Default for KeyClientOptions { + fn default() -> Self { + Self { + api_version: String::from("7.6-preview.1"), + client_options: ClientOptions::default(), + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientBackupKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientCreateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientDecryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientDeleteKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientEncryptOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetDeletedKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetDeletedKeysOptions<'_> { + pub fn into_owned(self) -> KeyClientGetDeletedKeysOptions<'static> { + KeyClientGetDeletedKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeyVersionsOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetKeyVersionsOptions<'_> { + pub fn into_owned(self) -> KeyClientGetKeyVersionsOptions<'static> { + KeyClientGetKeyVersionsOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetKeysOptions<'a> { + pub maxresults: Option, + pub method_options: ClientMethodOptions<'a>, +} + +impl KeyClientGetKeysOptions<'_> { + pub fn into_owned(self) -> KeyClientGetKeysOptions<'static> { + KeyClientGetKeysOptions { + maxresults: self.maxresults, + method_options: ClientMethodOptions { + context: self.method_options.context.into_owned(), + }, + } + } +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientGetRandomBytesOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientImportKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientPurgeDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRecoverDeletedKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientReleaseOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRestoreKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientRotateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientSignOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUnwrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUpdateKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientUpdateKeyRotationPolicyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientVerifyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} + +#[derive(Clone, Default, SafeDebug)] +pub struct KeyClientWrapKeyOptions<'a> { + pub method_options: ClientMethodOptions<'a>, +} diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs new file mode 100644 index 0000000000..103b4f7fca --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/clients/mod.rs @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +mod key_client; +pub use key_client::*; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs new file mode 100644 index 0000000000..276f0fbfc2 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/enums.rs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use typespec_client_core::{create_enum, create_extensible_enum}; + +create_extensible_enum!( + DeletionRecoveryLevel, + (CustomizedRecoverable, "CustomizedRecoverable"), + ( + CustomizedRecoverableProtectedSubscription, + "CustomizedRecoverable+ProtectedSubscription" + ), + ( + CustomizedRecoverablePurgeable, + "CustomizedRecoverable+Purgeable" + ), + (Purgeable, "Purgeable"), + (Recoverable, "Recoverable"), + ( + RecoverableProtectedSubscription, + "Recoverable+ProtectedSubscription" + ), + (RecoverablePurgeable, "Recoverable+Purgeable") +); + +create_extensible_enum!( + JsonWebKeyCurveName, + (P256, "P-256"), + (P256K, "P-256K"), + (P384, "P-384"), + (P521, "P-521") +); + +create_extensible_enum!( + JsonWebKeyEncryptionAlgorithm, + (A128Cbc, "A128CBC"), + (A128Cbcpad, "A128CBCPAD"), + (A128Gcm, "A128GCM"), + (A128Kw, "A128KW"), + (A192Cbc, "A192CBC"), + (A192Cbcpad, "A192CBCPAD"), + (A192Gcm, "A192GCM"), + (A192Kw, "A192KW"), + (A256Cbc, "A256CBC"), + (A256Cbcpad, "A256CBCPAD"), + (A256Gcm, "A256GCM"), + (A256Kw, "A256KW"), + (CkmAesKeyWrap, "CKM_AES_KEY_WRAP"), + (CkmAesKeyWrapPad, "CKM_AES_KEY_WRAP_PAD"), + (RSA1_5, "RSA1_5"), + (RsaOAEP256, "RSA-OAEP-256"), + (RsaOaep, "RSA-OAEP") +); + +create_extensible_enum!( + JsonWebKeyOperation, + (Decrypt, "decrypt"), + (Encrypt, "encrypt"), + (Export, "export"), + (Import, "import"), + (Sign, "sign"), + (UnwrapKey, "unwrapKey"), + (Verify, "verify"), + (WrapKey, "wrapKey") +); + +create_extensible_enum!( + JsonWebKeySignatureAlgorithm, + (ES256, "ES256"), + (ES256K, "ES256K"), + (ES384, "ES384"), + (ES512, "ES512"), + (PS256, "PS256"), + (PS384, "PS384"), + (PS512, "PS512"), + (RS256, "RS256"), + (RS384, "RS384"), + (RS512, "RS512"), + (RSNULL, "RSNULL") +); + +create_extensible_enum!( + JsonWebKeyType, + (EC, "EC"), + (EcHsm, "EC-HSM"), + (Oct, "oct"), + (OctHsm, "oct-HSM"), + (RSA, "RSA"), + (RsaHsm, "RSA-HSM") +); + +create_extensible_enum!( + KeyEncryptionAlgorithm, + (CkmRsaAesKeyWrap, "CKM_RSA_AES_KEY_WRAP"), + (RsaAesKeyWrap256, "RSA_AES_KEY_WRAP_256"), + (RsaAesKeyWrap384, "RSA_AES_KEY_WRAP_384") +); + +create_enum!( + KeyRotationPolicyAction, + (Notify, "Notify"), + (Rotate, "Rotate") +); diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs new file mode 100644 index 0000000000..e3c9c5fa4a --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/mod.rs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +pub mod clients; +pub mod enums; +pub mod models; +pub mod models_serde; diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs new file mode 100644 index 0000000000..e3254f3c21 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models.rs @@ -0,0 +1,765 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::models::{ + DeletionRecoveryLevel, JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, JsonWebKeyOperation, + JsonWebKeySignatureAlgorithm, JsonWebKeyType, KeyEncryptionAlgorithm, KeyRotationPolicyAction, +}; +use azure_core::base64; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use time::OffsetDateTime; +use typespec_client_core::fmt::SafeDebug; + +/// The backup key result, containing the backup blob. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct BackupKeyResult { + /// The backup blob containing the backed up key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub value: Option>, +} + +/// A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyBundle { + /// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The time when the key was deleted, in UTC + #[serde( + default, + rename = "deletedDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub deleted_date: Option, + + /// The Json web key. + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + + /// The url of the recovery object, used to identify and recover the deleted key. + #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] + pub recovery_id: Option, + + /// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// The time when the key is scheduled to be purged, in UTC + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub scheduled_purge_date: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The deleted key item containing the deleted key metadata and information about deletion. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyItem { + /// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The time when the key was deleted, in UTC + #[serde( + default, + rename = "deletedDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub deleted_date: Option, + + /// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + + /// The url of the recovery object, used to identify and recover the deleted key. + #[serde(rename = "recoveryId", skip_serializing_if = "Option::is_none")] + pub recovery_id: Option, + + /// The time when the key is scheduled to be purged, in UTC + #[serde( + default, + rename = "scheduledPurgeDate", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub scheduled_purge_date: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// A list of keys that have been deleted in this vault. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct DeletedKeyListResult { + /// The URL to get the next set of deleted keys. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// A response message containing a list of deleted keys in the key vault along with a link to the next page of deleted keys. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +/// The get random bytes request object. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct GetRandomBytesRequest { + /// The requested number of random bytes. + #[serde(skip_serializing_if = "Option::is_none")] + pub count: Option, +} + +/// As of +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct JsonWebKey { + /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + #[serde(skip_serializing_if = "Option::is_none")] + pub crv: Option, + + /// RSA private exponent, or the D component of an EC private key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub d: Option>, + + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub dp: Option>, + + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub dq: Option>, + + /// RSA public exponent. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub e: Option>, + + /// Symmetric key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub k: Option>, + + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + + /// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + + /// JsonWebKey Key Type (kty), as defined in . + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + + /// RSA modulus. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub n: Option>, + + /// RSA secret prime. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub p: Option>, + + /// RSA secret prime, with p < q. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub q: Option>, + + /// RSA private key parameter. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub qi: Option>, + + /// Protected Key, used with 'Bring Your Own Key'. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "key_hsm", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub t: Option>, + + /// X component of an EC public key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub x: Option>, + + /// Y component of an EC public key. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub y: Option>, +} + +/// The attributes of a key managed by the key vault service. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyAttributes { + /// Creation time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub created: Option, + + /// Determines whether the object is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled: Option, + + /// Expiry date in UTC. + #[serde( + default, + rename = "exp", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub expires: Option, + + /// Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable + /// key. + #[serde(skip_serializing_if = "Option::is_none")] + pub exportable: Option, + + /// The underlying HSM Platform. + #[serde(rename = "hsmPlatform", skip_serializing_if = "Option::is_none")] + pub hsm_platform: Option, + + /// Not before date in UTC. + #[serde( + default, + rename = "nbf", + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub not_before: Option, + + /// softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + #[serde(rename = "recoverableDays", skip_serializing_if = "Option::is_none")] + pub recoverable_days: Option, + + /// Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' the + /// key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the retention + /// interval. + #[serde(rename = "recoveryLevel", skip_serializing_if = "Option::is_none")] + pub recovery_level: Option, + + /// Last updated time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub updated: Option, +} + +/// A KeyBundle consisting of a WebKey plus its attributes. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyBundle { + /// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The Json web key. + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + + /// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The key create parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyCreateParameters { + /// Elliptic curve name. For valid values, see JsonWebKeyCurveName. + #[serde(rename = "crv", skip_serializing_if = "Option::is_none")] + pub curve: Option, + + /// The attributes of a key managed by the key vault service. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + + /// The key size in bits. For example: 2048, 3072, or 4096 for RSA. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_size: Option, + + /// The type of key to create. For valid values, see JsonWebKeyType. + #[serde(skip_serializing_if = "Option::is_none")] + pub kty: Option, + + /// The public exponent for a RSA key. + #[serde(skip_serializing_if = "Option::is_none")] + pub public_exponent: Option, + + /// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The key import parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyImportParameters { + /// Whether to import as a hardware key (HSM) or software key. + #[serde(rename = "Hsm", skip_serializing_if = "Option::is_none")] + pub hsm: Option, + + /// The Json web key + #[serde(skip_serializing_if = "Option::is_none")] + pub key: Option, + + /// The key management attributes. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + + /// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The key item containing key metadata. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyItem { + /// The key management attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// Key identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + + /// True if the key's lifetime is managed by key vault. If this is a key backing a certificate, then managed will be true. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The key list result. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyListResult { + /// The URL to get the next set of keys. + #[serde(rename = "nextLink", skip_serializing_if = "Option::is_none")] + pub next_link: Option, + + /// A response message containing a list of keys in the key vault along with a link to the next page of keys. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +/// The key operation result. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyOperationResult { + /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "aad", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub additional_authenticated_data: Option>, + + /// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "tag", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub authentication_tag: Option>, + + /// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub iv: Option>, + + /// Key identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub kid: Option, + + /// The result of the operation. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub result: Option>, +} + +/// The key operations parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyOperationsParameters { + /// Additional data to authenticate but not encrypt/decrypt when using authenticated crypto algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub aad: Option>, + + /// algorithm identifier + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + + /// Cryptographically random, non-repeating initialization vector for symmetric algorithms. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub iv: Option>, + + /// The tag to authenticate when performing decryption with an authenticated algorithm. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub tag: Option>, + + /// The value to operate on. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub value: Option>, +} + +/// The release key parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyReleaseParameters { + /// The encryption algorithm to use to protected the exported key material + #[serde(skip_serializing_if = "Option::is_none")] + pub enc: Option, + + /// A client provided nonce for freshness. + #[serde(skip_serializing_if = "Option::is_none")] + pub nonce: Option, + + /// The attestation assertion for the target of the key release. + #[serde(rename = "target", skip_serializing_if = "Option::is_none")] + pub target_attestation_token: Option, +} + +/// The policy rules under which the key can be exported. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyReleasePolicy { + /// Content type and version of key release policy + #[serde(rename = "contentType", skip_serializing_if = "Option::is_none")] + pub content_type: Option, + + /// Blob encoding the policy rules under which the key can be released. Blob must be base64 URL encoded. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "data", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub encoded_policy: Option>, + + /// Defines the mutability state of the policy. Once marked immutable, this flag cannot be reset and the policy cannot be + /// changed under any circumstances. + #[serde(skip_serializing_if = "Option::is_none")] + pub immutable: Option, +} + +/// The release result, containing the released key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyReleaseResult { + /// A signed object containing the released key. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// The key restore parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyRestoreParameters { + /// The backup blob associated with a key bundle. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub key_bundle_backup: Option>, +} + +/// Management policy for a key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyRotationPolicy { + /// The key rotation policy attributes. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option, + + /// The key policy id. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + + /// Actions that will be performed by Key Vault over the lifetime of a key. For preview, lifetimeActions can only have two + /// items at maximum: one for rotate, one for notify. Notification time would be default to 30 days before expiry and it is + /// not configurable. + #[serde(rename = "lifetimeActions", skip_serializing_if = "Option::is_none")] + pub lifetime_actions: Option>, +} + +/// The key rotation policy attributes. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyRotationPolicyAttributes { + /// The key rotation policy created time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub created: Option, + + /// The expiryTime will be applied on the new key version. It should be at least 28 days. It will be in ISO 8601 Format. Examples: + /// 90 days: P90D, 3 months: P3M, 48 hours: PT48H, 1 year and 10 days: P1Y10D + #[serde(rename = "expiryTime", skip_serializing_if = "Option::is_none")] + pub expiry_time: Option, + + /// The key rotation policy's last updated time in UTC. + #[serde( + default, + skip_serializing_if = "Option::is_none", + with = "azure_core::date::unix_time::option" + )] + pub updated: Option, +} + +/// The key operations parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeySignParameters { + /// The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + + /// The value to operate on. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub value: Option>, +} + +/// The key update parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyUpdateParameters { + /// The attributes of a key managed by the key vault service. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub key_attributes: Option, + + /// Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + #[serde(skip_serializing_if = "Option::is_none")] + pub key_ops: Option>, + + /// The policy rules under which the key can be exported. + #[serde(skip_serializing_if = "Option::is_none")] + pub release_policy: Option, + + /// Application specific metadata in the form of key-value pairs. + #[serde(skip_serializing_if = "Option::is_none")] + pub tags: Option>, +} + +/// The key verify parameters. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct KeyVerifyParameters { + /// The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. + #[serde(rename = "alg", skip_serializing_if = "Option::is_none")] + pub algorithm: Option, + + /// The digest used for signing. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub digest: Option>, + + /// The signature to be verified. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + rename = "value", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub signature: Option>, +} + +/// The key verify result. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct KeyVerifyResult { + /// True if the signature is verified, otherwise false. + #[serde(skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +/// Action and its trigger that will be performed by Key Vault over the lifetime of a key. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct LifetimeActions { + /// The action that will be executed. + #[serde(skip_serializing_if = "Option::is_none")] + pub action: Option, + + /// The condition that will execute the action. + #[serde(skip_serializing_if = "Option::is_none")] + pub trigger: Option, +} + +/// A condition to be satisfied for an action to be executed. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct LifetimeActionsTrigger { + /// Time after creation to attempt to rotate. It only applies to rotate. It will be in ISO 8601 duration format. Example: + /// 90 days : "P90D" + #[serde(rename = "timeAfterCreate", skip_serializing_if = "Option::is_none")] + pub time_after_create: Option, + + /// Time before expiry to attempt to rotate or notify. It will be in ISO 8601 duration format. Example: 90 days : "P90D" + #[serde(rename = "timeBeforeExpiry", skip_serializing_if = "Option::is_none")] + pub time_before_expiry: Option, +} + +/// The action that will be executed. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +pub struct LifetimeActionsType { + /// The type of the action. The value should be compared case-insensitively. + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub type_prop: Option, +} + +/// The get random bytes response object containing the bytes. +#[derive(Clone, Default, Deserialize, SafeDebug, Serialize, azure_core::Model)] +#[non_exhaustive] +pub struct RandomBytes { + /// The bytes encoded as a base64url string. + #[serde( + default, + deserialize_with = "base64::deserialize_url_safe", + serialize_with = "base64::serialize_url_safe", + skip_serializing_if = "Option::is_none" + )] + pub value: Option>, +} diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs new file mode 100644 index 0000000000..a97e1c019d --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/generated/models_serde.rs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +use crate::models::{ + GetRandomBytesRequest, KeyCreateParameters, KeyImportParameters, KeyOperationsParameters, + KeyReleaseParameters, KeyRestoreParameters, KeyRotationPolicy, KeySignParameters, + KeyUpdateParameters, KeyVerifyParameters, +}; +use azure_core::{RequestContent, Result}; +use typespec_client_core::json::to_json; + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: GetRandomBytesRequest) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyCreateParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyImportParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyOperationsParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyReleaseParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyRestoreParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyRotationPolicy) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeySignParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyUpdateParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} + +impl TryFrom for RequestContent { + type Error = azure_core::Error; + fn try_from(value: KeyVerifyParameters) -> Result { + RequestContent::try_from(to_json(&value)?) + } +} diff --git a/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs new file mode 100644 index 0000000000..c878598bc9 --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/src/lib.rs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT. + +mod generated; + +pub mod clients { + pub use crate::generated::clients::*; +} + +pub mod models { + pub use crate::generated::enums::*; + pub use crate::generated::models::*; +} + +pub use crate::generated::clients::{ + KeyClient, KeyClientBackupKeyOptions, KeyClientCreateKeyOptions, KeyClientDecryptOptions, + KeyClientDeleteKeyOptions, KeyClientEncryptOptions, KeyClientGetDeletedKeyOptions, + KeyClientGetDeletedKeysOptions, KeyClientGetKeyOptions, KeyClientGetKeyRotationPolicyOptions, + KeyClientGetKeyVersionsOptions, KeyClientGetKeysOptions, KeyClientGetRandomBytesOptions, + KeyClientImportKeyOptions, KeyClientOptions, KeyClientPurgeDeletedKeyOptions, + KeyClientRecoverDeletedKeyOptions, KeyClientReleaseOptions, KeyClientRestoreKeyOptions, + KeyClientRotateKeyOptions, KeyClientSignOptions, KeyClientUnwrapKeyOptions, + KeyClientUpdateKeyOptions, KeyClientUpdateKeyRotationPolicyOptions, KeyClientVerifyOptions, + KeyClientWrapKeyOptions, +}; diff --git a/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml new file mode 100644 index 0000000000..b2d23824fc --- /dev/null +++ b/sdk/keyvault/azure_security_keyvault_keys/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/keyvault/Security.KeyVault.Keys +commit: 96ddfd68b9d2baabe3d3678094ae37bd33d23d4a +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/keyvault/Security.KeyVault.Common/