From d802a145104c63822cd6d5808b422658ef6b5a91 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 9 Mar 2023 19:18:28 +0000 Subject: [PATCH] CodeGen from PR 22625 in Azure/azure-rest-api-specs Merge dfd404bdff081b66fe848a45c07517b2828dcb65 into 3de956a007e6b8629617b8968409311253927947 --- common/config/rush/pnpm-lock.yaml | 27 +- sdk/keyvault/arm-keyvault/CHANGELOG.md | 75 ++- sdk/keyvault/arm-keyvault/LICENSE | 2 +- sdk/keyvault/arm-keyvault/README.md | 2 +- sdk/keyvault/arm-keyvault/_meta.json | 8 +- sdk/keyvault/arm-keyvault/package.json | 23 +- .../arm-keyvault/review/arm-keyvault.api.md | 292 +++++++- .../src/keyVaultManagementClient.ts | 12 +- sdk/keyvault/arm-keyvault/src/lroImpl.ts | 54 +- sdk/keyvault/arm-keyvault/src/models/index.ts | 416 +++++++++++- .../arm-keyvault/src/models/mappers.ts | 633 +++++++++++++++++- .../arm-keyvault/src/models/parameters.ts | 57 +- .../arm-keyvault/src/operations/index.ts | 2 + .../arm-keyvault/src/operations/keys.ts | 6 +- .../src/operations/managedHsmKeys.ts | 525 +++++++++++++++ .../src/operations/managedHsms.ts | 176 +++-- .../mhsmPrivateEndpointConnections.ts | 42 +- .../operations/mhsmPrivateLinkResources.ts | 2 +- .../src/operations/mhsmRegions.ts | 194 ++++++ .../arm-keyvault/src/operations/operations.ts | 1 - .../operations/privateEndpointConnections.ts | 37 +- .../arm-keyvault/src/operations/secrets.ts | 9 +- .../arm-keyvault/src/operations/vaults.ts | 59 +- .../src/operationsInterfaces/index.ts | 2 + .../src/operationsInterfaces/keys.ts | 4 +- .../operationsInterfaces/managedHsmKeys.ts | 103 +++ .../src/operationsInterfaces/managedHsms.ts | 36 +- .../mhsmPrivateEndpointConnections.ts | 6 +- .../src/operationsInterfaces/mhsmRegions.ts | 29 + .../privateEndpointConnections.ts | 6 +- .../src/operationsInterfaces/secrets.ts | 4 +- .../src/operationsInterfaces/vaults.ts | 8 +- sdk/keyvault/arm-keyvault/src/pagingHelper.ts | 8 +- sdk/keyvault/arm-keyvault/test/sampleTest.ts | 43 ++ sdk/keyvault/arm-keyvault/tsconfig.json | 10 +- 35 files changed, 2619 insertions(+), 294 deletions(-) create mode 100644 sdk/keyvault/arm-keyvault/src/operations/managedHsmKeys.ts create mode 100644 sdk/keyvault/arm-keyvault/src/operations/mhsmRegions.ts create mode 100644 sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsmKeys.ts create mode 100644 sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmRegions.ts create mode 100644 sdk/keyvault/arm-keyvault/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6007bdbd61fb..256d55b8d76f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -4030,7 +4030,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230308 + typescript: 5.1.0-dev.20230309 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8961,8 +8961,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230308: - resolution: {integrity: sha512-CSITPpBYNdPYujl36d9VhNNCLE+isuwm/ArFbYgPsWsLniLCcfBl+NcaOkVqyjV0XEjP+uN1yywiglCkEzed1w==} + /typescript/5.1.0-dev.20230309: + resolution: {integrity: sha512-pCqgzbHDsuACtq0v+pjNY6Zf7cdWZstY38Jq7FfD1HqAeEGnFKhrZgSRh7kS/QE5UOctGAqbp1ynTGdVI7s4Mw==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -10052,7 +10052,7 @@ packages: dev: false file:projects/app-configuration.tgz: - resolution: {integrity: sha512-11s7ELWUeURBhvG90Ip9QP+D7uTS5DHZn7dZutSnzjDw4dBouxuHwLTuxXxEWx/SN30pCbc52inHwNVVb6RufA==, tarball: file:projects/app-configuration.tgz} + resolution: {integrity: sha512-CLn6BAgagKUJw0cSu2Ku91Zxkk7GoUYJ4z++Nu0D2QPN7hymevKMong9VGUFrCp9WomQF1+qW7qNzxyOXuWrdA==, tarball: file:projects/app-configuration.tgz} name: '@rush-temp/app-configuration' version: 0.0.0 dependencies: @@ -12763,10 +12763,11 @@ packages: dev: false file:projects/arm-keyvault.tgz: - resolution: {integrity: sha512-YdBoEvpK1VYdKtLIP4EPBALD6QFSzKa1Jy9ukIXzcsLrH0FCeWm2mSlEWSWx1GJ7O1fus2fnMXoN5OXt828+Qg==, tarball: file:projects/arm-keyvault.tgz} + resolution: {integrity: sha512-LRefmhYbS89wKRs2xMtK/SLbXtQip7cILS55I//NvQK1nzNalinRlpnks5jHUAXUQPZoXPIWaN9rrlpaG2QvKA==, tarball: file:projects/arm-keyvault.tgz} name: '@rush-temp/arm-keyvault' version: 0.0.0 dependencies: + '@azure-tools/test-recorder': 2.0.0 '@azure/identity': 2.1.0 '@microsoft/api-extractor': 7.34.4_@types+node@14.18.37 '@rollup/plugin-commonjs': 24.0.1_rollup@2.79.1 @@ -12777,7 +12778,8 @@ packages: '@types/node': 14.18.37 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.5 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 @@ -12786,6 +12788,7 @@ packages: typescript: 4.8.4 uglify-js: 3.17.4 transitivePeerDependencies: + - encoding - supports-color dev: false @@ -17465,7 +17468,7 @@ packages: dev: false file:projects/identity.tgz: - resolution: {integrity: sha512-PNVGSQgrV74ZaOtZm6TtRIFPjkRsml2P7B7UhyT9EiQ0F1WLTv4nvg5VO0o74HN4qK0ZDLXxjg3CNEgxqd5LTg==, tarball: file:projects/identity.tgz} + resolution: {integrity: sha512-D6xmkAXr5zwZ2B2DbCiC9wxYe0i7auXwa/E5SMB7/Amy9mnzJDRuO9dNDdHM6Ib0VjRzZ45rf1eGwBs+eOBjqA==, tarball: file:projects/identity.tgz} name: '@rush-temp/identity' version: 0.0.0 dependencies: @@ -17615,7 +17618,7 @@ packages: dev: false file:projects/keyvault-admin.tgz: - resolution: {integrity: sha512-1aR1s+cEC5T8rkebkJA2gFgWPwR5RVR7qOAyWvslFGqg4Up4bqVNI6q8YhpL/15gPijjjk5RTcUOT22wqfwnJw==, tarball: file:projects/keyvault-admin.tgz} + resolution: {integrity: sha512-s4NxTw0qqENCSJYvtlPyCXPgueoVmiy1iB5nUV6ZZIXDein+SiGbPDe9AqhQaMLIIPYuOIYqNqUZzSkF/UVsow==, tarball: file:projects/keyvault-admin.tgz} name: '@rush-temp/keyvault-admin' version: 0.0.0 dependencies: @@ -17645,7 +17648,7 @@ packages: dev: false file:projects/keyvault-certificates.tgz: - resolution: {integrity: sha512-g8Wgna15TiEQooet1FkrlWzfZDl1cUueV0s3kd3y+g55OuL34cOTY5k0Q7Jc6lpQ8aB629YDfkDw6L7zgFdj7Q==, tarball: file:projects/keyvault-certificates.tgz} + resolution: {integrity: sha512-bAOUuJYxu7UjhLiiTrxlGZh1kv+QqyLkBI1f10AdzZxOsd3bWAqdO/wnFr1WT7irLzYkrx3e1M2yNZsSlZG1yQ==, tarball: file:projects/keyvault-certificates.tgz} name: '@rush-temp/keyvault-certificates' version: 0.0.0 dependencies: @@ -18669,7 +18672,7 @@ packages: dev: false file:projects/perf-keyvault-certificates.tgz: - resolution: {integrity: sha512-VRd1Fnp27eLm8oKYYFQCcXvnz2trIEutUMv6Ii6/DAUdPCzQm5yXJZmEO07bxwXKv1vSdMDZknW62M/nDQ+Dag==, tarball: file:projects/perf-keyvault-certificates.tgz} + resolution: {integrity: sha512-y0b7TFibUwxWIft7IQU79eCCYEEjeDQpLM3naIAbL5kd0OoY4FbGeweB1vbG2vqtmqUQLWQxdFkxzUNsOVjEYw==, tarball: file:projects/perf-keyvault-certificates.tgz} name: '@rush-temp/perf-keyvault-certificates' version: 0.0.0 dependencies: @@ -18692,7 +18695,7 @@ packages: dev: false file:projects/perf-keyvault-keys.tgz: - resolution: {integrity: sha512-ueAWRbfdi9lmOGge9FsNKesnXqDFeZVEzpEx0oTDYZK2vhIKaEvJjlysfzxUe3eyNPIsUsi30wa2jHrOk9g5qQ==, tarball: file:projects/perf-keyvault-keys.tgz} + resolution: {integrity: sha512-hA+SW0QnCcnQtEuOYvyXBVQnbMy373bLX/wVDpzcWqMSipB79qJZqccf4idCdMsdqLyLyNq+rgpYvVrYp5s+hA==, tarball: file:projects/perf-keyvault-keys.tgz} name: '@rush-temp/perf-keyvault-keys' version: 0.0.0 dependencies: @@ -18715,7 +18718,7 @@ packages: dev: false file:projects/perf-keyvault-secrets.tgz: - resolution: {integrity: sha512-uNewvxAIj7J9/amvOLrSo6/ofWG8sbxRz55gPJjJxPSpuk4iYjM+jETM7sE9XW+qI6Jr4gGDqDs9rBpLwHtfnA==, tarball: file:projects/perf-keyvault-secrets.tgz} + resolution: {integrity: sha512-QEpuPQgCBR4qGDKkWOzbCN+z0jOsboUOvPuel0wImAEprlJcsnpzEHrR2MRb9oPy/ZiJDnuJaobp2ysdnUXzUw==, tarball: file:projects/perf-keyvault-secrets.tgz} name: '@rush-temp/perf-keyvault-secrets' version: 0.0.0 dependencies: diff --git a/sdk/keyvault/arm-keyvault/CHANGELOG.md b/sdk/keyvault/arm-keyvault/CHANGELOG.md index b6b19d11ad9a..77a6d422c654 100644 --- a/sdk/keyvault/arm-keyvault/CHANGELOG.md +++ b/sdk/keyvault/arm-keyvault/CHANGELOG.md @@ -1,44 +1,95 @@ # Release History - -## 2.1.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 2.1.0-beta.2 (2022-11-28) + +## 3.0.0 (2023-03-09) **Features** + - Added operation group ManagedHsmKeys + - Added operation group MhsmRegions + - Added operation ManagedHsms.checkMhsmNameAvailability - Added Interface Action + - Added Interface CheckMhsmNameAvailabilityParameters + - Added Interface CheckMhsmNameAvailabilityResult - Added Interface Key - Added Interface KeyReleasePolicy - Added Interface KeyRotationPolicyAttributes - Added Interface LifetimeAction - Added Interface ManagedHsm + - Added Interface ManagedHsmAction + - Added Interface ManagedHsmKey + - Added Interface ManagedHsmKeyAttributes + - Added Interface ManagedHsmKeyCreateParameters + - Added Interface ManagedHsmKeyListResult + - Added Interface ManagedHsmKeyProperties + - Added Interface ManagedHsmKeyReleasePolicy + - Added Interface ManagedHsmKeyRotationPolicyAttributes + - Added Interface ManagedHsmKeysCreateIfNotExistOptionalParams + - Added Interface ManagedHsmKeysGetOptionalParams + - Added Interface ManagedHsmKeysGetVersionOptionalParams + - Added Interface ManagedHsmKeysListNextOptionalParams + - Added Interface ManagedHsmKeysListOptionalParams + - Added Interface ManagedHsmKeysListVersionsNextOptionalParams + - Added Interface ManagedHsmKeysListVersionsOptionalParams + - Added Interface ManagedHsmLifetimeAction + - Added Interface ManagedHsmRotationPolicy + - Added Interface ManagedHsmsCheckMhsmNameAvailabilityOptionalParams + - Added Interface ManagedHsmsCreateOrUpdateHeaders + - Added Interface ManagedHsmsDeleteHeaders + - Added Interface ManagedHSMSecurityDomainProperties + - Added Interface ManagedHsmsPurgeDeletedHeaders - Added Interface ManagedHsmsUpdateHeaders + - Added Interface ManagedHsmTrigger + - Added Interface MhsmGeoReplicatedRegion - Added Interface MhsmPrivateEndpointConnection - Added Interface MhsmPrivateLinkResource + - Added Interface MhsmRegionsListByResourceNextOptionalParams + - Added Interface MhsmRegionsListByResourceOptionalParams + - Added Interface MhsmRegionsListResult - Added Interface PrivateEndpointConnection - Added Interface PrivateLinkResource + - Added Interface ProxyResourceWithoutSystemData - Added Interface RotationPolicy - Added Interface Secret - Added Interface SecretAttributes - Added Interface Trigger + - Added Type Alias ActivationStatus + - Added Type Alias GeoReplicationRegionProvisioningState - Added Type Alias KeyRotationPolicyActionType + - Added Type Alias ManagedHsmKeysCreateIfNotExistResponse + - Added Type Alias ManagedHsmKeysGetResponse + - Added Type Alias ManagedHsmKeysGetVersionResponse + - Added Type Alias ManagedHsmKeysListNextResponse + - Added Type Alias ManagedHsmKeysListResponse + - Added Type Alias ManagedHsmKeysListVersionsNextResponse + - Added Type Alias ManagedHsmKeysListVersionsResponse + - Added Type Alias ManagedHsmsCheckMhsmNameAvailabilityResponse + - Added Type Alias ManagedHsmsPurgeDeletedResponse + - Added Type Alias MhsmRegionsListByResourceNextResponse + - Added Type Alias MhsmRegionsListByResourceResponse - Interface KeyProperties has a new optional parameter releasePolicy - Interface KeyProperties has a new optional parameter rotationPolicy + - Interface ManagedHsmProperties has a new optional parameter regions + - Interface ManagedHsmProperties has a new optional parameter securityDomainProperties - Interface MhsmPrivateEndpointConnectionItem has a new optional parameter etag - Interface MhsmPrivateEndpointConnectionItem has a new optional parameter id + - Added Enum KnownActivationStatus + - Added Enum KnownGeoReplicationRegionProvisioningState - Enum KnownJsonWebKeyOperation has a new value Release - Enum KnownKeyPermissions has a new value Getrotationpolicy - Enum KnownKeyPermissions has a new value Release - Enum KnownKeyPermissions has a new value Rotate - Enum KnownKeyPermissions has a new value Setrotationpolicy + - Added function getContinuationToken + +**Breaking Changes** + + - Interface ManagedHsmsListByResourceGroupNextOptionalParams no longer has parameter top + - Interface ManagedHsmsListBySubscriptionNextOptionalParams no longer has parameter top + - Interface MhsmPrivateEndpointConnectionsDeleteHeaders no longer has parameter retryAfter + - Interface SecretsListNextOptionalParams no longer has parameter top + - Interface VaultsListByResourceGroupNextOptionalParams no longer has parameter top + - Interface VaultsListBySubscriptionNextOptionalParams no longer has parameter top + - Interface VaultsListNextOptionalParams no longer has parameter top ## 2.0.0 (2022-01-17) diff --git a/sdk/keyvault/arm-keyvault/LICENSE b/sdk/keyvault/arm-keyvault/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/keyvault/arm-keyvault/LICENSE +++ b/sdk/keyvault/arm-keyvault/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/keyvault/arm-keyvault/README.md b/sdk/keyvault/arm-keyvault/README.md index 78324c43b8ce..f582b32c1190 100644 --- a/sdk/keyvault/arm-keyvault/README.md +++ b/sdk/keyvault/arm-keyvault/README.md @@ -6,7 +6,7 @@ The Azure management API provides a RESTful set of web services that interact wi [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/arm-keyvault) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-keyvault) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-keyvault?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-keyvault) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/keyvault/arm-keyvault/_meta.json b/sdk/keyvault/arm-keyvault/_meta.json index 181c4273f370..010ac1a96a0b 100644 --- a/sdk/keyvault/arm-keyvault/_meta.json +++ b/sdk/keyvault/arm-keyvault/_meta.json @@ -1,8 +1,8 @@ { - "commit": "1fefe3f5cee88319b17c08a2dbf95e1e983a9f8c", + "commit": "97c2860af23a56743959311d6d86193c6779ded7", "readme": "specification/keyvault/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\keyvault\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/keyvault/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.9", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.3.20221108.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.0-rc.9" } \ No newline at end of file diff --git a/sdk/keyvault/arm-keyvault/package.json b/sdk/keyvault/arm-keyvault/package.json index a0a1ac7d3d04..d865e11dc1d9 100644 --- a/sdk/keyvault/arm-keyvault/package.json +++ b/sdk/keyvault/arm-keyvault/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for KeyVaultManagementClient.", - "version": "2.1.0-beta.3", + "version": "3.0.0", "engines": { "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,14 +33,15 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~4.8.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-recorder": "^2.0.0", "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", "@types/chai": "^4.2.8", @@ -49,7 +50,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/arm-keyvault", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,12 +111,5 @@ ] }, "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-keyvault?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/arm-keyvault" +} \ No newline at end of file diff --git a/sdk/keyvault/arm-keyvault/review/arm-keyvault.api.md b/sdk/keyvault/arm-keyvault/review/arm-keyvault.api.md index 92386afbe3c1..733eed42bd11 100644 --- a/sdk/keyvault/arm-keyvault/review/arm-keyvault.api.md +++ b/sdk/keyvault/arm-keyvault/review/arm-keyvault.api.md @@ -6,9 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface AccessPolicyEntry { @@ -29,6 +29,9 @@ export interface Action { // @public export type ActionsRequired = string; +// @public +export type ActivationStatus = string; + // @public export interface Attributes { readonly created?: Date; @@ -41,6 +44,18 @@ export interface Attributes { // @public export type CertificatePermissions = string; +// @public +export interface CheckMhsmNameAvailabilityParameters { + name: string; +} + +// @public +export interface CheckMhsmNameAvailabilityResult { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: Reason; +} + // @public export interface CheckNameAvailabilityResult { readonly message?: string; @@ -131,6 +146,9 @@ export interface ErrorModel { readonly message?: string; } +// @public +export type GeoReplicationRegionProvisioningState = string; + // @public export function getContinuationToken(page: unknown): string | undefined; @@ -291,12 +309,16 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient { // (undocumented) keys: Keys; // (undocumented) + managedHsmKeys: ManagedHsmKeys; + // (undocumented) managedHsms: ManagedHsms; // (undocumented) mhsmPrivateEndpointConnections: MhsmPrivateEndpointConnections; // (undocumented) mhsmPrivateLinkResources: MhsmPrivateLinkResources; // (undocumented) + mhsmRegions: MhsmRegions; + // (undocumented) operations: Operations; // (undocumented) privateEndpointConnections: PrivateEndpointConnections; @@ -322,6 +344,14 @@ export enum KnownActionsRequired { None = "None" } +// @public +export enum KnownActivationStatus { + Active = "Active", + Failed = "Failed", + NotActivated = "NotActivated", + Unknown = "Unknown" +} + // @public export enum KnownCertificatePermissions { All = "all", @@ -351,6 +381,16 @@ export enum KnownDeletionRecoveryLevel { RecoverablePurgeable = "Recoverable+Purgeable" } +// @public +export enum KnownGeoReplicationRegionProvisioningState { + Cleanup = "Cleanup", + Deleting = "Deleting", + Failed = "Failed", + Preprovisioning = "Preprovisioning", + Provisioning = "Provisioning", + Succeeded = "Succeeded" +} + // @public export enum KnownIdentityType { Application = "Application", @@ -528,11 +568,146 @@ export interface ManagedHsm extends ManagedHsmResource { properties?: ManagedHsmProperties; } +// @public (undocumented) +export interface ManagedHsmAction { + type?: KeyRotationPolicyActionType; +} + // @public export interface ManagedHsmError { readonly error?: ErrorModel; } +// @public +export interface ManagedHsmKey extends ProxyResourceWithoutSystemData { + attributes?: ManagedHsmKeyAttributes; + curveName?: JsonWebKeyCurveName; + // (undocumented) + keyOps?: JsonWebKeyOperation[]; + keySize?: number; + readonly keyUri?: string; + readonly keyUriWithVersion?: string; + kty?: JsonWebKeyType; + releasePolicy?: ManagedHsmKeyReleasePolicy; + rotationPolicy?: ManagedHsmRotationPolicy; +} + +// @public +export interface ManagedHsmKeyAttributes { + readonly created?: number; + enabled?: boolean; + expires?: number; + exportable?: boolean; + notBefore?: number; + readonly recoveryLevel?: DeletionRecoveryLevel; + readonly updated?: number; +} + +// @public +export interface ManagedHsmKeyCreateParameters { + properties: ManagedHsmKeyProperties; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface ManagedHsmKeyListResult { + nextLink?: string; + value?: ManagedHsmKey[]; +} + +// @public +export interface ManagedHsmKeyProperties { + attributes?: ManagedHsmKeyAttributes; + curveName?: JsonWebKeyCurveName; + // (undocumented) + keyOps?: JsonWebKeyOperation[]; + keySize?: number; + readonly keyUri?: string; + readonly keyUriWithVersion?: string; + kty?: JsonWebKeyType; + releasePolicy?: ManagedHsmKeyReleasePolicy; + rotationPolicy?: ManagedHsmRotationPolicy; +} + +// @public (undocumented) +export interface ManagedHsmKeyReleasePolicy { + contentType?: string; + data?: Uint8Array; +} + +// @public (undocumented) +export interface ManagedHsmKeyRotationPolicyAttributes { + readonly created?: number; + expiryTime?: string; + readonly updated?: number; +} + +// @public +export interface ManagedHsmKeys { + createIfNotExist(resourceGroupName: string, name: string, keyName: string, parameters: ManagedHsmKeyCreateParameters, options?: ManagedHsmKeysCreateIfNotExistOptionalParams): Promise; + get(resourceGroupName: string, name: string, keyName: string, options?: ManagedHsmKeysGetOptionalParams): Promise; + getVersion(resourceGroupName: string, name: string, keyName: string, keyVersion: string, options?: ManagedHsmKeysGetVersionOptionalParams): Promise; + list(resourceGroupName: string, name: string, options?: ManagedHsmKeysListOptionalParams): PagedAsyncIterableIterator; + listVersions(resourceGroupName: string, name: string, keyName: string, options?: ManagedHsmKeysListVersionsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ManagedHsmKeysCreateIfNotExistOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysCreateIfNotExistResponse = ManagedHsmKey; + +// @public +export interface ManagedHsmKeysGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysGetResponse = ManagedHsmKey; + +// @public +export interface ManagedHsmKeysGetVersionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysGetVersionResponse = ManagedHsmKey; + +// @public +export interface ManagedHsmKeysListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysListNextResponse = ManagedHsmKeyListResult; + +// @public +export interface ManagedHsmKeysListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysListResponse = ManagedHsmKeyListResult; + +// @public +export interface ManagedHsmKeysListVersionsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysListVersionsNextResponse = ManagedHsmKeyListResult; + +// @public +export interface ManagedHsmKeysListVersionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmKeysListVersionsResponse = ManagedHsmKeyListResult; + +// @public (undocumented) +export interface ManagedHsmLifetimeAction { + action?: ManagedHsmAction; + trigger?: ManagedHsmTrigger; +} + // @public export interface ManagedHsmListResult { nextLink?: string; @@ -550,7 +725,9 @@ export interface ManagedHsmProperties { readonly privateEndpointConnections?: MhsmPrivateEndpointConnectionItem[]; readonly provisioningState?: ProvisioningState; publicNetworkAccess?: PublicNetworkAccess; + regions?: MhsmGeoReplicatedRegion[]; readonly scheduledPurgeDate?: Date; + readonly securityDomainProperties?: ManagedHSMSecurityDomainProperties; softDeleteRetentionInDays?: number; readonly statusMessage?: string; tenantId?: string; @@ -569,16 +746,23 @@ export interface ManagedHsmResource { readonly type?: string; } +// @public (undocumented) +export interface ManagedHsmRotationPolicy { + attributes?: ManagedHsmKeyRotationPolicyAttributes; + lifetimeActions?: ManagedHsmLifetimeAction[]; +} + // @public export interface ManagedHsms { - beginCreateOrUpdate(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams): Promise, ManagedHsmsCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams): Promise, ManagedHsmsCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams): Promise; - beginPurgeDeleted(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise, void>>; - beginPurgeDeletedAndWait(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise; - beginUpdate(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams): Promise, ManagedHsmsUpdateResponse>>; + beginPurgeDeleted(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise, ManagedHsmsPurgeDeletedResponse>>; + beginPurgeDeletedAndWait(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise; + beginUpdate(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams): Promise, ManagedHsmsUpdateResponse>>; beginUpdateAndWait(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams): Promise; + checkMhsmNameAvailability(mhsmName: CheckMhsmNameAvailabilityParameters, options?: ManagedHsmsCheckMhsmNameAvailabilityOptionalParams): Promise; get(resourceGroupName: string, name: string, options?: ManagedHsmsGetOptionalParams): Promise; getDeleted(name: string, location: string, options?: ManagedHsmsGetDeletedOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: ManagedHsmsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; @@ -586,6 +770,18 @@ export interface ManagedHsms { listDeleted(options?: ManagedHsmsListDeletedOptionalParams): PagedAsyncIterableIterator; } +// @public +export interface ManagedHsmsCheckMhsmNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedHsmsCheckMhsmNameAvailabilityResponse = CheckMhsmNameAvailabilityResult; + +// @public +export interface ManagedHsmsCreateOrUpdateHeaders { + location?: string; +} + // @public export interface ManagedHsmsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -595,12 +791,23 @@ export interface ManagedHsmsCreateOrUpdateOptionalParams extends coreClient.Oper // @public export type ManagedHsmsCreateOrUpdateResponse = ManagedHsm; +// @public +export interface ManagedHsmsDeleteHeaders { + location?: string; +} + // @public export interface ManagedHsmsDeleteOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; updateIntervalInMs?: number; } +// @public +export interface ManagedHSMSecurityDomainProperties { + readonly activationStatus?: ActivationStatus; + readonly activationStatusMessage?: string; +} + // @public export interface ManagedHsmsGetDeletedOptionalParams extends coreClient.OperationOptions { } @@ -629,7 +836,6 @@ export type ManagedHsmSkuName = "Standard_B1" | "Custom_B32"; // @public export interface ManagedHsmsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -645,7 +851,6 @@ export type ManagedHsmsListByResourceGroupResponse = ManagedHsmListResult; // @public export interface ManagedHsmsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -673,12 +878,20 @@ export interface ManagedHsmsListDeletedOptionalParams extends coreClient.Operati // @public export type ManagedHsmsListDeletedResponse = DeletedManagedHsmListResult; +// @public +export interface ManagedHsmsPurgeDeletedHeaders { + location?: string; +} + // @public export interface ManagedHsmsPurgeDeletedOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; updateIntervalInMs?: number; } +// @public +export type ManagedHsmsPurgeDeletedResponse = ManagedHsmsPurgeDeletedHeaders; + // @public export interface ManagedHsmsUpdateHeaders { location?: string; @@ -693,6 +906,12 @@ export interface ManagedHsmsUpdateOptionalParams extends coreClient.OperationOpt // @public export type ManagedHsmsUpdateResponse = ManagedHsm; +// @public (undocumented) +export interface ManagedHsmTrigger { + timeAfterCreate?: string; + timeBeforeExpiry?: string; +} + // @public export interface MetricSpecification { aggregationType?: string; @@ -708,6 +927,13 @@ export interface MetricSpecification { unit?: string; } +// @public +export interface MhsmGeoReplicatedRegion { + isPrimary?: boolean; + name?: string; + readonly provisioningState?: GeoReplicationRegionProvisioningState; +} + // @public export interface MhsmipRule { value: string; @@ -745,7 +971,7 @@ export interface MhsmPrivateEndpointConnectionItem { // @public export interface MhsmPrivateEndpointConnections { - beginDelete(resourceGroupName: string, name: string, privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsDeleteOptionalParams): Promise, MhsmPrivateEndpointConnectionsDeleteResponse>>; + beginDelete(resourceGroupName: string, name: string, privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsDeleteOptionalParams): Promise, MhsmPrivateEndpointConnectionsDeleteResponse>>; beginDeleteAndWait(resourceGroupName: string, name: string, privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsDeleteOptionalParams): Promise; get(resourceGroupName: string, name: string, privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsGetOptionalParams): Promise; listByResource(resourceGroupName: string, name: string, options?: MhsmPrivateEndpointConnectionsListByResourceOptionalParams): PagedAsyncIterableIterator; @@ -755,7 +981,6 @@ export interface MhsmPrivateEndpointConnections { // @public export interface MhsmPrivateEndpointConnectionsDeleteHeaders { location?: string; - retryAfter?: number; } // @public @@ -838,6 +1063,31 @@ export interface MhsmPrivateLinkServiceConnectionState { status?: PrivateEndpointServiceConnectionStatus; } +// @public +export interface MhsmRegions { + listByResource(resourceGroupName: string, name: string, options?: MhsmRegionsListByResourceOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MhsmRegionsListByResourceNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MhsmRegionsListByResourceNextResponse = MhsmRegionsListResult; + +// @public +export interface MhsmRegionsListByResourceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MhsmRegionsListByResourceResponse = MhsmRegionsListResult; + +// @public +export interface MhsmRegionsListResult { + nextLink?: string; + value?: MhsmGeoReplicatedRegion[]; +} + // @public export interface MhsmVirtualNetworkRule { id: string; @@ -941,7 +1191,7 @@ export type PrivateEndpointConnectionProvisioningState = string; // @public export interface PrivateEndpointConnections { - beginDelete(resourceGroupName: string, vaultName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; + beginDelete(resourceGroupName: string, vaultName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, PrivateEndpointConnectionsDeleteResponse>>; beginDeleteAndWait(resourceGroupName: string, vaultName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; get(resourceGroupName: string, vaultName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; listByResource(resourceGroupName: string, vaultName: string, options?: PrivateEndpointConnectionsListByResourceOptionalParams): PagedAsyncIterableIterator; @@ -1034,6 +1284,16 @@ export interface PrivateLinkServiceConnectionState { // @public export type ProvisioningState = string; +// @public +export interface ProxyResourceWithoutSystemData { + readonly id?: string; + readonly name?: string; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + // @public export type PublicNetworkAccess = string; @@ -1137,7 +1397,6 @@ export type SecretsGetResponse = Secret; // @public export interface SecretsListNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -1294,9 +1553,9 @@ export type VaultProvisioningState = string; // @public export interface Vaults { - beginCreateOrUpdate(resourceGroupName: string, vaultName: string, parameters: VaultCreateOrUpdateParameters, options?: VaultsCreateOrUpdateOptionalParams): Promise, VaultsCreateOrUpdateResponse>>; + beginCreateOrUpdate(resourceGroupName: string, vaultName: string, parameters: VaultCreateOrUpdateParameters, options?: VaultsCreateOrUpdateOptionalParams): Promise, VaultsCreateOrUpdateResponse>>; beginCreateOrUpdateAndWait(resourceGroupName: string, vaultName: string, parameters: VaultCreateOrUpdateParameters, options?: VaultsCreateOrUpdateOptionalParams): Promise; - beginPurgeDeleted(vaultName: string, location: string, options?: VaultsPurgeDeletedOptionalParams): Promise, void>>; + beginPurgeDeleted(vaultName: string, location: string, options?: VaultsPurgeDeletedOptionalParams): Promise, void>>; beginPurgeDeletedAndWait(vaultName: string, location: string, options?: VaultsPurgeDeletedOptionalParams): Promise; checkNameAvailability(vaultName: VaultCheckNameAvailabilityParameters, options?: VaultsCheckNameAvailabilityOptionalParams): Promise; delete(resourceGroupName: string, vaultName: string, options?: VaultsDeleteOptionalParams): Promise; @@ -1346,7 +1605,6 @@ export type VaultsGetResponse = Vault; // @public export interface VaultsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -1362,7 +1620,6 @@ export type VaultsListByResourceGroupResponse = VaultListResult; // @public export interface VaultsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -1392,7 +1649,6 @@ export type VaultsListDeletedResponse = DeletedVaultListResult; // @public export interface VaultsListNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public diff --git a/sdk/keyvault/arm-keyvault/src/keyVaultManagementClient.ts b/sdk/keyvault/arm-keyvault/src/keyVaultManagementClient.ts index 27bbe563e0a3..a7a5c4ba392c 100644 --- a/sdk/keyvault/arm-keyvault/src/keyVaultManagementClient.ts +++ b/sdk/keyvault/arm-keyvault/src/keyVaultManagementClient.ts @@ -16,23 +16,27 @@ import { import * as coreAuth from "@azure/core-auth"; import { KeysImpl, + ManagedHsmKeysImpl, VaultsImpl, PrivateEndpointConnectionsImpl, PrivateLinkResourcesImpl, ManagedHsmsImpl, MhsmPrivateEndpointConnectionsImpl, MhsmPrivateLinkResourcesImpl, + MhsmRegionsImpl, OperationsImpl, SecretsImpl } from "./operations"; import { Keys, + ManagedHsmKeys, Vaults, PrivateEndpointConnections, PrivateLinkResources, ManagedHsms, MhsmPrivateEndpointConnections, MhsmPrivateLinkResources, + MhsmRegions, Operations, Secrets } from "./operationsInterfaces"; @@ -71,7 +75,7 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-keyvault/2.1.0-beta.3`; + const packageDetails = `azsdk-js-arm-keyvault/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -124,8 +128,9 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-11-01-preview"; + this.apiVersion = options.apiVersion || "2023-02-01"; this.keys = new KeysImpl(this); + this.managedHsmKeys = new ManagedHsmKeysImpl(this); this.vaults = new VaultsImpl(this); this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); this.privateLinkResources = new PrivateLinkResourcesImpl(this); @@ -134,6 +139,7 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient { this ); this.mhsmPrivateLinkResources = new MhsmPrivateLinkResourcesImpl(this); + this.mhsmRegions = new MhsmRegionsImpl(this); this.operations = new OperationsImpl(this); this.secrets = new SecretsImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); @@ -168,12 +174,14 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient { } keys: Keys; + managedHsmKeys: ManagedHsmKeys; vaults: Vaults; privateEndpointConnections: PrivateEndpointConnections; privateLinkResources: PrivateLinkResources; managedHsms: ManagedHsms; mhsmPrivateEndpointConnections: MhsmPrivateEndpointConnections; mhsmPrivateLinkResources: MhsmPrivateLinkResources; + mhsmRegions: MhsmRegions; operations: Operations; secrets: Secrets; } diff --git a/sdk/keyvault/arm-keyvault/src/lroImpl.ts b/sdk/keyvault/arm-keyvault/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/keyvault/arm-keyvault/src/lroImpl.ts +++ b/sdk/keyvault/arm-keyvault/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; import { LongRunningOperation, LroResponse } from "@azure/core-lro"; -export class LroImpl implements LongRunningOperation { - constructor( - private sendOperationFn: (args: any, spec: any) => Promise>, - private args: Record, - private spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record, - public requestPath: string = spec.path!, - public requestMethod: string = spec.httpMethod - ) {} - public async sendInitialRequest(): Promise> { - return this.sendOperationFn(this.args, this.spec); - } - public async sendPollRequest(path: string): Promise> { - const { requestBody, ...restSpec } = this.spec; - return this.sendOperationFn(this.args, { - ...restSpec, - path, - httpMethod: "GET" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/keyvault/arm-keyvault/src/models/index.ts b/sdk/keyvault/arm-keyvault/src/models/index.ts index ace70e9079e7..d68099bfe8ce 100644 --- a/sdk/keyvault/arm-keyvault/src/models/index.ts +++ b/sdk/keyvault/arm-keyvault/src/models/index.ts @@ -169,6 +169,145 @@ export interface KeyListResult { nextLink?: string; } +/** The parameters used to create a key. */ +export interface ManagedHsmKeyCreateParameters { + /** The tags that will be assigned to the key. */ + tags?: { [propertyName: string]: string }; + /** The properties of the key to be created. */ + properties: ManagedHsmKeyProperties; +} + +/** The properties of the key. */ +export interface ManagedHsmKeyProperties { + /** The attributes of the key. */ + attributes?: ManagedHsmKeyAttributes; + /** The type of the key. For valid values, see JsonWebKeyType. */ + kty?: JsonWebKeyType; + keyOps?: JsonWebKeyOperation[]; + /** The key size in bits. For example: 2048, 3072, or 4096 for RSA. */ + keySize?: number; + /** The elliptic curve name. For valid values, see JsonWebKeyCurveName. */ + curveName?: JsonWebKeyCurveName; + /** + * The URI to retrieve the current version of the key. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly keyUri?: string; + /** + * The URI to retrieve the specific version of the key. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly keyUriWithVersion?: string; + /** Key rotation policy in response. It will be used for both output and input. Omitted if empty */ + rotationPolicy?: ManagedHsmRotationPolicy; + /** Key release policy in response. It will be used for both output and input. Omitted if empty */ + releasePolicy?: ManagedHsmKeyReleasePolicy; +} + +/** The object attributes managed by the Azure Key Vault service. */ +export interface ManagedHsmKeyAttributes { + /** Determines whether or not the object is enabled. */ + enabled?: boolean; + /** Not before date in seconds since 1970-01-01T00:00:00Z. */ + notBefore?: number; + /** Expiry date in seconds since 1970-01-01T00:00:00Z. */ + expires?: number; + /** + * Creation time in seconds since 1970-01-01T00:00:00Z. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly created?: number; + /** + * Last updated time in seconds since 1970-01-01T00:00:00Z. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly updated?: number; + /** + * The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recoveryLevel?: DeletionRecoveryLevel; + /** Indicates if the private key can be exported. */ + exportable?: boolean; +} + +export interface ManagedHsmRotationPolicy { + /** The attributes of key rotation policy. */ + attributes?: ManagedHsmKeyRotationPolicyAttributes; + /** The lifetimeActions for key rotation action. */ + lifetimeActions?: ManagedHsmLifetimeAction[]; +} + +export interface ManagedHsmKeyRotationPolicyAttributes { + /** + * Creation time in seconds since 1970-01-01T00:00:00Z. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly created?: number; + /** + * Last updated time in seconds since 1970-01-01T00:00:00Z. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly updated?: number; + /** The expiration time for the new key version. It should be in ISO8601 format. Eg: 'P90D', 'P1Y'. */ + expiryTime?: string; +} + +export interface ManagedHsmLifetimeAction { + /** The trigger of key rotation policy lifetimeAction. */ + trigger?: ManagedHsmTrigger; + /** The action of key rotation policy lifetimeAction. */ + action?: ManagedHsmAction; +} + +export interface ManagedHsmTrigger { + /** The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. */ + timeAfterCreate?: string; + /** The time duration before key expiring to rotate or notify. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. */ + timeBeforeExpiry?: string; +} + +export interface ManagedHsmAction { + /** The type of action. */ + type?: KeyRotationPolicyActionType; +} + +export interface ManagedHsmKeyReleasePolicy { + /** Content type and version of key release policy */ + contentType?: string; + /** Blob encoding the policy rules under which the key can be released. */ + data?: Uint8Array; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface ProxyResourceWithoutSystemData { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The page of keys. */ +export interface ManagedHsmKeyListResult { + /** The key resources. */ + value?: ManagedHsmKey[]; + /** The URL to get the next page of keys. */ + nextLink?: string; +} + /** Parameters for creating or updating a vault */ export interface VaultCreateOrUpdateParameters { /** The supported Azure location where the key vault should be created. */ @@ -204,7 +343,7 @@ export interface VaultProperties { enableSoftDelete?: boolean; /** softDelete data retention days. It accepts >=7 and <=90. */ softDeleteRetentionInDays?: number; - /** Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. */ + /** Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the vault is created with the default value of false. Note that management actions are always authorized with RBAC. */ enableRbacAuthorization?: boolean; /** The vault's create mode to indicate whether the vault need to be recovered or not. */ createMode?: CreateMode; @@ -384,7 +523,7 @@ export interface VaultPatchProperties { enabledForTemplateDeployment?: boolean; /** Property to specify whether the 'soft delete' functionality is enabled for this key vault. Once set to true, it cannot be reverted to false. */ enableSoftDelete?: boolean; - /** Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored (warning: this is a preview feature). When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. */ + /** Property that controls how data actions are authorized. When true, the key vault will use Role Based Access Control (RBAC) for authorization of data actions, and the access policies specified in vault properties will be ignored. When false, the key vault will use the access policies specified in vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or not specified, the value of this property will not change. */ enableRbacAuthorization?: boolean; /** softDelete data retention days. It accepts >=7 and <=90. */ softDeleteRetentionInDays?: number; @@ -581,6 +720,8 @@ export interface ManagedHsmProperties { readonly provisioningState?: ProvisioningState; /** Rules governing the accessibility of the key vault from specific network locations. */ networkAcls?: MhsmNetworkRuleSet; + /** List of all regions associated with the managed hsm pool. */ + regions?: MhsmGeoReplicatedRegion[]; /** * List of private endpoint connections associated with the managed hsm pool. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -593,6 +734,11 @@ export interface ManagedHsmProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly scheduledPurgeDate?: Date; + /** + * Managed HSM security domain properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly securityDomainProperties?: ManagedHSMSecurityDomainProperties; } /** A set of rules governing the network accessibility of a managed hsm pool. */ @@ -607,7 +753,7 @@ export interface MhsmNetworkRuleSet { virtualNetworkRules?: MhsmVirtualNetworkRule[]; } -/** A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. */ +/** A rule governing the accessibility of a managed HSM pool from a specific IP address or IP range. */ export interface MhsmipRule { /** An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). */ value: string; @@ -619,6 +765,19 @@ export interface MhsmVirtualNetworkRule { id: string; } +/** A region that this managed HSM Pool has been extended to. */ +export interface MhsmGeoReplicatedRegion { + /** Name of the geo replicated region. */ + name?: string; + /** + * Provisioning state of the geo replicated region. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: GeoReplicationRegionProvisioningState; + /** A boolean value that indicates whether the region is the primary region or a secondary region. */ + isPrimary?: boolean; +} + /** Private endpoint connection item. */ export interface MhsmPrivateEndpointConnectionItem { /** Id of private endpoint connection. */ @@ -652,6 +811,20 @@ export interface MhsmPrivateLinkServiceConnectionState { actionsRequired?: ActionsRequired; } +/** The security domain properties of the managed hsm. */ +export interface ManagedHSMSecurityDomainProperties { + /** + * Activation Status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly activationStatus?: ActivationStatus; + /** + * Activation Status Message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly activationStatusMessage?: string; +} + /** Managed HSM resource */ export interface ManagedHsmResource { /** @@ -802,6 +975,39 @@ export interface MhsmPrivateLinkResourceListResult { value?: MhsmPrivateLinkResource[]; } +/** List of regions associated with a managed HSM Pools */ +export interface MhsmRegionsListResult { + /** The region associated with a managed HSM Pools. */ + value?: MhsmGeoReplicatedRegion[]; + /** The URL to get the next set of managed HSM Pools. */ + nextLink?: string; +} + +/** The parameters used to check the availability of the managed hsm name. */ +export interface CheckMhsmNameAvailabilityParameters { + /** The managed hsm name. */ + name: string; +} + +/** The CheckMhsmNameAvailability operation response. */ +export interface CheckMhsmNameAvailabilityResult { + /** + * A boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nameAvailable?: boolean; + /** + * The reason that a managed hsm name could not be used. The reason element is only returned if NameAvailable is false. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reason?: Reason; + /** + * An error message explaining the Reason value in more detail. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + /** Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. */ export interface OperationListResult { /** List of Storage operations supported by the Storage resource provider. */ @@ -1025,6 +1231,33 @@ export interface Secret extends Resource { properties: SecretProperties; } +/** The key resource. */ +export interface ManagedHsmKey extends ProxyResourceWithoutSystemData { + /** The attributes of the key. */ + attributes?: ManagedHsmKeyAttributes; + /** The type of the key. For valid values, see JsonWebKeyType. */ + kty?: JsonWebKeyType; + keyOps?: JsonWebKeyOperation[]; + /** The key size in bits. For example: 2048, 3072, or 4096 for RSA. */ + keySize?: number; + /** The elliptic curve name. For valid values, see JsonWebKeyCurveName. */ + curveName?: JsonWebKeyCurveName; + /** + * The URI to retrieve the current version of the key. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly keyUri?: string; + /** + * The URI to retrieve the specific version of the key. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly keyUriWithVersion?: string; + /** Key rotation policy in response. It will be used for both output and input. Omitted if empty */ + rotationPolicy?: ManagedHsmRotationPolicy; + /** Key release policy in response. It will be used for both output and input. Omitted if empty */ + releasePolicy?: ManagedHsmKeyReleasePolicy; +} + /** Resource information with extended details. */ export interface ManagedHsm extends ManagedHsmResource { /** Properties of the managed HSM */ @@ -1078,12 +1311,30 @@ export interface PrivateEndpointConnectionsDeleteHeaders { location?: string; } +/** Defines headers for ManagedHsms_createOrUpdate operation. */ +export interface ManagedHsmsCreateOrUpdateHeaders { + /** The URI to poll for completion status. */ + location?: string; +} + /** Defines headers for ManagedHsms_update operation. */ export interface ManagedHsmsUpdateHeaders { /** The URI to poll for completion status. */ location?: string; } +/** Defines headers for ManagedHsms_delete operation. */ +export interface ManagedHsmsDeleteHeaders { + /** The URI to poll for completion status. */ + location?: string; +} + +/** Defines headers for ManagedHsms_purgeDeleted operation. */ +export interface ManagedHsmsPurgeDeletedHeaders { + /** The URI to poll for completion status. */ + location?: string; +} + /** Defines headers for MhsmPrivateEndpointConnections_put operation. */ export interface MhsmPrivateEndpointConnectionsPutHeaders { /** (specified only if operation does not finish synchronously) The recommended number of seconds to wait before calling the URI specified in Azure-AsyncOperation. */ @@ -1094,8 +1345,6 @@ export interface MhsmPrivateEndpointConnectionsPutHeaders { /** Defines headers for MhsmPrivateEndpointConnections_delete operation. */ export interface MhsmPrivateEndpointConnectionsDeleteHeaders { - /** The recommended number of seconds to wait before calling the URI specified in the location header. */ - retryAfter?: number; /** The URI to poll for completion status. */ location?: string; } @@ -1640,6 +1889,36 @@ export enum KnownProvisioningState { */ export type ProvisioningState = string; +/** Known values of {@link GeoReplicationRegionProvisioningState} that the service accepts. */ +export enum KnownGeoReplicationRegionProvisioningState { + /** Preprovisioning */ + Preprovisioning = "Preprovisioning", + /** Provisioning */ + Provisioning = "Provisioning", + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Deleting */ + Deleting = "Deleting", + /** Cleanup */ + Cleanup = "Cleanup" +} + +/** + * Defines values for GeoReplicationRegionProvisioningState. \ + * {@link KnownGeoReplicationRegionProvisioningState} can be used interchangeably with GeoReplicationRegionProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Preprovisioning** \ + * **Provisioning** \ + * **Succeeded** \ + * **Failed** \ + * **Deleting** \ + * **Cleanup** + */ +export type GeoReplicationRegionProvisioningState = string; + /** Known values of {@link PublicNetworkAccess} that the service accepts. */ export enum KnownPublicNetworkAccess { /** Enabled */ @@ -1658,6 +1937,30 @@ export enum KnownPublicNetworkAccess { */ export type PublicNetworkAccess = string; +/** Known values of {@link ActivationStatus} that the service accepts. */ +export enum KnownActivationStatus { + /** The managed HSM Pool is active. */ + Active = "Active", + /** The managed HSM Pool is not yet activated. */ + NotActivated = "NotActivated", + /** An unknown error occurred while activating managed hsm. */ + Unknown = "Unknown", + /** Failed to activate managed hsm. */ + Failed = "Failed" +} + +/** + * Defines values for ActivationStatus. \ + * {@link KnownActivationStatus} can be used interchangeably with ActivationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The managed HSM Pool is active. \ + * **NotActivated**: The managed HSM Pool is not yet activated. \ + * **Unknown**: An unknown error occurred while activating managed hsm. \ + * **Failed**: Failed to activate managed hsm. + */ +export type ActivationStatus = string; + /** Known values of {@link ManagedHsmSkuFamily} that the service accepts. */ export enum KnownManagedHsmSkuFamily { /** B */ @@ -1732,6 +2035,55 @@ export interface KeysListVersionsNextOptionalParams /** Contains response data for the listVersionsNext operation. */ export type KeysListVersionsNextResponse = KeyListResult; +/** Optional parameters. */ +export interface ManagedHsmKeysCreateIfNotExistOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createIfNotExist operation. */ +export type ManagedHsmKeysCreateIfNotExistResponse = ManagedHsmKey; + +/** Optional parameters. */ +export interface ManagedHsmKeysGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ManagedHsmKeysGetResponse = ManagedHsmKey; + +/** Optional parameters. */ +export interface ManagedHsmKeysListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ManagedHsmKeysListResponse = ManagedHsmKeyListResult; + +/** Optional parameters. */ +export interface ManagedHsmKeysGetVersionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getVersion operation. */ +export type ManagedHsmKeysGetVersionResponse = ManagedHsmKey; + +/** Optional parameters. */ +export interface ManagedHsmKeysListVersionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listVersions operation. */ +export type ManagedHsmKeysListVersionsResponse = ManagedHsmKeyListResult; + +/** Optional parameters. */ +export interface ManagedHsmKeysListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ManagedHsmKeysListNextResponse = ManagedHsmKeyListResult; + +/** Optional parameters. */ +export interface ManagedHsmKeysListVersionsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listVersionsNext operation. */ +export type ManagedHsmKeysListVersionsNextResponse = ManagedHsmKeyListResult; + /** Optional parameters. */ export interface VaultsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { @@ -1829,20 +2181,14 @@ export type VaultsCheckNameAvailabilityResponse = CheckNameAvailabilityResult; /** Optional parameters. */ export interface VaultsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByResourceGroupNext operation. */ export type VaultsListByResourceGroupNextResponse = VaultListResult; /** Optional parameters. */ export interface VaultsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listBySubscriptionNext operation. */ export type VaultsListBySubscriptionNextResponse = VaultListResult; @@ -1856,10 +2202,7 @@ export type VaultsListDeletedNextResponse = DeletedVaultListResult; /** Optional parameters. */ export interface VaultsListNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type VaultsListNextResponse = ResourceListResult; @@ -1995,22 +2338,26 @@ export interface ManagedHsmsPurgeDeletedOptionalParams resumeFrom?: string; } +/** Contains response data for the purgeDeleted operation. */ +export type ManagedHsmsPurgeDeletedResponse = ManagedHsmsPurgeDeletedHeaders; + +/** Optional parameters. */ +export interface ManagedHsmsCheckMhsmNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkMhsmNameAvailability operation. */ +export type ManagedHsmsCheckMhsmNameAvailabilityResponse = CheckMhsmNameAvailabilityResult; + /** Optional parameters. */ export interface ManagedHsmsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByResourceGroupNext operation. */ export type ManagedHsmsListByResourceGroupNextResponse = ManagedHsmListResult; /** Optional parameters. */ export interface ManagedHsmsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listBySubscriptionNext operation. */ export type ManagedHsmsListBySubscriptionNextResponse = ManagedHsmListResult; @@ -2070,6 +2417,20 @@ export interface MhsmPrivateLinkResourcesListByMhsmResourceOptionalParams /** Contains response data for the listByMhsmResource operation. */ export type MhsmPrivateLinkResourcesListByMhsmResourceResponse = MhsmPrivateLinkResourceListResult; +/** Optional parameters. */ +export interface MhsmRegionsListByResourceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResource operation. */ +export type MhsmRegionsListByResourceResponse = MhsmRegionsListResult; + +/** Optional parameters. */ +export interface MhsmRegionsListByResourceNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceNext operation. */ +export type MhsmRegionsListByResourceNextResponse = MhsmRegionsListResult; + /** Optional parameters. */ export interface OperationsListOptionalParams extends coreClient.OperationOptions {} @@ -2115,10 +2476,7 @@ export type SecretsListResponse = SecretListResult; /** Optional parameters. */ export interface SecretsListNextOptionalParams - extends coreClient.OperationOptions { - /** Maximum number of results to return. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type SecretsListNextResponse = SecretListResult; diff --git a/sdk/keyvault/arm-keyvault/src/models/mappers.ts b/sdk/keyvault/arm-keyvault/src/models/mappers.ts index f3d6f9cd9ec4..aeba2010bca0 100644 --- a/sdk/keyvault/arm-keyvault/src/models/mappers.ts +++ b/sdk/keyvault/arm-keyvault/src/models/mappers.ts @@ -149,6 +149,7 @@ export const KeyAttributes: coreClient.CompositeMapper = { } }, exportable: { + defaultValue: false, serializedName: "exportable", type: { name: "Boolean" @@ -369,20 +370,373 @@ export const CloudErrorBody: coreClient.CompositeMapper = { name: "String" } }, - message: { - serializedName: "message", + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const KeyListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "KeyListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Key" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedHsmKeyCreateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKeyCreateParameters", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ManagedHsmKeyProperties" + } + } + } + } +}; + +export const ManagedHsmKeyProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKeyProperties", + modelProperties: { + attributes: { + serializedName: "attributes", + type: { + name: "Composite", + className: "ManagedHsmKeyAttributes" + } + }, + kty: { + serializedName: "kty", + type: { + name: "String" + } + }, + keyOps: { + serializedName: "keyOps", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + keySize: { + serializedName: "keySize", + type: { + name: "Number" + } + }, + curveName: { + serializedName: "curveName", + type: { + name: "String" + } + }, + keyUri: { + serializedName: "keyUri", + readOnly: true, + type: { + name: "String" + } + }, + keyUriWithVersion: { + serializedName: "keyUriWithVersion", + readOnly: true, + type: { + name: "String" + } + }, + rotationPolicy: { + serializedName: "rotationPolicy", + type: { + name: "Composite", + className: "ManagedHsmRotationPolicy" + } + }, + releasePolicy: { + serializedName: "release_policy", + type: { + name: "Composite", + className: "ManagedHsmKeyReleasePolicy" + } + } + } + } +}; + +export const ManagedHsmKeyAttributes: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKeyAttributes", + modelProperties: { + enabled: { + serializedName: "enabled", + type: { + name: "Boolean" + } + }, + notBefore: { + serializedName: "nbf", + type: { + name: "Number" + } + }, + expires: { + serializedName: "exp", + type: { + name: "Number" + } + }, + created: { + serializedName: "created", + readOnly: true, + type: { + name: "Number" + } + }, + updated: { + serializedName: "updated", + readOnly: true, + type: { + name: "Number" + } + }, + recoveryLevel: { + serializedName: "recoveryLevel", + readOnly: true, + type: { + name: "String" + } + }, + exportable: { + serializedName: "exportable", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ManagedHsmRotationPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmRotationPolicy", + modelProperties: { + attributes: { + serializedName: "attributes", + type: { + name: "Composite", + className: "ManagedHsmKeyRotationPolicyAttributes" + } + }, + lifetimeActions: { + serializedName: "lifetimeActions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedHsmLifetimeAction" + } + } + } + } + } + } +}; + +export const ManagedHsmKeyRotationPolicyAttributes: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKeyRotationPolicyAttributes", + modelProperties: { + created: { + serializedName: "created", + readOnly: true, + type: { + name: "Number" + } + }, + updated: { + serializedName: "updated", + readOnly: true, + type: { + name: "Number" + } + }, + expiryTime: { + serializedName: "expiryTime", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedHsmLifetimeAction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmLifetimeAction", + modelProperties: { + trigger: { + serializedName: "trigger", + type: { + name: "Composite", + className: "ManagedHsmTrigger" + } + }, + action: { + serializedName: "action", + type: { + name: "Composite", + className: "ManagedHsmAction" + } + } + } + } +}; + +export const ManagedHsmTrigger: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmTrigger", + modelProperties: { + timeAfterCreate: { + serializedName: "timeAfterCreate", + type: { + name: "String" + } + }, + timeBeforeExpiry: { + serializedName: "timeBeforeExpiry", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedHsmAction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmAction", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "Enum", + allowedValues: ["rotate", "notify"] + } + } + } + } +}; + +export const ManagedHsmKeyReleasePolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKeyReleasePolicy", + modelProperties: { + contentType: { + defaultValue: "application/json; charset=utf-8", + serializedName: "contentType", + type: { + name: "String" + } + }, + data: { + serializedName: "data", + type: { + name: "Base64Url" + } + } + } + } +}; + +export const ProxyResourceWithoutSystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResourceWithoutSystemData", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } } } } }; -export const KeyListResult: coreClient.CompositeMapper = { +export const ManagedHsmKeyListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "KeyListResult", + className: "ManagedHsmKeyListResult", modelProperties: { value: { serializedName: "value", @@ -391,7 +745,7 @@ export const KeyListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Key" + className: "ManagedHsmKey" } } } @@ -1487,6 +1841,18 @@ export const ManagedHsmProperties: coreClient.CompositeMapper = { className: "MhsmNetworkRuleSet" } }, + regions: { + serializedName: "regions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MhsmGeoReplicatedRegion" + } + } + } + }, privateEndpointConnections: { serializedName: "privateEndpointConnections", readOnly: true, @@ -1512,6 +1878,13 @@ export const ManagedHsmProperties: coreClient.CompositeMapper = { type: { name: "DateTime" } + }, + securityDomainProperties: { + serializedName: "securityDomainProperties", + type: { + name: "Composite", + className: "ManagedHSMSecurityDomainProperties" + } } } } @@ -1594,6 +1967,34 @@ export const MhsmVirtualNetworkRule: coreClient.CompositeMapper = { } }; +export const MhsmGeoReplicatedRegion: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MhsmGeoReplicatedRegion", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + isPrimary: { + serializedName: "isPrimary", + type: { + name: "Boolean" + } + } + } + } +}; + export const MhsmPrivateEndpointConnectionItem: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1678,6 +2079,29 @@ export const MhsmPrivateLinkServiceConnectionState: coreClient.CompositeMapper = } }; +export const ManagedHSMSecurityDomainProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHSMSecurityDomainProperties", + modelProperties: { + activationStatus: { + serializedName: "activationStatus", + readOnly: true, + type: { + name: "String" + } + }, + activationStatusMessage: { + serializedName: "activationStatusMessage", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const ManagedHsmResource: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1996,6 +2420,80 @@ export const MhsmPrivateLinkResourceListResult: coreClient.CompositeMapper = { } }; +export const MhsmRegionsListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MhsmRegionsListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MhsmGeoReplicatedRegion" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CheckMhsmNameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckMhsmNameAvailabilityParameters", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CheckMhsmNameAvailabilityResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckMhsmNameAvailabilityResult", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + readOnly: true, + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + readOnly: true, + type: { + name: "Enum", + allowedValues: ["AccountNameInvalid", "AlreadyExists"] + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const OperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2626,6 +3124,80 @@ export const Secret: coreClient.CompositeMapper = { } }; +export const ManagedHsmKey: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmKey", + modelProperties: { + ...ProxyResourceWithoutSystemData.type.modelProperties, + attributes: { + serializedName: "properties.attributes", + type: { + name: "Composite", + className: "ManagedHsmKeyAttributes" + } + }, + kty: { + serializedName: "properties.kty", + type: { + name: "String" + } + }, + keyOps: { + serializedName: "properties.keyOps", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + keySize: { + serializedName: "properties.keySize", + type: { + name: "Number" + } + }, + curveName: { + serializedName: "properties.curveName", + type: { + name: "String" + } + }, + keyUri: { + serializedName: "properties.keyUri", + readOnly: true, + type: { + name: "String" + } + }, + keyUriWithVersion: { + serializedName: "properties.keyUriWithVersion", + readOnly: true, + type: { + name: "String" + } + }, + rotationPolicy: { + serializedName: "properties.rotationPolicy", + type: { + name: "Composite", + className: "ManagedHsmRotationPolicy" + } + }, + releasePolicy: { + serializedName: "properties.release_policy", + type: { + name: "Composite", + className: "ManagedHsmKeyReleasePolicy" + } + } + } + } +}; + export const ManagedHsm: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2771,6 +3343,21 @@ export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper } }; +export const ManagedHsmsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmsCreateOrUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + export const ManagedHsmsUpdateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2786,6 +3373,36 @@ export const ManagedHsmsUpdateHeaders: coreClient.CompositeMapper = { } }; +export const ManagedHsmsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmsDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedHsmsPurgeDeletedHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedHsmsPurgeDeletedHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + export const MhsmPrivateEndpointConnectionsPutHeaders: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2812,12 +3429,6 @@ export const MhsmPrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMa name: "Composite", className: "MhsmPrivateEndpointConnectionsDeleteHeaders", modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - }, location: { serializedName: "location", type: { diff --git a/sdk/keyvault/arm-keyvault/src/models/parameters.ts b/sdk/keyvault/arm-keyvault/src/models/parameters.ts index 98abfbf521ff..36d4f476a4e6 100644 --- a/sdk/keyvault/arm-keyvault/src/models/parameters.ts +++ b/sdk/keyvault/arm-keyvault/src/models/parameters.ts @@ -13,12 +13,14 @@ import { } from "@azure/core-client"; import { KeyCreateParameters as KeyCreateParametersMapper, + ManagedHsmKeyCreateParameters as ManagedHsmKeyCreateParametersMapper, VaultCreateOrUpdateParameters as VaultCreateOrUpdateParametersMapper, VaultPatchParameters as VaultPatchParametersMapper, VaultAccessPolicyParameters as VaultAccessPolicyParametersMapper, VaultCheckNameAvailabilityParameters as VaultCheckNameAvailabilityParametersMapper, PrivateEndpointConnection as PrivateEndpointConnectionMapper, ManagedHsm as ManagedHsmMapper, + CheckMhsmNameAvailabilityParameters as CheckMhsmNameAvailabilityParametersMapper, MhsmPrivateEndpointConnection as MhsmPrivateEndpointConnectionMapper, SecretCreateOrUpdateParameters as SecretCreateOrUpdateParametersMapper, SecretPatchParameters as SecretPatchParametersMapper @@ -118,7 +120,7 @@ export const keyName: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-11-01-preview", + defaultValue: "2023-02-01", isConstant: true, serializedName: "api-version", type: { @@ -155,10 +157,46 @@ export const nextLink: OperationURLParameter = { export const parameters1: OperationParameter = { parameterPath: "parameters", - mapper: VaultCreateOrUpdateParametersMapper + mapper: ManagedHsmKeyCreateParametersMapper +}; + +export const resourceGroupName1: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + constraints: { + Pattern: new RegExp("^[A-Za-z]([A-Za-z0-9]|\\-[A-Za-z0-9])+$"), + MaxLength: 24, + MinLength: 3 + }, + serializedName: "name", + required: true, + type: { + name: "String" + } + } }; export const parameters2: OperationParameter = { + parameterPath: "parameters", + mapper: VaultCreateOrUpdateParametersMapper +}; + +export const parameters3: OperationParameter = { parameterPath: "parameters", mapper: VaultPatchParametersMapper }; @@ -174,7 +212,7 @@ export const vaultName1: OperationURLParameter = { } }; -export const parameters3: OperationParameter = { +export const parameters4: OperationParameter = { parameterPath: "parameters", mapper: VaultAccessPolicyParametersMapper }; @@ -257,12 +295,12 @@ export const properties: OperationParameter = { mapper: PrivateEndpointConnectionMapper }; -export const parameters4: OperationParameter = { +export const parameters5: OperationParameter = { parameterPath: "parameters", mapper: ManagedHsmMapper }; -export const name: OperationURLParameter = { +export const name1: OperationURLParameter = { parameterPath: "name", mapper: { serializedName: "name", @@ -273,12 +311,17 @@ export const name: OperationURLParameter = { } }; +export const mhsmName: OperationParameter = { + parameterPath: "mhsmName", + mapper: CheckMhsmNameAvailabilityParametersMapper +}; + export const properties1: OperationParameter = { parameterPath: "properties", mapper: MhsmPrivateEndpointConnectionMapper }; -export const parameters5: OperationParameter = { +export const parameters6: OperationParameter = { parameterPath: "parameters", mapper: SecretCreateOrUpdateParametersMapper }; @@ -297,7 +340,7 @@ export const secretName: OperationURLParameter = { } }; -export const parameters6: OperationParameter = { +export const parameters7: OperationParameter = { parameterPath: "parameters", mapper: SecretPatchParametersMapper }; diff --git a/sdk/keyvault/arm-keyvault/src/operations/index.ts b/sdk/keyvault/arm-keyvault/src/operations/index.ts index 7134a8453517..8d69150051f5 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/index.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/index.ts @@ -7,11 +7,13 @@ */ export * from "./keys"; +export * from "./managedHsmKeys"; export * from "./vaults"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./managedHsms"; export * from "./mhsmPrivateEndpointConnections"; export * from "./mhsmPrivateLinkResources"; +export * from "./mhsmRegions"; export * from "./operations"; export * from "./secrets"; diff --git a/sdk/keyvault/arm-keyvault/src/operations/keys.ts b/sdk/keyvault/arm-keyvault/src/operations/keys.ts index 48f203fa737e..e9be9f3f3079 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/keys.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/keys.ts @@ -220,7 +220,9 @@ export class KeysImpl implements Keys { * versions, and does not update existing keys. * @param resourceGroupName The name of the resource group which contains the specified key vault. * @param vaultName The name of the key vault which contains the key to be created. - * @param keyName The name of the key to be created. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. * @param parameters The parameters used to create the specified key. * @param options The options parameters. */ @@ -484,7 +486,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -506,7 +507,6 @@ const listVersionsNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/keyvault/arm-keyvault/src/operations/managedHsmKeys.ts b/sdk/keyvault/arm-keyvault/src/operations/managedHsmKeys.ts new file mode 100644 index 000000000000..516e575c33b6 --- /dev/null +++ b/sdk/keyvault/arm-keyvault/src/operations/managedHsmKeys.ts @@ -0,0 +1,525 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { ManagedHsmKeys } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { KeyVaultManagementClient } from "../keyVaultManagementClient"; +import { + ManagedHsmKey, + ManagedHsmKeysListNextOptionalParams, + ManagedHsmKeysListOptionalParams, + ManagedHsmKeysListResponse, + ManagedHsmKeysListVersionsNextOptionalParams, + ManagedHsmKeysListVersionsOptionalParams, + ManagedHsmKeysListVersionsResponse, + ManagedHsmKeyCreateParameters, + ManagedHsmKeysCreateIfNotExistOptionalParams, + ManagedHsmKeysCreateIfNotExistResponse, + ManagedHsmKeysGetOptionalParams, + ManagedHsmKeysGetResponse, + ManagedHsmKeysGetVersionOptionalParams, + ManagedHsmKeysGetVersionResponse, + ManagedHsmKeysListNextResponse, + ManagedHsmKeysListVersionsNextResponse +} from "../models"; + +/// +/** Class containing ManagedHsmKeys operations. */ +export class ManagedHsmKeysImpl implements ManagedHsmKeys { + private readonly client: KeyVaultManagementClient; + + /** + * Initialize a new instance of the class ManagedHsmKeys class. + * @param client Reference to the service client + */ + constructor(client: KeyVaultManagementClient) { + this.client = client; + } + + /** + * Lists the keys in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + name: string, + options?: ManagedHsmKeysListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, name, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(resourceGroupName, name, options, settings); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + name: string, + options?: ManagedHsmKeysListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ManagedHsmKeysListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + name, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + name: string, + options?: ManagedHsmKeysListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + name, + options + )) { + yield* page; + } + } + + /** + * Lists the versions of the specified key in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param options The options parameters. + */ + public listVersions( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysListVersionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listVersionsPagingAll( + resourceGroupName, + name, + keyName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listVersionsPagingPage( + resourceGroupName, + name, + keyName, + options, + settings + ); + } + }; + } + + private async *listVersionsPagingPage( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysListVersionsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ManagedHsmKeysListVersionsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listVersions( + resourceGroupName, + name, + keyName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listVersionsNext( + resourceGroupName, + name, + keyName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listVersionsPagingAll( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysListVersionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listVersionsPagingPage( + resourceGroupName, + name, + keyName, + options + )) { + yield* page; + } + } + + /** + * Creates the first version of a new key if it does not exist. If it already exists, then the existing + * key is returned without any write operations being performed. This API does not create subsequent + * versions, and does not update existing keys. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param parameters The parameters used to create the specified key. + * @param options The options parameters. + */ + createIfNotExist( + resourceGroupName: string, + name: string, + keyName: string, + parameters: ManagedHsmKeyCreateParameters, + options?: ManagedHsmKeysCreateIfNotExistOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, keyName, parameters, options }, + createIfNotExistOperationSpec + ); + } + + /** + * Gets the current version of the specified key from the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, keyName, options }, + getOperationSpec + ); + } + + /** + * Lists the keys in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + name: string, + options?: ManagedHsmKeysListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, options }, + listOperationSpec + ); + } + + /** + * Gets the specified version of the specified key in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param keyVersion The version of the key to be retrieved. + * @param options The options parameters. + */ + getVersion( + resourceGroupName: string, + name: string, + keyName: string, + keyVersion: string, + options?: ManagedHsmKeysGetVersionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, keyName, keyVersion, options }, + getVersionOperationSpec + ); + } + + /** + * Lists the versions of the specified key in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param options The options parameters. + */ + private _listVersions( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysListVersionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, keyName, options }, + listVersionsOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + name: string, + nextLink: string, + options?: ManagedHsmKeysListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, nextLink, options }, + listNextOperationSpec + ); + } + + /** + * ListVersionsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param nextLink The nextLink from the previous successful call to the ListVersions method. + * @param options The options parameters. + */ + private _listVersionsNext( + resourceGroupName: string, + name: string, + keyName: string, + nextLink: string, + options?: ManagedHsmKeysListVersionsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, keyName, nextLink, options }, + listVersionsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createIfNotExistOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKey + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.keyName, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKey + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.keyName, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKeyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const getVersionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions/{keyVersion}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKey + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.keyName, + Parameters.keyVersion, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listVersionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/keys/{keyName}/versions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKeyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.keyName, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKeyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const listVersionsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedHsmKeyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.keyName, + Parameters.nextLink, + Parameters.resourceGroupName1, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/keyvault/arm-keyvault/src/operations/managedHsms.ts b/sdk/keyvault/arm-keyvault/src/operations/managedHsms.ts index 8c80bb16ca8c..bfdce13ca80f 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/managedHsms.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/managedHsms.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { KeyVaultManagementClient } from "../keyVaultManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { ManagedHsm, ManagedHsmsListByResourceGroupNextOptionalParams, @@ -37,6 +41,10 @@ import { ManagedHsmsGetDeletedOptionalParams, ManagedHsmsGetDeletedResponse, ManagedHsmsPurgeDeletedOptionalParams, + ManagedHsmsPurgeDeletedResponse, + CheckMhsmNameAvailabilityParameters, + ManagedHsmsCheckMhsmNameAvailabilityOptionalParams, + ManagedHsmsCheckMhsmNameAvailabilityResponse, ManagedHsmsListByResourceGroupNextResponse, ManagedHsmsListBySubscriptionNextResponse, ManagedHsmsListDeletedNextResponse @@ -246,8 +254,8 @@ export class ManagedHsmsImpl implements ManagedHsms { parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ManagedHsmsCreateOrUpdateResponse > > { @@ -257,7 +265,7 @@ export class ManagedHsmsImpl implements ManagedHsms { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -290,13 +298,16 @@ export class ManagedHsmsImpl implements ManagedHsms { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + ManagedHsmsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -338,8 +349,8 @@ export class ManagedHsmsImpl implements ManagedHsms { parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ManagedHsmsUpdateResponse > > { @@ -349,7 +360,7 @@ export class ManagedHsmsImpl implements ManagedHsms { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -382,13 +393,16 @@ export class ManagedHsmsImpl implements ManagedHsms { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, parameters, options }, - updateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, parameters, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + ManagedHsmsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -427,14 +441,14 @@ export class ManagedHsmsImpl implements ManagedHsms { resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -467,13 +481,13 @@ export class ManagedHsmsImpl implements ManagedHsms { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -581,14 +595,19 @@ export class ManagedHsmsImpl implements ManagedHsms { name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams - ): Promise, void>> { + ): Promise< + SimplePollerLike< + OperationState, + ManagedHsmsPurgeDeletedResponse + > + > { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec - ): Promise => { + ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -621,13 +640,16 @@ export class ManagedHsmsImpl implements ManagedHsms { }; }; - const lro = new LroImpl( - sendOperation, - { name, location, options }, - purgeDeletedOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { name, location, options }, + spec: purgeDeletedOperationSpec + }); + const poller = await createHttpPoller< + ManagedHsmsPurgeDeletedResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -644,11 +666,26 @@ export class ManagedHsmsImpl implements ManagedHsms { name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams - ): Promise { + ): Promise { const poller = await this.beginPurgeDeleted(name, location, options); return poller.pollUntilDone(); } + /** + * Checks that the managed hsm name is valid and is not already in use. + * @param mhsmName The name of the managed hsm. + * @param options The options parameters. + */ + checkMhsmNameAvailability( + mhsmName: CheckMhsmNameAvailabilityParameters, + options?: ManagedHsmsCheckMhsmNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { mhsmName, options }, + checkMhsmNameAvailabilityOperationSpec + ); + } + /** * ListByResourceGroupNext * @param resourceGroupName Name of the resource group that contains the managed HSM pool. @@ -720,13 +757,13 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - requestBody: Parameters.parameters4, + requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", @@ -753,13 +790,13 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - requestBody: Parameters.parameters4, + requestBody: Parameters.parameters5, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", @@ -783,7 +820,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -796,7 +833,6 @@ const getOperationSpec: coreClient.OperationSpec = { 200: { bodyMapper: Mappers.ManagedHsm }, - 202: {}, 204: {}, default: { bodyMapper: Mappers.ManagedHsmError @@ -807,7 +843,7 @@ const getOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -884,7 +920,7 @@ const getDeletedOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.location, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -894,10 +930,18 @@ const purgeDeletedOperationSpec: coreClient.OperationSpec = { "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge", httpMethod: "POST", responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, + 200: { + headersMapper: Mappers.ManagedHsmsPurgeDeletedHeaders + }, + 201: { + headersMapper: Mappers.ManagedHsmsPurgeDeletedHeaders + }, + 202: { + headersMapper: Mappers.ManagedHsmsPurgeDeletedHeaders + }, + 204: { + headersMapper: Mappers.ManagedHsmsPurgeDeletedHeaders + }, default: { bodyMapper: Mappers.ManagedHsmError } @@ -907,11 +951,30 @@ const purgeDeletedOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.location, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer }; +const checkMhsmNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckMhsmNameAvailabilityResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.mhsmName, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", @@ -923,7 +986,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -944,7 +1006,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -964,7 +1025,6 @@ const listDeletedNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateEndpointConnections.ts b/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateEndpointConnections.ts index 7310a38ac41a..2c0fcdeba965 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateEndpointConnections.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateEndpointConnections.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { KeyVaultManagementClient } from "../keyVaultManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { MhsmPrivateEndpointConnection, MhsmPrivateEndpointConnectionsListByResourceNextOptionalParams, @@ -200,8 +204,8 @@ export class MhsmPrivateEndpointConnectionsImpl privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, MhsmPrivateEndpointConnectionsDeleteResponse > > { @@ -211,7 +215,7 @@ export class MhsmPrivateEndpointConnectionsImpl ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -244,13 +248,16 @@ export class MhsmPrivateEndpointConnectionsImpl }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, name, privateEndpointConnectionName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, name, privateEndpointConnectionName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller< + MhsmPrivateEndpointConnectionsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -319,7 +326,7 @@ const listByResourceOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -342,7 +349,7 @@ const getOperationSpec: coreClient.OperationSpec = { Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.privateEndpointConnectionName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -367,7 +374,7 @@ const putOperationSpec: coreClient.OperationSpec = { Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.privateEndpointConnectionName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.contentType, Parameters.accept], mediaType: "json", @@ -400,7 +407,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.privateEndpointConnectionName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer @@ -416,13 +423,12 @@ const listByResourceNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ManagedHsmError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.nextLink, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer diff --git a/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateLinkResources.ts b/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateLinkResources.ts index 4badfbc5ff96..46a89fe310d0 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateLinkResources.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/mhsmPrivateLinkResources.ts @@ -65,7 +65,7 @@ const listByMhsmResourceOperationSpec: coreClient.OperationSpec = { Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.name + Parameters.name1 ], headerParameters: [Parameters.accept], serializer diff --git a/sdk/keyvault/arm-keyvault/src/operations/mhsmRegions.ts b/sdk/keyvault/arm-keyvault/src/operations/mhsmRegions.ts new file mode 100644 index 000000000000..926c3e25dad6 --- /dev/null +++ b/sdk/keyvault/arm-keyvault/src/operations/mhsmRegions.ts @@ -0,0 +1,194 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { MhsmRegions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { KeyVaultManagementClient } from "../keyVaultManagementClient"; +import { + MhsmGeoReplicatedRegion, + MhsmRegionsListByResourceNextOptionalParams, + MhsmRegionsListByResourceOptionalParams, + MhsmRegionsListByResourceResponse, + MhsmRegionsListByResourceNextResponse +} from "../models"; + +/// +/** Class containing MhsmRegions operations. */ +export class MhsmRegionsImpl implements MhsmRegions { + private readonly client: KeyVaultManagementClient; + + /** + * Initialize a new instance of the class MhsmRegions class. + * @param client Reference to the service client + */ + constructor(client: KeyVaultManagementClient) { + this.client = client; + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * @param resourceGroupName Name of the resource group that contains the managed HSM pool. + * @param name Name of the managed HSM Pool + * @param options The options parameters. + */ + public listByResource( + resourceGroupName: string, + name: string, + options?: MhsmRegionsListByResourceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourcePagingAll(resourceGroupName, name, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourcePagingPage( + resourceGroupName, + name, + options, + settings + ); + } + }; + } + + private async *listByResourcePagingPage( + resourceGroupName: string, + name: string, + options?: MhsmRegionsListByResourceOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: MhsmRegionsListByResourceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResource(resourceGroupName, name, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceNext( + resourceGroupName, + name, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourcePagingAll( + resourceGroupName: string, + name: string, + options?: MhsmRegionsListByResourceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourcePagingPage( + resourceGroupName, + name, + options + )) { + yield* page; + } + } + + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * @param resourceGroupName Name of the resource group that contains the managed HSM pool. + * @param name Name of the managed HSM Pool + * @param options The options parameters. + */ + private _listByResource( + resourceGroupName: string, + name: string, + options?: MhsmRegionsListByResourceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, options }, + listByResourceOperationSpec + ); + } + + /** + * ListByResourceNext + * @param resourceGroupName Name of the resource group that contains the managed HSM pool. + * @param name Name of the managed HSM Pool + * @param nextLink The nextLink from the previous successful call to the ListByResource method. + * @param options The options parameters. + */ + private _listByResourceNext( + resourceGroupName: string, + name: string, + nextLink: string, + options?: MhsmRegionsListByResourceNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, nextLink, options }, + listByResourceNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByResourceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/regions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MhsmRegionsListResult + }, + default: { + bodyMapper: Mappers.ManagedHsmError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name1 + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MhsmRegionsListResult + }, + default: { + bodyMapper: Mappers.ManagedHsmError + } + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.name1 + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/keyvault/arm-keyvault/src/operations/operations.ts b/sdk/keyvault/arm-keyvault/src/operations/operations.ts index 6ce75a037500..653bd71bbc8a 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/operations.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/operations.ts @@ -143,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], serializer diff --git a/sdk/keyvault/arm-keyvault/src/operations/privateEndpointConnections.ts b/sdk/keyvault/arm-keyvault/src/operations/privateEndpointConnections.ts index a9eb66c18fb8..3528a4ff140f 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/privateEndpointConnections.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/privateEndpointConnections.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { KeyVaultManagementClient } from "../keyVaultManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { PrivateEndpointConnection, PrivateEndpointConnectionsListByResourceNextOptionalParams, @@ -190,8 +194,8 @@ export class PrivateEndpointConnectionsImpl privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsDeleteResponse > > { @@ -201,7 +205,7 @@ export class PrivateEndpointConnectionsImpl ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -234,13 +238,21 @@ export class PrivateEndpointConnectionsImpl }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, vaultName, privateEndpointConnectionName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + vaultName, + privateEndpointConnectionName, + options + }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller< + PrivateEndpointConnectionsDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -425,7 +437,6 @@ const listByResourceNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/keyvault/arm-keyvault/src/operations/secrets.ts b/sdk/keyvault/arm-keyvault/src/operations/secrets.ts index 86c6f42069e1..bea3e5ed65f9 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/secrets.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/secrets.ts @@ -126,7 +126,9 @@ export class SecretsImpl implements Secrets { * with vault secrets. * @param resourceGroupName The name of the Resource Group to which the vault belongs. * @param vaultName Name of the vault - * @param secretName Name of the secret + * @param secretName Name of the secret. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive + * information. * @param parameters Parameters to create or update the secret * @param options The options parameters. */ @@ -241,7 +243,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters5, + requestBody: Parameters.parameters6, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -269,7 +271,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters6, + requestBody: Parameters.parameters7, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -338,7 +340,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/keyvault/arm-keyvault/src/operations/vaults.ts b/sdk/keyvault/arm-keyvault/src/operations/vaults.ts index cb65a145795e..3727f37224a4 100644 --- a/sdk/keyvault/arm-keyvault/src/operations/vaults.ts +++ b/sdk/keyvault/arm-keyvault/src/operations/vaults.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { KeyVaultManagementClient } from "../keyVaultManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { Vault, VaultsListByResourceGroupNextOptionalParams, @@ -314,8 +318,8 @@ export class VaultsImpl implements Vaults { parameters: VaultCreateOrUpdateParameters, options?: VaultsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, VaultsCreateOrUpdateResponse > > { @@ -325,7 +329,7 @@ export class VaultsImpl implements Vaults { ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -358,13 +362,16 @@ export class VaultsImpl implements Vaults { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, vaultName, parameters, options }, - createOrUpdateOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, vaultName, parameters, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + VaultsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -536,14 +543,14 @@ export class VaultsImpl implements Vaults { vaultName: string, location: string, options?: VaultsPurgeDeletedOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -576,13 +583,13 @@ export class VaultsImpl implements Vaults { }; }; - const lro = new LroImpl( - sendOperation, - { vaultName, location, options }, - purgeDeletedOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { vaultName, location, options }, + spec: purgeDeletedOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -715,7 +722,7 @@ const createOrUpdateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters1, + requestBody: Parameters.parameters2, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -742,7 +749,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters2, + requestBody: Parameters.parameters3, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -812,7 +819,7 @@ const updateAccessPolicyOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - requestBody: Parameters.parameters3, + requestBody: Parameters.parameters4, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, @@ -970,7 +977,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -991,7 +997,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1011,7 +1016,6 @@ const listDeletedNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, @@ -1031,7 +1035,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.top, Parameters.filter, Parameters.apiVersion1], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/index.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/index.ts index 7134a8453517..8d69150051f5 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/index.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/index.ts @@ -7,11 +7,13 @@ */ export * from "./keys"; +export * from "./managedHsmKeys"; export * from "./vaults"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./managedHsms"; export * from "./mhsmPrivateEndpointConnections"; export * from "./mhsmPrivateLinkResources"; +export * from "./mhsmRegions"; export * from "./operations"; export * from "./secrets"; diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/keys.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/keys.ts index 13d909c3b9bb..9a0328500286 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/keys.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/keys.ts @@ -53,7 +53,9 @@ export interface Keys { * versions, and does not update existing keys. * @param resourceGroupName The name of the resource group which contains the specified key vault. * @param vaultName The name of the key vault which contains the key to be created. - * @param keyName The name of the key to be created. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. * @param parameters The parameters used to create the specified key. * @param options The options parameters. */ diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsmKeys.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsmKeys.ts new file mode 100644 index 000000000000..5f902d313524 --- /dev/null +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsmKeys.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ManagedHsmKey, + ManagedHsmKeysListOptionalParams, + ManagedHsmKeysListVersionsOptionalParams, + ManagedHsmKeyCreateParameters, + ManagedHsmKeysCreateIfNotExistOptionalParams, + ManagedHsmKeysCreateIfNotExistResponse, + ManagedHsmKeysGetOptionalParams, + ManagedHsmKeysGetResponse, + ManagedHsmKeysGetVersionOptionalParams, + ManagedHsmKeysGetVersionResponse +} from "../models"; + +/// +/** Interface representing a ManagedHsmKeys. */ +export interface ManagedHsmKeys { + /** + * Lists the keys in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + name: string, + options?: ManagedHsmKeysListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists the versions of the specified key in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param options The options parameters. + */ + listVersions( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysListVersionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates the first version of a new key if it does not exist. If it already exists, then the existing + * key is returned without any write operations being performed. This API does not create subsequent + * versions, and does not update existing keys. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param parameters The parameters used to create the specified key. + * @param options The options parameters. + */ + createIfNotExist( + resourceGroupName: string, + name: string, + keyName: string, + parameters: ManagedHsmKeyCreateParameters, + options?: ManagedHsmKeysCreateIfNotExistOptionalParams + ): Promise; + /** + * Gets the current version of the specified key from the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + keyName: string, + options?: ManagedHsmKeysGetOptionalParams + ): Promise; + /** + * Gets the specified version of the specified key in the specified managed HSM. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param name The name of the Managed HSM Pool within the specified resource group. + * @param keyName The name of the key to be created. The value you provide may be copied globally for + * the purpose of running the service. The value provided should not include personally identifiable or + * sensitive information. + * @param keyVersion The version of the key to be retrieved. + * @param options The options parameters. + */ + getVersion( + resourceGroupName: string, + name: string, + keyName: string, + keyVersion: string, + options?: ManagedHsmKeysGetVersionOptionalParams + ): Promise; +} diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsms.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsms.ts index 2d82c3e245a6..f4e93042fd6e 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsms.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/managedHsms.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { ManagedHsm, ManagedHsmsListByResourceGroupOptionalParams, @@ -23,7 +23,11 @@ import { ManagedHsmsGetResponse, ManagedHsmsGetDeletedOptionalParams, ManagedHsmsGetDeletedResponse, - ManagedHsmsPurgeDeletedOptionalParams + ManagedHsmsPurgeDeletedOptionalParams, + ManagedHsmsPurgeDeletedResponse, + CheckMhsmNameAvailabilityParameters, + ManagedHsmsCheckMhsmNameAvailabilityOptionalParams, + ManagedHsmsCheckMhsmNameAvailabilityResponse } from "../models"; /// @@ -66,8 +70,8 @@ export interface ManagedHsms { parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ManagedHsmsCreateOrUpdateResponse > >; @@ -97,8 +101,8 @@ export interface ManagedHsms { parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, ManagedHsmsUpdateResponse > >; @@ -125,7 +129,7 @@ export interface ManagedHsms { resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes the specified managed HSM Pool. * @param resourceGroupName Name of the resource group that contains the managed HSM pool. @@ -169,7 +173,12 @@ export interface ManagedHsms { name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams - ): Promise, void>>; + ): Promise< + SimplePollerLike< + OperationState, + ManagedHsmsPurgeDeletedResponse + > + >; /** * Permanently deletes the specified managed HSM. * @param name The name of the soft-deleted managed HSM. @@ -180,5 +189,14 @@ export interface ManagedHsms { name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams - ): Promise; + ): Promise; + /** + * Checks that the managed hsm name is valid and is not already in use. + * @param mhsmName The name of the managed hsm. + * @param options The options parameters. + */ + checkMhsmNameAvailability( + mhsmName: CheckMhsmNameAvailabilityParameters, + options?: ManagedHsmsCheckMhsmNameAvailabilityOptionalParams + ): Promise; } diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmPrivateEndpointConnections.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmPrivateEndpointConnections.ts index 175bb98e7ff7..7cc4f81d0c1c 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmPrivateEndpointConnections.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmPrivateEndpointConnections.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { MhsmPrivateEndpointConnection, MhsmPrivateEndpointConnectionsListByResourceOptionalParams, @@ -78,8 +78,8 @@ export interface MhsmPrivateEndpointConnections { privateEndpointConnectionName: string, options?: MhsmPrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, MhsmPrivateEndpointConnectionsDeleteResponse > >; diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmRegions.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmRegions.ts new file mode 100644 index 000000000000..ba14b4405150 --- /dev/null +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/mhsmRegions.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MhsmGeoReplicatedRegion, + MhsmRegionsListByResourceOptionalParams +} from "../models"; + +/// +/** Interface representing a MhsmRegions. */ +export interface MhsmRegions { + /** + * The List operation gets information about the regions associated with the managed HSM Pool. + * @param resourceGroupName Name of the resource group that contains the managed HSM pool. + * @param name Name of the managed HSM Pool + * @param options The options parameters. + */ + listByResource( + resourceGroupName: string, + name: string, + options?: MhsmRegionsListByResourceOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/privateEndpointConnections.ts index 7da1bbd06592..ac88c9201e24 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/privateEndpointConnections.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/privateEndpointConnections.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { PrivateEndpointConnection, PrivateEndpointConnectionsListByResourceOptionalParams, @@ -78,8 +78,8 @@ export interface PrivateEndpointConnections { privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, PrivateEndpointConnectionsDeleteResponse > >; diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/secrets.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/secrets.ts index 7aa4e6e13104..379b92f98dc2 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/secrets.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/secrets.ts @@ -42,7 +42,9 @@ export interface Secrets { * with vault secrets. * @param resourceGroupName The name of the Resource Group to which the vault belongs. * @param vaultName Name of the vault - * @param secretName Name of the secret + * @param secretName Name of the secret. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive + * information. * @param parameters Parameters to create or update the secret * @param options The options parameters. */ diff --git a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/vaults.ts b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/vaults.ts index b693f7e61645..c6943bdbc9d3 100644 --- a/sdk/keyvault/arm-keyvault/src/operationsInterfaces/vaults.ts +++ b/sdk/keyvault/arm-keyvault/src/operationsInterfaces/vaults.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { Vault, VaultsListByResourceGroupOptionalParams, @@ -84,8 +84,8 @@ export interface Vaults { parameters: VaultCreateOrUpdateParameters, options?: VaultsCreateOrUpdateOptionalParams ): Promise< - PollerLike< - PollOperationState, + SimplePollerLike< + OperationState, VaultsCreateOrUpdateResponse > >; @@ -173,7 +173,7 @@ export interface Vaults { vaultName: string, location: string, options?: VaultsPurgeDeletedOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Permanently deletes the specified vault. aka Purges the deleted Azure key vault. * @param vaultName The name of the soft-deleted vault. diff --git a/sdk/keyvault/arm-keyvault/src/pagingHelper.ts b/sdk/keyvault/arm-keyvault/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/keyvault/arm-keyvault/src/pagingHelper.ts +++ b/sdk/keyvault/arm-keyvault/src/pagingHelper.ts @@ -13,11 +13,11 @@ export interface PageInfo { const pageMap = new WeakMap(); /** - * Given a result page from a pageable operation, returns a - * continuation token that can be used to begin paging from + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from * that point later. - * @param page A result object from calling .byPage() on a paged operation. - * @returns The continuation token that can be passed into byPage(). + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. */ export function getContinuationToken(page: unknown): string | undefined { if (typeof page !== "object" || page === null) { diff --git a/sdk/keyvault/arm-keyvault/test/sampleTest.ts b/sdk/keyvault/arm-keyvault/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/keyvault/arm-keyvault/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/keyvault/arm-keyvault/tsconfig.json b/sdk/keyvault/arm-keyvault/tsconfig.json index d2c1e922fd67..3e6ae96443f3 100644 --- a/sdk/keyvault/arm-keyvault/tsconfig.json +++ b/sdk/keyvault/arm-keyvault/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-keyvault": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"