diff --git a/sdk/recoveryservices/arm-recoveryservices/CHANGELOG.md b/sdk/recoveryservices/arm-recoveryservices/CHANGELOG.md index 9492bcd88a66..55d213cecc07 100644 --- a/sdk/recoveryservices/arm-recoveryservices/CHANGELOG.md +++ b/sdk/recoveryservices/arm-recoveryservices/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History + +## 5.1.0 (2022-07-01) + +**Features** + - Added Interface AzureMonitorAlertSettings + - Added Interface ClassicAlertSettings + - Added Interface MonitoringSettings + - Added Interface VaultPropertiesRedundancySettings + - Added Type Alias AlertsState + - Added Type Alias BackupStorageVersion + - Added Type Alias CrossRegionRestore + - Added Type Alias StandardTierStorageRedundancy + - Interface VaultProperties has a new optional parameter backupStorageVersion + - Interface VaultProperties has a new optional parameter monitoringSettings + - Interface VaultProperties has a new optional parameter redundancySettings + - Type Alias ResourceCertificateAndAadDetails has a new parameter aadAudience + - Added Enum KnownAlertsState + - Added Enum KnownBackupStorageVersion + - Added Enum KnownCrossRegionRestore + - Added Enum KnownStandardTierStorageRedundancy + ## 5.0.1 (2022-04-29) **Features** diff --git a/sdk/recoveryservices/arm-recoveryservices/_meta.json b/sdk/recoveryservices/arm-recoveryservices/_meta.json index 9336cba5f0cd..5c8e7d63be50 100644 --- a/sdk/recoveryservices/arm-recoveryservices/_meta.json +++ b/sdk/recoveryservices/arm-recoveryservices/_meta.json @@ -1,8 +1,8 @@ { - "commit": "0cd7b3e83d5e7e21222dcc4bdde4565562da0cdf", - "readme": "specification\\recoveryservices\\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\\recoveryservices\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "ccdcd98e640a312623918bd2448fd428cb7e3caf", + "readme": "specification/recoveryservices/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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/recoveryservices/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.3.0", - "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" -} + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.2", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/recoveryservices/arm-recoveryservices/package.json b/sdk/recoveryservices/arm-recoveryservices/package.json index 18a6503b3c73..1bf62fa1c5f3 100644 --- a/sdk/recoveryservices/arm-recoveryservices/package.json +++ b/sdk/recoveryservices/arm-recoveryservices/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for RecoveryServicesClient.", - "version": "5.0.1", + "version": "5.1.0", "engines": { "node": ">=12.0.0" }, @@ -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/recoveryservices/arm-recoveryservices", "repository": { @@ -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" }, @@ -107,4 +109,4 @@ ] }, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/recoveryservices/arm-recoveryservices/review/arm-recoveryservices.api.md b/sdk/recoveryservices/arm-recoveryservices/review/arm-recoveryservices.api.md index 348699776fa4..8bc1645de21f 100644 --- a/sdk/recoveryservices/arm-recoveryservices/review/arm-recoveryservices.api.md +++ b/sdk/recoveryservices/arm-recoveryservices/review/arm-recoveryservices.api.md @@ -10,9 +10,21 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { PollerLike } from '@azure/core-lro'; import { PollOperationState } from '@azure/core-lro'; +// @public +export type AlertsState = string; + // @public export type AuthType = string; +// @public +export interface AzureMonitorAlertSettings { + // (undocumented) + alertsForAllJobFailures?: AlertsState; +} + +// @public +export type BackupStorageVersion = string; + // @public export interface CertificateRequest { properties?: RawCertificateData; @@ -34,6 +46,12 @@ export interface CheckNameAvailabilityResult { reason?: string; } +// @public +export interface ClassicAlertSettings { + // (undocumented) + alertsForCriticalOperations?: AlertsState; +} + // @public export interface ClientDiscoveryDisplay { description?: string; @@ -92,6 +110,9 @@ export interface CmkKeyVaultProperties { // @public export type CreatedByType = string; +// @public +export type CrossRegionRestore = string; + // @public export interface ErrorAdditionalInfo { readonly info?: Record; @@ -141,6 +162,14 @@ export interface JobsSummary { suspendedJobs?: number; } +// @public +export enum KnownAlertsState { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + // @public export enum KnownAuthType { // (undocumented) @@ -155,6 +184,16 @@ export enum KnownAuthType { Invalid = "Invalid" } +// @public +export enum KnownBackupStorageVersion { + // (undocumented) + Unassigned = "Unassigned", + // (undocumented) + V1 = "V1", + // (undocumented) + V2 = "V2" +} + // @public export enum KnownCreatedByType { // (undocumented) @@ -167,6 +206,14 @@ export enum KnownCreatedByType { User = "User" } +// @public +export enum KnownCrossRegionRestore { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + // @public export enum KnownInfrastructureEncryptionState { // (undocumented) @@ -243,6 +290,16 @@ export enum KnownSkuName { Standard = "Standard" } +// @public +export enum KnownStandardTierStorageRedundancy { + // (undocumented) + GeoRedundant = "GeoRedundant", + // (undocumented) + LocallyRedundant = "LocallyRedundant", + // (undocumented) + ZoneRedundant = "ZoneRedundant" +} + // @public export enum KnownTriggerType { // (undocumented) @@ -287,6 +344,12 @@ export enum KnownVaultUpgradeState { Upgraded = "Upgraded" } +// @public +export interface MonitoringSettings { + azureMonitorAlertSettings?: AzureMonitorAlertSettings; + classicAlertSettings?: ClassicAlertSettings; +} + // @public export interface MonitoringSummary { deprecatedProviderCount?: number; @@ -533,6 +596,7 @@ export type ResourceCertificateAndAadDetails = ResourceCertificateDetails & { servicePrincipalObjectId: string; azureManagementEndpointAudience: string; serviceResourceId?: string; + aadAudience?: string; }; // @public @@ -577,6 +641,9 @@ export interface Sku { // @public export type SkuName = string; +// @public +export type StandardTierStorageRedundancy = string; + // @public export interface SystemData { createdAt?: Date; @@ -708,13 +775,16 @@ export type VaultPrivateEndpointState = string; // @public export interface VaultProperties { + readonly backupStorageVersion?: BackupStorageVersion; encryption?: VaultPropertiesEncryption; + monitoringSettings?: MonitoringSettings; moveDetails?: VaultPropertiesMoveDetails; readonly moveState?: ResourceMoveState; readonly privateEndpointConnections?: PrivateEndpointConnectionVaultProperties[]; readonly privateEndpointStateForBackup?: VaultPrivateEndpointState; readonly privateEndpointStateForSiteRecovery?: VaultPrivateEndpointState; readonly provisioningState?: string; + redundancySettings?: VaultPropertiesRedundancySettings; upgradeDetails?: UpgradeDetails; } @@ -734,6 +804,12 @@ export interface VaultPropertiesMoveDetails { readonly targetResourceId?: string; } +// @public +export interface VaultPropertiesRedundancySettings { + readonly crossRegionRestore?: CrossRegionRestore; + readonly standardTierStorageRedundancy?: StandardTierStorageRedundancy; +} + // @public export interface Vaults { beginCreateOrUpdate(resourceGroupName: string, vaultName: string, vault: Vault, options?: VaultsCreateOrUpdateOptionalParams): Promise, VaultsCreateOrUpdateResponse>>; diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts index c3cfcc899297..343e7402ebba 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/index.ts @@ -296,6 +296,15 @@ export interface VaultProperties { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly moveState?: ResourceMoveState; + /** + * Backup storage version + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly backupStorageVersion?: BackupStorageVersion; + /** Monitoring Settings of the vault */ + monitoringSettings?: MonitoringSettings; + /** The redundancy Settings of a Vault */ + redundancySettings?: VaultPropertiesRedundancySettings; } /** Details for upgrading vault. */ @@ -476,9 +485,41 @@ export interface VaultPropertiesMoveDetails { readonly targetResourceId?: string; } +/** Monitoring Settings of the vault */ +export interface MonitoringSettings { + /** Settings for Azure Monitor based alerts */ + azureMonitorAlertSettings?: AzureMonitorAlertSettings; + /** Settings for classic alerts */ + classicAlertSettings?: ClassicAlertSettings; +} + +/** Settings for Azure Monitor based alerts */ +export interface AzureMonitorAlertSettings { + alertsForAllJobFailures?: AlertsState; +} + +/** Settings for classic alerts */ +export interface ClassicAlertSettings { + alertsForCriticalOperations?: AlertsState; +} + +/** The redundancy Settings of a Vault */ +export interface VaultPropertiesRedundancySettings { + /** + * The storage redundancy setting of a vault + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly standardTierStorageRedundancy?: StandardTierStorageRedundancy; + /** + * Flag to show if Cross Region Restore is enabled on the Vault or not + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly crossRegionRestore?: CrossRegionRestore; +} + /** Identifies the unique system identifier for each Azure resource. */ export interface Sku { - /** The Sku name. */ + /** Name of SKU is RS0 (Recovery Services 0th version) and the tier is standard tier. They do not have affect on backend storage redundancy or any other vault settings. To manage storage redundancy, use the backupstorageconfig */ name: SkuName; /** The Sku tier. */ tier?: string; @@ -643,6 +684,8 @@ export type ResourceCertificateAndAadDetails = ResourceCertificateDetails & { azureManagementEndpointAudience: string; /** Service Resource Id. */ serviceResourceId?: string; + /** AAD audience for the resource */ + aadAudience?: string; }; /** Certificate details representing the Vault credentials for ACS. */ @@ -892,6 +935,74 @@ export enum KnownResourceMoveState { */ export type ResourceMoveState = string; +/** Known values of {@link BackupStorageVersion} that the service accepts. */ +export enum KnownBackupStorageVersion { + V1 = "V1", + V2 = "V2", + Unassigned = "Unassigned" +} + +/** + * Defines values for BackupStorageVersion. \ + * {@link KnownBackupStorageVersion} can be used interchangeably with BackupStorageVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **V1** \ + * **V2** \ + * **Unassigned** + */ +export type BackupStorageVersion = string; + +/** Known values of {@link AlertsState} that the service accepts. */ +export enum KnownAlertsState { + Enabled = "Enabled", + Disabled = "Disabled" +} + +/** + * Defines values for AlertsState. \ + * {@link KnownAlertsState} can be used interchangeably with AlertsState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type AlertsState = string; + +/** Known values of {@link StandardTierStorageRedundancy} that the service accepts. */ +export enum KnownStandardTierStorageRedundancy { + LocallyRedundant = "LocallyRedundant", + GeoRedundant = "GeoRedundant", + ZoneRedundant = "ZoneRedundant" +} + +/** + * Defines values for StandardTierStorageRedundancy. \ + * {@link KnownStandardTierStorageRedundancy} can be used interchangeably with StandardTierStorageRedundancy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **LocallyRedundant** \ + * **GeoRedundant** \ + * **ZoneRedundant** + */ +export type StandardTierStorageRedundancy = string; + +/** Known values of {@link CrossRegionRestore} that the service accepts. */ +export enum KnownCrossRegionRestore { + Enabled = "Enabled", + Disabled = "Disabled" +} + +/** + * Defines values for CrossRegionRestore. \ + * {@link KnownCrossRegionRestore} can be used interchangeably with CrossRegionRestore, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled** \ + * **Disabled** + */ +export type CrossRegionRestore = string; + /** Known values of {@link SkuName} that the service accepts. */ export enum KnownSkuName { Standard = "Standard", diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts index 78daad1c3e4b..ac2c711e56f4 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/mappers.ts @@ -677,6 +677,27 @@ export const VaultProperties: coreClient.CompositeMapper = { type: { name: "String" } + }, + backupStorageVersion: { + serializedName: "backupStorageVersion", + readOnly: true, + type: { + name: "String" + } + }, + monitoringSettings: { + serializedName: "monitoringSettings", + type: { + name: "Composite", + className: "MonitoringSettings" + } + }, + redundancySettings: { + serializedName: "redundancySettings", + type: { + name: "Composite", + className: "VaultPropertiesRedundancySettings" + } } } } @@ -983,6 +1004,82 @@ export const VaultPropertiesMoveDetails: coreClient.CompositeMapper = { } }; +export const MonitoringSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MonitoringSettings", + modelProperties: { + azureMonitorAlertSettings: { + serializedName: "azureMonitorAlertSettings", + type: { + name: "Composite", + className: "AzureMonitorAlertSettings" + } + }, + classicAlertSettings: { + serializedName: "classicAlertSettings", + type: { + name: "Composite", + className: "ClassicAlertSettings" + } + } + } + } +}; + +export const AzureMonitorAlertSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureMonitorAlertSettings", + modelProperties: { + alertsForAllJobFailures: { + serializedName: "alertsForAllJobFailures", + type: { + name: "String" + } + } + } + } +}; + +export const ClassicAlertSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClassicAlertSettings", + modelProperties: { + alertsForCriticalOperations: { + serializedName: "alertsForCriticalOperations", + type: { + name: "String" + } + } + } + } +}; + +export const VaultPropertiesRedundancySettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VaultPropertiesRedundancySettings", + modelProperties: { + standardTierStorageRedundancy: { + serializedName: "standardTierStorageRedundancy", + readOnly: true, + type: { + name: "String" + } + }, + crossRegionRestore: { + serializedName: "crossRegionRestore", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const Sku: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1447,6 +1544,12 @@ export const ResourceCertificateAndAadDetails: coreClient.CompositeMapper = { type: { name: "String" } + }, + aadAudience: { + serializedName: "aadAudience", + type: { + name: "String" + } } } } diff --git a/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts b/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts index 6d7fe290fa10..3295d24ccce6 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/models/parameters.ts @@ -74,7 +74,7 @@ export const subscriptionId: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-08-01", + defaultValue: "2022-04-01", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts index fbeb38fc6339..09913efcad14 100644 --- a/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts +++ b/sdk/recoveryservices/arm-recoveryservices/src/recoveryServicesClient.ts @@ -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 { VaultCertificatesImpl, @@ -73,7 +78,7 @@ export class RecoveryServicesClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-recoveryservices/5.0.1`; + const packageDetails = `azsdk-js-arm-recoveryservices/5.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -120,7 +125,7 @@ export class RecoveryServicesClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-08-01"; + this.apiVersion = options.apiVersion || "2022-04-01"; this.vaultCertificates = new VaultCertificatesImpl(this); this.registeredIdentities = new RegisteredIdentitiesImpl(this); this.replicationUsages = new ReplicationUsagesImpl(this); @@ -132,6 +137,35 @@ export class RecoveryServicesClient extends coreClient.ServiceClient { this.operations = new OperationsImpl(this); this.vaultExtendedInfo = new VaultExtendedInfoImpl(this); this.usages = new UsagesImpl(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 { + 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); } /** diff --git a/sdk/recoveryservices/arm-recoveryservices/test/sampleTest.ts b/sdk/recoveryservices/arm-recoveryservices/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/recoveryservices/arm-recoveryservices/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!"); + }); +});