Skip to content

Commit

Permalink
CodeGen from PR 19395 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.KeyVault to add version stable/2022-07-01 (Azure#19395)

* Adds base for updating Microsoft.KeyVault from version preview/2021-11-01-preview to version 2022-07-01

* Updates readme

* Updates API version in new specs and examples

* Merges changes from 2021-10-01 into 2022-07-01.

Changes that were merged include:
- Adding "object" type.
- Fixing description of enableRbacAuthorization (no longer a preview feature).

* Addresses the LRO_RESPONSE_HEADER guideline.

This commit ensures the following invariant in managedHsm.json:
```
If an operation can return a 202 Accepted response, then we insert
'"x-ms-long-running-operation": true,' directly below the operationId,
and we insert a Location header in the operation as well as the
corresponding example.
```

* Add check name availability api and security domain status property to managed hsm specificiation

Co-authored-by: Neeraja Akula <neerajaakula@microsoft.com>
  • Loading branch information
SDKAuto and neeerajaakula committed Jul 11, 2022
1 parent 519b729 commit 892f8ff
Show file tree
Hide file tree
Showing 13 changed files with 491 additions and 57 deletions.
19 changes: 18 additions & 1 deletion sdk/keyvault/arm-keyvault/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
# Release History

## 2.1.0-beta.1 (2022-04-24)
## 3.0.0 (2022-07-11)

**Features**

- Added operation ManagedHsms.checkMhsmNameAvailability
- Added Interface Action
- Added Interface CheckMhsmNameAvailabilityParameters
- Added Interface CheckMhsmNameAvailabilityResult
- Added Interface KeyReleasePolicy
- Added Interface KeyRotationPolicyAttributes
- Added Interface LifetimeAction
- Added Interface ManagedHsmsCheckMhsmNameAvailabilityOptionalParams
- Added Interface ManagedHsmsCreateOrUpdateHeaders
- Added Interface ManagedHsmsDeleteHeaders
- Added Interface ManagedHSMSecurityDomainProperties
- Added Interface ManagedHsmsPurgeDeletedHeaders
- Added Interface ManagedHsmsUpdateHeaders
- Added Interface RotationPolicy
- Added Interface Trigger
- Added Type Alias ActivationStatus
- Added Type Alias KeyRotationPolicyActionType
- Added Type Alias ManagedHsmsCheckMhsmNameAvailabilityResponse
- Added Type Alias ManagedHsmsPurgeDeletedResponse
- Interface KeyProperties has a new optional parameter releasePolicy
- Interface KeyProperties has a new optional parameter rotationPolicy
- Type Alias Key has a new parameter rotationPolicy
- Type Alias Key has a new parameter releasePolicy
- Added Enum KnownActivationStatus
- 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

**Breaking Changes**

- Interface MhsmPrivateEndpointConnectionsDeleteHeaders no longer has parameter retryAfter


## 2.0.0 (2022-01-17)
Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/arm-keyvault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions sdk/keyvault/arm-keyvault/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"commit": "d90729bbada2b4f784f2737ab4b4e39693a7aab8",
"readme": "specification\\keyvault\\resource-manager\\readme.md",
"autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\keyvault\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true",
"commit": "2de5136a3664520fa0a6f9517997676590534403",
"readme": "specification/keyvault/resource-manager/readme.md",
"autorest_command": "autorest --version=3.7.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-alpha.19.20220425.1",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.2.6",
"use": "@autorest/typescript@6.0.0-alpha.19.20220408.1"
}
"release_tool": "@azure-tools/js-sdk-release-tools@2.4.0",
"use": "@autorest/typescript@6.0.0-alpha.19.20220425.1"
}
22 changes: 8 additions & 14 deletions sdk/keyvault/arm-keyvault/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for KeyVaultManagementClient.",
"version": "2.1.0-beta.1",
"version": "3.0.0",
"engines": {
"node": ">=12.0.0"
},
Expand Down Expand Up @@ -40,9 +40,11 @@
"uglify-js": "^3.4.9",
"rimraf": "^3.0.0",
"@azure/identity": "^2.0.1",
"@azure-tools/test-recorder": "^1.0.0",
"@azure-tools/test-recorder": "^2.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^7.1.1",
"cross-env": "^7.0.2"
"cross-env": "^7.0.2",
"@azure/dev-tool": "^1.0.0"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/keyvault/arm-keyvault",
"repository": {
Expand Down Expand Up @@ -93,7 +95,7 @@
"unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node",
"unit-test:browser": "echo skipped",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
"integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js",
"integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'",
"integration-test:browser": "echo skipped",
"docs": "echo skipped"
},
Expand All @@ -106,13 +108,5 @@
}
]
},
"autoPublish": true,
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-keyvault?view=azure-node-preview"
}
}
"autoPublish": true
}
65 changes: 62 additions & 3 deletions sdk/keyvault/arm-keyvault/review/arm-keyvault.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export interface Action {
// @public
export type ActionsRequired = string;

// @public
export type ActivationStatus = string;

// @public
export interface Attributes {
readonly created?: Date;
Expand All @@ -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;
Expand Down Expand Up @@ -319,6 +334,14 @@ export enum KnownActionsRequired {
None = "None"
}

// @public
export enum KnownActivationStatus {
Active = "Active",
Failed = "Failed",
NotActivated = "NotActivated",
Unknown = "Unknown"
}

// @public
export enum KnownCertificatePermissions {
// (undocumented)
Expand Down Expand Up @@ -676,17 +699,30 @@ export interface ManagedHsms {
beginCreateOrUpdateAndWait(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsCreateOrUpdateOptionalParams): Promise<ManagedHsmsCreateOrUpdateResponse>;
beginDelete(resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams): Promise<PollerLike<PollOperationState<void>, void>>;
beginDeleteAndWait(resourceGroupName: string, name: string, options?: ManagedHsmsDeleteOptionalParams): Promise<void>;
beginPurgeDeleted(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise<PollerLike<PollOperationState<void>, void>>;
beginPurgeDeletedAndWait(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise<void>;
beginPurgeDeleted(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise<PollerLike<PollOperationState<ManagedHsmsPurgeDeletedResponse>, ManagedHsmsPurgeDeletedResponse>>;
beginPurgeDeletedAndWait(name: string, location: string, options?: ManagedHsmsPurgeDeletedOptionalParams): Promise<ManagedHsmsPurgeDeletedResponse>;
beginUpdate(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams): Promise<PollerLike<PollOperationState<ManagedHsmsUpdateResponse>, ManagedHsmsUpdateResponse>>;
beginUpdateAndWait(resourceGroupName: string, name: string, parameters: ManagedHsm, options?: ManagedHsmsUpdateOptionalParams): Promise<ManagedHsmsUpdateResponse>;
checkMhsmNameAvailability(mhsmName: CheckMhsmNameAvailabilityParameters, options?: ManagedHsmsCheckMhsmNameAvailabilityOptionalParams): Promise<ManagedHsmsCheckMhsmNameAvailabilityResponse>;
get(resourceGroupName: string, name: string, options?: ManagedHsmsGetOptionalParams): Promise<ManagedHsmsGetResponse>;
getDeleted(name: string, location: string, options?: ManagedHsmsGetDeletedOptionalParams): Promise<ManagedHsmsGetDeletedResponse>;
listByResourceGroup(resourceGroupName: string, options?: ManagedHsmsListByResourceGroupOptionalParams): PagedAsyncIterableIterator<ManagedHsm>;
listBySubscription(options?: ManagedHsmsListBySubscriptionOptionalParams): PagedAsyncIterableIterator<ManagedHsm>;
listDeleted(options?: ManagedHsmsListDeletedOptionalParams): PagedAsyncIterableIterator<DeletedManagedHsm>;
}

// @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;
Expand All @@ -696,12 +732,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 {
}
Expand Down Expand Up @@ -774,12 +821,25 @@ 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;
}

// @public
export interface ManagedHsmsUpdateOptionalParams extends coreClient.OperationOptions {
resumeFrom?: string;
Expand Down Expand Up @@ -849,7 +909,6 @@ export interface MhsmPrivateEndpointConnections {
// @public
export interface MhsmPrivateEndpointConnectionsDeleteHeaders {
location?: string;
retryAfter?: number;
}

// @public
Expand Down
38 changes: 36 additions & 2 deletions sdk/keyvault/arm-keyvault/src/keyVaultManagementClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

import * as coreClient from "@azure/core-client";
import * as coreRestPipeline from "@azure/core-rest-pipeline";
import {
PipelineRequest,
PipelineResponse,
SendRequest
} from "@azure/core-rest-pipeline";
import * as coreAuth from "@azure/core-auth";
import {
KeysImpl,
Expand Down Expand Up @@ -66,7 +71,7 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient {
credential: credentials
};

const packageDetails = `azsdk-js-arm-keyvault/2.1.0-beta.1`;
const packageDetails = `azsdk-js-arm-keyvault/3.0.0`;
const userAgentPrefix =
options.userAgentOptions && options.userAgentOptions.userAgentPrefix
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
Expand Down Expand Up @@ -113,7 +118,7 @@ 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 || "2022-07-01";
this.keys = new KeysImpl(this);
this.vaults = new VaultsImpl(this);
this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this);
Expand All @@ -125,6 +130,35 @@ export class KeyVaultManagementClient extends coreClient.ServiceClient {
this.mhsmPrivateLinkResources = new MhsmPrivateLinkResourcesImpl(this);
this.operations = new OperationsImpl(this);
this.secrets = new SecretsImpl(this);
this.addCustomApiVersionPolicy(options.apiVersion);
}

/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
private addCustomApiVersionPolicy(apiVersion?: string) {
if (!apiVersion) {
return;
}
const apiVersionPolicy = {
name: "CustomApiVersionPolicy",
async sendRequest(
request: PipelineRequest,
next: SendRequest
): Promise<PipelineResponse> {
const param = request.url.split("?");
if (param.length > 1) {
const newParams = param[1].split("&").map((item) => {
if (item.indexOf("api-version") > -1) {
return item.replace(/(?<==).*$/, apiVersion);
} else {
return item;
}
});
request.url = param[0] + "?" + newParams.join("&");
}
return next(request);
}
};
this.pipeline.addPolicy(apiVersionPolicy);
}

keys: Keys;
Expand Down
Loading

0 comments on commit 892f8ff

Please sign in to comment.