Skip to content

Commit

Permalink
policy-track2 (Azure#18229)
Browse files Browse the repository at this point in the history
* policy-track2

* update

* update
  • Loading branch information
colawwj authored Oct 18, 2021
1 parent c3b75ee commit 29b6280
Show file tree
Hide file tree
Showing 27 changed files with 1,374 additions and 2,299 deletions.
12 changes: 10 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 34 additions & 9 deletions sdk/policy/arm-policy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
# Release History

## 5.0.0-beta.2 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
## 5.0.0-beta.2 (2021-10-18)

**Features**

- Added operation PolicyAssignments.update
- Added operation PolicyAssignments.updateById
- Added Interface PolicyAssignmentsUpdateByIdOptionalParams
- Added Interface PolicyAssignmentsUpdateOptionalParams
- Added Interface PolicyAssignmentUpdate
- Added Interface UserAssignedIdentitiesValue
- Added Type Alias PolicyAssignmentsUpdateByIdResponse
- Added Type Alias PolicyAssignmentsUpdateResponse
- Interface Identity has a new optional parameter userAssignedIdentities
- Interface PolicyAssignment has a new optional parameter systemData
- Interface PolicyDefinition has a new optional parameter systemData
- Interface PolicySetDefinition has a new optional parameter systemData

**Breaking Changes**

- Removed operation DataPolicyManifests.listNext
- Removed operation PolicyAssignments.listForManagementGroupNext
- Removed operation PolicyAssignments.listForResourceGroupNext
- Removed operation PolicyAssignments.listForResourceNext
- Removed operation PolicyAssignments.listNext
- Removed operation PolicyDefinitions.listBuiltInNext
- Removed operation PolicyDefinitions.listByManagementGroupNext
- Removed operation PolicyDefinitions.listNext
- Removed operation PolicyExemptions.listForManagementGroupNext
- Removed operation PolicyExemptions.listForResourceGroupNext
- Removed operation PolicyExemptions.listForResourceNext
- Removed operation PolicyExemptions.listNext
- Removed operation PolicySetDefinitions.listBuiltInNext
- Removed operation PolicySetDefinitions.listByManagementGroupNext
- Removed operation PolicySetDefinitions.listNext

## 5.0.0-beta.1 (2021-10-09)

Expand Down
20 changes: 11 additions & 9 deletions sdk/policy/arm-policy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f

To manage and control access to your resources, you can define customized policies and assign them at a scope.

[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/policy/arm-policy) |
[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/policy/arm-policy) |
[Package (NPM)](https://www.npmjs.com/package/@azure/arm-policy) |
[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-policy) |
[Samples](https://github.com/Azure-Samples/azure-samples-js-management)
Expand Down Expand Up @@ -33,17 +33,19 @@ npm install @azure/arm-policy
To create a client object to access the Azure Policy API, you will need the `endpoint` of your Azure Policy resource and a `credential`. The Azure Policy client can use Azure Active Directory credentials to authenticate.
You can find the endpoint for your Azure Policy resource in the [Azure Portal][azure_portal].

#### Using an Azure Active Directory Credential
You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).

You can authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:
To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:

```bash
npm install @azure/identity
```

You will also need to register a new AAD application and grant access to Azure Policy by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
You will also need to **register a new AAD application and grant access to Azure Policy** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions).
Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.

For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal).

```javascript
const { PolicyClient } = require("@azure/arm-policy");
const { DefaultAzureCredential } = require("@azure/identity");
Expand All @@ -64,19 +66,19 @@ const client = new PolicyClient(new DefaultAzureCredential(), subscriptionId);
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:

```javascript
import { setLogLevel } from "@azure/logger";
const { setLogLevel } = require("@azure/logger");
setLogLevel("info");
```

For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/logger).
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).

## Next steps

Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library.

## Contributing

If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) to learn more about how to build and test the code.
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.

## Related projects

Expand All @@ -88,5 +90,5 @@ If you'd like to contribute to this library, please read the [contributing guide
[azure_sub]: https://azure.microsoft.com/free/
[azure_sub]: https://azure.microsoft.com/free/
[azure_portal]: https://portal.azure.com
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential
[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity
[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential
6 changes: 3 additions & 3 deletions sdk/policy/arm-policy/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"commit": "406474c3807f2dec010af72286f22aa7a9a54920",
"commit": "62ec79080af0d0d609650d67155ef4a93ae11482",
"readme": "specification/resources/resource-manager/readme.md",
"autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --typescript-sdks-folder=/Users/zhangqiaoqiao/work/code/azure-sdk-for-js ../azure-rest-api-specs/specification/resources/resource-manager/readme.md --use=@autorest/[email protected].7",
"autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/resources/resource-manager/readme.md --use=@autorest/[email protected].13",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"use": "@autorest/[email protected].7"
"use": "@autorest/[email protected].13"
}
4 changes: 2 additions & 2 deletions sdk/policy/arm-policy/api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"mainEntryPointFilePath": "./esm/index.d.ts",
"mainEntryPointFilePath": "./dist-esm/src/index.d.ts",
"docModel": { "enabled": true },
"apiReport": { "enabled": true, "reportFolder": "./review" },
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "",
"publicTrimmedFilePath": "./esm/index.d.ts"
"publicTrimmedFilePath": "./types/arm-policy.d.ts"
},
"messages": {
"tsdocMessageReporting": { "default": { "logLevel": "none" } },
Expand Down
54 changes: 24 additions & 30 deletions sdk/policy/arm-policy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,65 @@
"author": "Microsoft Corporation",
"description": "A generated SDK for PolicyClient.",
"version": "5.0.0-beta.2",
"engines": {
"node": ">=12.0.0"
},
"engines": { "node": ">=12.0.0" },
"dependencies": {
"@azure/core-paging": "^1.1.1",
"@azure/core-client": "^1.0.0",
"@azure/core-auth": "^1.3.0",
"@azure/core-rest-pipeline": "^1.1.0",
"tslib": "^2.2.0"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"keywords": ["node", "azure", "typescript", "browser", "isomorphic"],
"license": "MIT",
"main": "./dist/index.js",
"module": "./esm/index.js",
"types": "./esm/index.d.ts",
"module": "./dist-esm/src/index.js",
"types": "./types/arm-policy.d.ts",
"devDependencies": {
"@microsoft/api-extractor": "^7.18.11",
"@microsoft/api-extractor": "7.7.11",
"@rollup/plugin-commonjs": "11.0.2",
"@rollup/plugin-json": "^4.0.0",
"@rollup/plugin-multi-entry": "^3.0.0",
"@rollup/plugin-node-resolve": "^8.0.0",
"mkdirp": "^1.0.4",
"rollup": "^1.16.3",
"rollup-plugin-sourcemaps": "^0.4.2",
"rollup-plugin-node-resolve": "^3.4.0",
"typescript": "~4.2.0",
"uglify-js": "^3.4.9"
"uglify-js": "^3.4.9",
"@azure/identity": "2.0.0-beta.6",
"@azure-tools/test-recorder": "^1.0.0",
"mocha": "^7.1.1",
"cross-env": "^7.0.2"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/policy/arm-policy",
"repository": {
"type": "git",
"url": "https://github.com/Azure/azure-sdk-for-js.git"
},
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" },
"files": [
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map",
"esm/**/*.js",
"esm/**/*.js.map",
"esm/**/*.d.ts",
"esm/**/*.d.ts.map",
"dist-esm/**/*.js",
"dist-esm/**/*.js.map",
"dist-esm/**/*.d.ts",
"dist-esm/**/*.d.ts.map",
"src/**/*.ts",
"README.md",
"LICENSE",
"rollup.config.js",
"tsconfig.json",
"review/*",
"CHANGELOG.md"
"CHANGELOG.md",
"types/*"
],
"scripts": {
"build": "tsc && rollup -c rollup.config.js && npm run minify && mkdirp ./review && npm run extract-api",
"build": "tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api",
"minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js",
"prepack": "npm run build",
"pack": "npm pack 2>&1",
"extract-api": "mkdirp ./review && api-extractor run --local",
"extract-api": "api-extractor run --local",
"lint": "echo skipped",
"audit": "echo skipped",
"clean": "echo skipped",
Expand All @@ -79,16 +73,16 @@
"check-format": "echo skipped",
"execute:samples": "echo skipped",
"format": "echo skipped",
"test": "echo skipped",
"test": "npm run integration-test",
"prebuild": "echo skipped",
"test:node": "echo skipped",
"test:browser": "echo skipped",
"unit-test": "echo skipped",
"unit-test:node": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"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",
"integration-test:browser": "echo skipped",
"integration-test:node": "echo skipped",
"integration-test": "echo skipped",
"docs": "echo skipped"
},
"sideEffects": false,
Expand Down
Loading

0 comments on commit 29b6280

Please sign in to comment.