diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 3d649a2e213e..a86548d1383a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -13614,17 +13614,19 @@ packages: dev: false file:projects/arm-policyinsights.tgz: - resolution: {integrity: sha512-dByhV2Yd60m158bMSEktDcv2/O9EdnO8cfbP3vii8iuys8lOU6zAK8epOtWsV0n/40gProVOSCAiVnn1AeGG0A==, tarball: file:projects/arm-policyinsights.tgz} + resolution: {integrity: sha512-myOe3SC48EHvXAbWiZa2wafS8gZIbdLkqO2OJHesosmUm6+tEacXbBWhiD4djXjibdIxQa3AZW3qGpxfE0NuQg==, tarball: file:projects/arm-policyinsights.tgz} name: '@rush-temp/arm-policyinsights' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@azure/identity': 2.1.0 - '@microsoft/api-extractor': 7.31.2 + '@microsoft/api-extractor': 7.18.11 '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 '@rollup/plugin-json': 4.1.0_rollup@2.79.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.3 + chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 @@ -13636,7 +13638,6 @@ packages: uglify-js: 3.17.2 transitivePeerDependencies: - '@types/node' - - encoding - supports-color dev: false diff --git a/sdk/policyinsights/arm-policyinsights/CHANGELOG.md b/sdk/policyinsights/arm-policyinsights/CHANGELOG.md index 408c6472974c..3a577669e335 100644 --- a/sdk/policyinsights/arm-policyinsights/CHANGELOG.md +++ b/sdk/policyinsights/arm-policyinsights/CHANGELOG.md @@ -1,21 +1,13 @@ # Release History - -## 6.0.0-beta.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 6.0.0-beta.1 (2022-03-31) + +## 6.0.0-beta.2 (2022-09-30) **Features** - Added operation PolicyRestrictions.checkAtManagementGroupScope + - Added Interface Attestation - Added Interface CheckManagementGroupRestrictionsRequest + - Added Interface PolicyMetadataProperties - Added Interface PolicyRestrictionsCheckAtManagementGroupScopeOptionalParams - Added Type Alias PolicyEventsResourceType - Added Type Alias PolicyRestrictionsCheckAtManagementGroupScopeResponse diff --git a/sdk/policyinsights/arm-policyinsights/README.md b/sdk/policyinsights/arm-policyinsights/README.md index eadf51b0ae2d..f2e95d563695 100644 --- a/sdk/policyinsights/arm-policyinsights/README.md +++ b/sdk/policyinsights/arm-policyinsights/README.md @@ -13,7 +13,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f ### Currently supported environments -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- [LTS versions of Node.js](https://nodejs.org/about/releases/) - Latest versions of Safari, Chrome, Edge and Firefox. See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. diff --git a/sdk/policyinsights/arm-policyinsights/_meta.json b/sdk/policyinsights/arm-policyinsights/_meta.json index 1aa6e25fc5f9..26446d0bf416 100644 --- a/sdk/policyinsights/arm-policyinsights/_meta.json +++ b/sdk/policyinsights/arm-policyinsights/_meta.json @@ -1,8 +1,8 @@ { - "commit": "3c1da29166fe1306071c939ac1344b092bafd0ce", + "commit": "4994cbed850f3726721ec6fd3235a474e8d08fcc", "readme": "specification/policyinsights/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\\policyinsights\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.18.20220329.1 --generate-sample=true", + "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=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/policyinsights/resource-manager/readme.md --use=@autorest/typescript@6.0.0-rc.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.1", - "use": "@autorest/typescript@6.0.0-alpha.18.20220329.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.3", + "use": "@autorest/typescript@6.0.0-rc.1" } \ No newline at end of file diff --git a/sdk/policyinsights/arm-policyinsights/package.json b/sdk/policyinsights/arm-policyinsights/package.json index 8e12857e72fe..2f0022ab7eec 100644 --- a/sdk/policyinsights/arm-policyinsights/package.json +++ b/sdk/policyinsights/arm-policyinsights/package.json @@ -11,9 +11,9 @@ "@azure/core-lro": "^2.2.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.0.0", + "@azure/core-client": "^1.5.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.1.0", + "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" }, "keywords": [ @@ -28,7 +28,7 @@ "module": "./dist-esm/src/index.js", "types": "./types/arm-policyinsights.d.ts", "devDependencies": { - "@microsoft/api-extractor": "^7.31.1", + "@microsoft/api-extractor": "7.18.11", "@rollup/plugin-commonjs": "^21.0.1", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-multi-entry": "^4.1.0", @@ -40,9 +40,13 @@ "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" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/policyinsights/arm-policyinsights", "repository": { @@ -93,9 +97,8 @@ "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:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -106,13 +109,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-policyinsights?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/policyinsights/arm-policyinsights/review/arm-policyinsights.api.md b/sdk/policyinsights/arm-policyinsights/review/arm-policyinsights.api.md index a087a293df33..82fbb274adc1 100644 --- a/sdk/policyinsights/arm-policyinsights/review/arm-policyinsights.api.md +++ b/sdk/policyinsights/arm-policyinsights/review/arm-policyinsights.api.md @@ -11,18 +11,20 @@ import { PollerLike } from '@azure/core-lro'; import { PollOperationState } from '@azure/core-lro'; // @public -export type Attestation = Resource & { - readonly systemData?: SystemData; - policyAssignmentId: string; - policyDefinitionReferenceId?: string; +export interface Attestation extends Resource { + assessmentDate?: Date; + comments?: string; complianceState?: ComplianceState; + evidence?: AttestationEvidence[]; expiresOn?: Date; + readonly lastComplianceStateChangeAt?: Date; + metadata?: Record; owner?: string; - comments?: string; - evidence?: AttestationEvidence[]; + policyAssignmentId: string; + policyDefinitionReferenceId?: string; readonly provisioningState?: string; - readonly lastComplianceStateChangeAt?: Date; -}; + readonly systemData?: SystemData; +} // @public export interface AttestationEvidence { @@ -312,13 +314,9 @@ export enum KnownComplianceState { // @public export enum KnownCreatedByType { - // (undocumented) Application = "Application", - // (undocumented) Key = "Key", - // (undocumented) ManagedIdentity = "ManagedIdentity", - // (undocumented) User = "User" } @@ -331,27 +329,22 @@ export enum KnownFieldRestrictionResult { // @public export enum KnownPolicyEventsResourceType { - // (undocumented) Default = "default" } // @public export enum KnownPolicyStatesResource { - // (undocumented) Default = "default", - // (undocumented) Latest = "latest" } // @public export enum KnownPolicyStatesSummaryResourceType { - // (undocumented) Latest = "latest" } // @public export enum KnownPolicyTrackedResourcesResourceType { - // (undocumented) Default = "default" } @@ -715,10 +708,10 @@ export interface PolicyMetadataOperations { } // @public -export type PolicyMetadataProperties = PolicyMetadataSlimProperties & { +export interface PolicyMetadataProperties extends PolicyMetadataSlimProperties { readonly description?: string; readonly requirements?: string; -}; +} // @public export interface PolicyMetadataSlimProperties { diff --git a/sdk/policyinsights/arm-policyinsights/src/models/index.ts b/sdk/policyinsights/arm-policyinsights/src/models/index.ts index 023894da5a0e..9b48cabbaf98 100644 --- a/sdk/policyinsights/arm-policyinsights/src/models/index.ts +++ b/sdk/policyinsights/arm-policyinsights/src/models/index.ts @@ -1113,7 +1113,7 @@ export interface ErrorDefinitionAutoGenerated2 { } /** The properties of the policy metadata. */ -export type PolicyMetadataProperties = PolicyMetadataSlimProperties & { +export interface PolicyMetadataProperties extends PolicyMetadataSlimProperties { /** * The description of the policy metadata. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -1124,10 +1124,10 @@ export type PolicyMetadataProperties = PolicyMetadataSlimProperties & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly requirements?: string; -}; +} /** An attestation resource. */ -export type Attestation = Resource & { +export interface Attestation extends Resource { /** * Azure Resource Manager metadata containing createdBy and modifiedBy information. * NOTE: This property will not be serialized. It can only be populated by the server. @@ -1157,7 +1157,11 @@ export type Attestation = Resource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastComplianceStateChangeAt?: Date; -}; + /** The time the evidence was assessed */ + assessmentDate?: Date; + /** Additional metadata for this attestation */ + metadata?: Record; +} /** Parameter group */ export interface QueryOptions { @@ -1183,6 +1187,7 @@ export interface QueryOptions { /** Known values of {@link PolicyTrackedResourcesResourceType} that the service accepts. */ export enum KnownPolicyTrackedResourcesResourceType { + /** Default */ Default = "default" } @@ -1215,9 +1220,13 @@ export type ResourceDiscoveryMode = string; /** Known values of {@link CreatedByType} that the service accepts. */ export enum KnownCreatedByType { + /** User */ User = "User", + /** Application */ Application = "Application", + /** ManagedIdentity */ ManagedIdentity = "ManagedIdentity", + /** Key */ Key = "Key" } @@ -1235,6 +1244,7 @@ export type CreatedByType = string; /** Known values of {@link PolicyEventsResourceType} that the service accepts. */ export enum KnownPolicyEventsResourceType { + /** Default */ Default = "default" } @@ -1249,7 +1259,9 @@ export type PolicyEventsResourceType = string; /** Known values of {@link PolicyStatesResource} that the service accepts. */ export enum KnownPolicyStatesResource { + /** Default */ Default = "default", + /** Latest */ Latest = "latest" } @@ -1265,6 +1277,7 @@ export type PolicyStatesResource = string; /** Known values of {@link PolicyStatesSummaryResourceType} that the service accepts. */ export enum KnownPolicyStatesSummaryResourceType { + /** Latest */ Latest = "latest" } diff --git a/sdk/policyinsights/arm-policyinsights/src/models/mappers.ts b/sdk/policyinsights/arm-policyinsights/src/models/mappers.ts index 167d6bd2cc96..5546ecf73f9e 100644 --- a/sdk/policyinsights/arm-policyinsights/src/models/mappers.ts +++ b/sdk/policyinsights/arm-policyinsights/src/models/mappers.ts @@ -2589,6 +2589,19 @@ export const Attestation: coreClient.CompositeMapper = { type: { name: "DateTime" } + }, + assessmentDate: { + serializedName: "properties.assessmentDate", + type: { + name: "DateTime" + } + }, + metadata: { + serializedName: "properties.metadata", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } } } } diff --git a/sdk/policyinsights/arm-policyinsights/src/models/parameters.ts b/sdk/policyinsights/arm-policyinsights/src/models/parameters.ts index 195eefce6a97..025c45f79031 100644 --- a/sdk/policyinsights/arm-policyinsights/src/models/parameters.ts +++ b/sdk/policyinsights/arm-policyinsights/src/models/parameters.ts @@ -431,7 +431,7 @@ export const parameters2: OperationParameter = { export const apiVersion4: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-01-01", + defaultValue: "2022-09-01", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/policyinsights/arm-policyinsights/src/policyInsightsClient.ts b/sdk/policyinsights/arm-policyinsights/src/policyInsightsClient.ts index 56c8a738e6fa..7da088a7800a 100644 --- a/sdk/policyinsights/arm-policyinsights/src/policyInsightsClient.ts +++ b/sdk/policyinsights/arm-policyinsights/src/policyInsightsClient.ts @@ -7,6 +7,7 @@ */ import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { PolicyTrackedResourcesImpl, @@ -80,6 +81,29 @@ export class PolicyInsightsClient extends coreClient.ServiceClient { options.endpoint ?? options.baseUri ?? "https://management.azure.com" }; super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } // Parameter assignments this.subscriptionId = subscriptionId; diff --git a/sdk/policyinsights/arm-policyinsights/test/sampleTest.ts b/sdk/policyinsights/arm-policyinsights/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/policyinsights/arm-policyinsights/test/sampleTest.ts +++ b/sdk/policyinsights/arm-policyinsights/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - 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" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +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() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/policyinsights/arm-policyinsights/tsconfig.json b/sdk/policyinsights/arm-policyinsights/tsconfig.json index 41da3f3f38bc..3e6ae96443f3 100644 --- a/sdk/policyinsights/arm-policyinsights/tsconfig.json +++ b/sdk/policyinsights/arm-policyinsights/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-policyinsights": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"