diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e9cec71eccab..5572eb8785d1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -9219,7 +9219,7 @@ packages: dev: false file:projects/arm-locks.tgz: - resolution: {integrity: sha512-Mh2K3/qtCk0subKuIb8mJpqw06b2umM15k5VAv9/FlyGUkg+L+Y4l66LFzZ0jZ7CUZQ7iiCdaAReDHaFFBfKhg==, tarball: file:projects/arm-locks.tgz} + resolution: {integrity: sha512-0Qahks7SI2QPbAb0Sz5jVOFBHCj7pVW09BWU6pEbAoco3AVRDysIT3W6GzwfijdoGQsFC9tvDKRx1Od+Qxzobg==, tarball: file:projects/arm-locks.tgz} name: '@rush-temp/arm-locks' version: 0.0.0 dependencies: @@ -9228,7 +9228,10 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@1.32.1 '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 rollup: 1.32.1 rollup-plugin-node-resolve: 3.4.0 rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 @@ -10525,7 +10528,7 @@ packages: dev: false file:projects/core-client-1.tgz: - resolution: {integrity: sha512-QaeQvylrF11K0BFVJrRaCxuiREwZB4Der1ouLAQ+al+jA2T3gue2BqUEOZ7PBOPqBJSnF9G3C22PhD0zrqZwhQ==, tarball: file:projects/core-client-1.tgz} + resolution: {integrity: sha512-uT5cnoJ29hlOhdzBgjlTt9Z4g/MU5mdyzsFBg+wpkFxdhGvoAiNcTjErOSjs+5UHjxt5QJdyro+poWQitpzYJg==, tarball: file:projects/core-client-1.tgz} name: '@rush-temp/core-client-1' version: 0.0.0 dependencies: diff --git a/sdk/locks/arm-locks/CHANGELOG.md b/sdk/locks/arm-locks/CHANGELOG.md index 2e280792de72..8ccf29282d45 100644 --- a/sdk/locks/arm-locks/CHANGELOG.md +++ b/sdk/locks/arm-locks/CHANGELOG.md @@ -1,26 +1,11 @@ # Release History + +## 2.0.0 (2021-12-07) -## 2.0.0-beta.2 (Unreleased) +The package of @azure/arm-locks is using our next generation design principles since version 2.0.0, which contains breaking changes. -### Features Added +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). -### Breaking Changes +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). -### Bugs Fixed - -### Other Changes - -## 2.0.0-beta.1 (2021-10-09) - -This is the first preview for the new version of the `@azure/arm-locks` package that follows the new [guidelines for TypeScript SDKs](https://azure.github.io/azure-sdk/typescript_introduction.html) for Azure services. - -While this package remains auto generated, the SDK generator itself has undergone changes to comply with the above guidelines in order to generate packages that are idiomatic to the JavaScript/TypeScript ecosystem and consistent with other packages for Azure services. For more on this, please see [State of the Azure SDK 2021](https://devblogs.microsoft.com/azure-sdk/state-of-the-azure-sdk-2021/). - -Please note that this version has breaking changes, all of which were made after careful consideration during the authoring of the guidelines and user studies. - -**Noteworthy changes and features** -- Authentication: The packages `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` are no longer supported. Use package [@azure/identity](https://www.npmjs.com/package/@azure/identity) instead. Select a credential from Azure Identity examples based on the authentication method of your choice. -- Callbacks: Method overloads that used callbacks have been removed and the use of promises is encouraged instead. -- List operations now return an iterable result that follows the `PagedAsyncIterableIterator` interface as opposed to the previous model where you had to make a new request using the link to the next page. -- Long running operations i.e. the Lro related object returned by methods whose names started with `begin`, now uses `pollUntilDone` to check whether the request is finished, instead of `pollUntilFinished`. To get the final result, use the corresponding method that will have the suffix `AndWait`. -- The SDK only supports ECMAScript 2015 (ES6) and beyond, all projects that referenced this SDK should be upgraded to use ES6. +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/locks/arm-locks/README.md b/sdk/locks/arm-locks/README.md index bed5fab67572..938cd66fb5cd 100644 --- a/sdk/locks/arm-locks/README.md +++ b/sdk/locks/arm-locks/README.md @@ -4,7 +4,7 @@ This package contains an isomorphic SDK (runs both in Node.js and in browsers) f Azure resources can be locked to prevent other users in your organization from deleting or modifying resources. -[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/locks/arm-locks) | +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/locks/arm-locks) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-locks) | [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-locks) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) @@ -33,17 +33,19 @@ npm install @azure/arm-locks To create a client object to access the Azure ManagementLock API, you will need the `endpoint` of your Azure ManagementLock resource and a `credential`. The Azure ManagementLock client can use Azure Active Directory credentials to authenticate. You can find the endpoint for your Azure ManagementLock 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 ManagementLock 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 ManagementLock** 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 { ManagementLockClient } = require("@azure/arm-locks"); const { DefaultAzureCredential } = require("@azure/identity"); @@ -51,6 +53,10 @@ const subscriptionId = "00000000-0000-0000-0000-000000000000"; const client = new ManagementLockClient(new DefaultAzureCredential(), subscriptionId); ``` + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + ## Key concepts ### ManagementLockClient @@ -64,11 +70,11 @@ const client = new ManagementLockClient(new DefaultAzureCredential(), subscripti 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 @@ -76,7 +82,7 @@ Please take a look at the [samples](https://github.com/Azure-Samples/azure-sampl ## 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 @@ -88,5 +94,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 diff --git a/sdk/locks/arm-locks/_meta.json b/sdk/locks/arm-locks/_meta.json index 9e4f635fc0f5..0551b4fe18f8 100644 --- a/sdk/locks/arm-locks/_meta.json +++ b/sdk/locks/arm-locks/_meta.json @@ -1,7 +1,7 @@ { - "commit": "67a9b5cfd758cc34df44aeca888d72418a482a03", + "commit": "a42f1b58607091c4f255ead152a8ef323fa0b280", "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=E:\\projects\\azure-sdk-for-js ../azure-rest-api-specs/specification/resources/resource-manager/readme.md --use=@autorest/typescript@6.0.0-beta.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/typescript@6.0.0-alpha.16.20211130.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-beta.7" + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" } \ No newline at end of file diff --git a/sdk/locks/arm-locks/api-extractor.json b/sdk/locks/arm-locks/api-extractor.json index 5fb5b21b56f2..e46bea0263c1 100644 --- a/sdk/locks/arm-locks/api-extractor.json +++ b/sdk/locks/arm-locks/api-extractor.json @@ -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-locks.d.ts" }, "messages": { "tsdocMessageReporting": { "default": { "logLevel": "none" } }, diff --git a/sdk/locks/arm-locks/package.json b/sdk/locks/arm-locks/package.json index d7059c8d35f1..fb8558ba8dfc 100644 --- a/sdk/locks/arm-locks/package.json +++ b/sdk/locks/arm-locks/package.json @@ -3,28 +3,20 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ManagementLockClient.", - "version": "2.0.0-beta.2", - "engines": { - "node": ">=12.0.0" - }, + "version": "2.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/core-paging": "^1.1.1", + "@azure/core-paging": "^1.2.0", "@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-locks.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", "@rollup/plugin-commonjs": "11.0.2", @@ -34,44 +26,47 @@ "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", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@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/locks/arm-locks", "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": "npm run clean && 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", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -79,16 +74,15 @@ "check-format": "echo skipped", "execute:samples": "echo skipped", "format": "echo skipped", - "test": "echo skipped", - "prebuild": "echo skipped", + "test": "npm run integration-test", "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 --reporter ../../../common/tools/mocha-multi-reporter.js", "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", - "integration-test": "echo skipped", "docs": "echo skipped" }, "sideEffects": false, diff --git a/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_create_test.js b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_create_test.js new file mode 100644 index 000000000000..4eae47db9d2c --- /dev/null +++ b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_create_test.js @@ -0,0 +1,141 @@ +let nock = require('nock'); + +module.exports.hash = "ccc3afb536ce7c3b7f73d01aa12e8cca"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'ab48952f-be14-4f85-a1c5-d40e2a6d5e00', + 'x-ms-ests-server', + '2.1.12231.9 - KRSLR1 ProdSlices', + 'Set-Cookie', + 'fpc=Ak8m5Dheyf9MnoGYd9njRSk; expires=Thu, 06-Jan-2022 08:21:12 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrtWEvQAENYqnPdw6OCboEq2Mu1wUOFVQIbTV76tkUTFTc9hbVLNLicPjxXe3CIxNNiI9-c41acdmBdlW2ys8_q3XrOZmYvORA3zDSt5foCyj_mmK_HfNlgWWVzMC8TBd_53pbM0Yy-vyhF5zJIgZadic32MIb40B9eWOZRJTxvnggAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:12 GMT', + 'Content-Length', + '980' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '32611baa-0e55-4518-866d-8b424d0c2400', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR1 ProdSlices', + 'Set-Cookie', + 'fpc=Aui_60ZiMx5Kpl_YCaQRE0g; expires=Thu, 06-Jan-2022 08:21:12 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr0jyJgKugjjbHeMtXEZMGa8H5rkZ0t4bgTTDUVklL61mKjhOJHWXz85uBqcJmGtMJQ2cWul4UFgS4LEZO4LB3ZGsswYrJQ6inWgne0YAeRoZ4iVAH9vfcUnzibRgFjINklb7S1lT6VhWBt0AedL50tcPI8v3kSXRZtpL8Td2fHp4gAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:12 GMT', + 'Content-Length', + '1753' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.3&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=381fbe5d-7902-4b78-84cf-68b8fc00d74d&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22cp1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '358d865e-2f1f-4436-ab98-a69547d62200', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR1 ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=As_MMnm9pLpAhiiOy_mqwa4WPr5BAQAAAHgQQdkOAAAA; expires=Thu, 06-Jan-2022 08:21:12 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:12 GMT', + 'Content-Length', + '1374' +]); + +nock('https://management.azure.com:443', {"encodedQueryParams":true}) + .put('/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks/jslockrg', {"properties":{"level":"CanNotDelete"}}) + .query(true) + .reply(201, {"properties":{"level":"CanNotDelete"},"id":"/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks/jslockrg","type":"Microsoft.Authorization/locks","name":"jslockrg"}, [ + 'Cache-Control', + 'no-cache', + 'Pragma', + 'no-cache', + 'Content-Length', + '204', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'x-ms-request-id', + 'koreasouth:5c78789f-0504-4273-95dd-984b2b902035', + 'x-ms-ratelimit-remaining-subscription-writes', + '1199', + 'x-ms-correlation-request-id', + 'd37e3031-318a-41cb-8b35-eb47c768d26f', + 'x-ms-routing-request-id', + 'KOREASOUTH:20211207T082113Z:d37e3031-318a-41cb-8b35-eb47c768d26f', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Date', + 'Tue, 07 Dec 2021 08:21:13 GMT' +]); diff --git a/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_delete_test.js b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_delete_test.js new file mode 100644 index 000000000000..ad0c5e94edfc --- /dev/null +++ b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_delete_test.js @@ -0,0 +1,173 @@ +let nock = require('nock'); + +module.exports.hash = "e9b0c9a51fb5becf3da930517646f136"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'e8e998e0-2ac6-42fc-8b43-fc0ce68d1c00', + 'x-ms-ests-server', + '2.1.12249.17 - KRSLR2 ProdSlices', + 'Set-Cookie', + 'fpc=AtopRfObbtNNqG9TM3I9VD8; expires=Thu, 06-Jan-2022 08:21:15 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrkBmmoUp5TIzMnQrqoYS7Tn8iOtlhMszgdw7wWG48hjf3xivPC4V3CVXIj2k4RMec84b0kZsB77vzM1CyRoTeaRRPrEEyr9fW0xVmPW9RsqrNiky78tRhIK4zKgE0p6_uKL3LxLfbMnDtLlJdIOujLOQEVWlT-lpfn2yM0vzqtMYgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT', + 'Content-Length', + '980' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + 'd4769a5f-226a-4171-b89c-68283c082500', + 'x-ms-ests-server', + '2.1.12249.17 - KRSLR2 ProdSlices', + 'Set-Cookie', + 'fpc=Al1dnWXJcnNAm0vNXQZ1mpc; expires=Thu, 06-Jan-2022 08:21:15 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrg2_FXR3irpCDvqRHyzsHxyh7-ionatyNVpf3dB3EYvbLbtPYNsRr9R_-Fz82jLNgbMHA8aplw3yVaqNqjRVxApDXvRWW4cAQkk29QllRl421atZc2tCtr0w5M-Y0ZDtaFCCbp6psY51oCFk8TMzDoKPOrEAp-6h4jT7emknhRTMgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT', + 'Content-Length', + '1753' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.3&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=16b00425-a4fe-4a1a-aec8-94cd707d5d03&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22cp1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '7f8e1141-e4e2-45ca-8b1f-6af10d268e00', + 'x-ms-ests-server', + '2.1.12249.17 - KRSLR1 ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=AsyO-jJZDqpKjYLEzAe3iwEWPr5BAQAAAHsQQdkOAAAA; expires=Thu, 06-Jan-2022 08:21:15 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:15 GMT', + 'Content-Length', + '1374' +]); + +nock('https://management.azure.com:443', {"encodedQueryParams":true}) + .delete('/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks/jslockrg') + .query(true) + .reply(200, "", [ + 'Cache-Control', + 'no-cache', + 'Pragma', + 'no-cache', + 'Expires', + '-1', + 'x-ms-request-id', + 'koreasouth:463490c1-0365-42e4-9f0d-621322ffb4db', + 'x-ms-ratelimit-remaining-subscription-deletes', + '14999', + 'x-ms-correlation-request-id', + 'f6a92709-5a09-4e25-9cf3-1c468aab1b31', + 'x-ms-routing-request-id', + 'KOREASOUTH:20211207T082116Z:f6a92709-5a09-4e25-9cf3-1c468aab1b31', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Date', + 'Tue, 07 Dec 2021 08:21:15 GMT', + 'Content-Length', + '0' +]); + +nock('https://management.azure.com:443', {"encodedQueryParams":true}) + .get('/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks') + .query(true) + .reply(200, ["1f8b0800000000000400edbd07601c499625262f6dca7b7f4af54ad7e074a10880601324d8904010ecc188cde692ec1d69472329ab2a81ca6556655d661640cced9dbcf7de7befbdf7de7befbdf7ba3b9d4e27f7dfff3f5c6664016cf6ce4adac99e2180aac81f3f7e7c1f3f227ef1479759b9ce3f7af4bd5ffcd1aaae5679dd1679f3d1a35ffc51995fe6e5478f3e3ac9962faaf6695ee66dfed1e8a365d5e2fb8f5e9679d6e4e9ac4ae99374c65fa7edbc68d2af9abc4e8f9ba6b858e6b3f46c962fdba2bd4e8b257d9da7c73f789d4f5f66d3b7c7ebb63aa996e7c5c5abcfd33a6faa753dcdd38bba5aafd2ac71ed52d790ba59e5cb599356805534e38f7ec9e8a36246d8dc6dd693665a17abb6a896cddd877be70fefcf0eceb7ef4d3f7db0bdbfbbb7bffd7077fa60fb607abef3603a9b9cefedefde357d7297cd5ddba1ebefd5e777892697c52caf9bbb5f14d3ba6aaaf376fc45b6cc2ef29919d9dd350dd88c573f241ac6007e75bc4d546bd7cd5e1430359c5775f1830ca3b85b56d3b7cd5d9ffccfe993ed8d606982daeb154de7471ba152b365b640b3f704ff4b463f6213edd0f5f7b3c1265739133c0a981a7627f4b66ca26069827e56d8c480ff119bd80e5d7f3f1b6c4254238247e152bbee7cde964b042a4dcfcf0a9328f41ff188edd0f5f7b3c123d4673b9f52a33a2bbf795e09a1d374fdacf04ca7975ff2fd5f","f2ff0089bf8972b9080000"], [ + 'Cache-Control', + 'no-cache', + 'Pragma', + 'no-cache', + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Content-Encoding', + 'gzip', + 'Expires', + '-1', + 'Vary', + 'Accept-Encoding,Accept-Encoding', + 'x-ms-request-id', + 'koreasouth:155c6d2d-75e2-4629-bcf8-9cbef8053172', + 'x-ms-ratelimit-remaining-subscription-reads', + '11997', + 'x-ms-correlation-request-id', + '4c1a3fd3-edbc-4b58-8c12-06d9dd9bab2f', + 'x-ms-routing-request-id', + 'KOREASOUTH:20211207T082116Z:4c1a3fd3-edbc-4b58-8c12-06d9dd9bab2f', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Date', + 'Tue, 07 Dec 2021 08:21:15 GMT' +]); diff --git a/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_get_test.js b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_get_test.js new file mode 100644 index 000000000000..2f42046c9c14 --- /dev/null +++ b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_get_test.js @@ -0,0 +1,145 @@ +let nock = require('nock'); + +module.exports.hash = "eae1c63ae87964a3dd8373c0fa013ed2"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '951744ed-b7a5-463d-b723-5794e4041600', + 'x-ms-ests-server', + '2.1.12231.9 - SEASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=Ano2d9QIAZ9Htuw0snFlbGM; expires=Thu, 06-Jan-2022 08:21:13 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr5FS52hN00ry-K-y80M6bhsK34v7wb2C96G7Ma_Dlat4fIVgvi-ud7f2dykyuSLm4XZhxWCUoicrZMbs8xsLaW0Z4OGf_WWpGw4iBFJZa18pGJVkbgQ4hWr7C90Bgc-7Y9jemjogVh7n2UPGohOk_60Fb9qq43pkSYG2jzM9Bup8gAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:13 GMT', + 'Content-Length', + '980' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '2d6b480c-87f5-48fd-8a07-91c204751f00', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=Aox10tP-a4hAmLy-dUBr6Qs; expires=Thu, 06-Jan-2022 08:21:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrnBbzeu4e2I4gf_3S1-OiYs5OLm3bo6t_59f2zAHpFV8gyx9-yYd5BYjW2kXSGBkEdvRgTZLNdnpNq9SB9JEjDEaqbSu7H-CbBeFYVl-pRlXYh2ikJR1ATKfE3v-udZlYFFgcCqENZWnYtxC7Lpu-AcDK-E97OuNCtc001KoDKekgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:13 GMT', + 'Content-Length', + '1753' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.3&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=ec7a382f-bc92-4533-8756-afd9836064a0&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22cp1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '32611baa-0e55-4518-866d-8b42af0c2400', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR1 ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=AnjkOT9l_UtDow-tiiNPdSAWPr5BAQAAAHkQQdkOAAAA; expires=Thu, 06-Jan-2022 08:21:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:13 GMT', + 'Content-Length', + '1374' +]); + +nock('https://management.azure.com:443', {"encodedQueryParams":true}) + .get('/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks/jslockrg') + .query(true) + .reply(200, ["1f8b0800000000000400edbd07601c499625262f6dca7b7f4af54ad7e074a10880601324d8904010ecc188cde692ec1d69472329ab2a81ca6556655d661640cced9dbcf7de7befbdf7de7befbdf7ba3b9d4e27f7dfff3f5c6664016cf6ce4adac99e2180aac81f3f7e7c1f3f227ef147abba5ae5755be4cd478f7ef147657e99971f3dfae8245bbea8daa77999b7f947bf64f45131a30fef36eb4933ad8b555b54cbe6eec3bdf387f76707e7dbf7a69f3ed8dedfdddbdf7eb83b7db07d303ddf79309d4dcef7f677ef12f8cb6296d7cddd2f8a695d35d5793b3e5eb7f3aa2e7e9001ceddb29abe6deefe74839ff5c547a38fdaeb554ebd6d6c4fcd96d902cdec8bbf","e4ff0142284ee1cc000000"], [ + 'Cache-Control', + 'no-cache', + 'Pragma', + 'no-cache', + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Content-Encoding', + 'gzip', + 'Expires', + '-1', + 'Vary', + 'Accept-Encoding,Accept-Encoding', + 'x-ms-request-id', + 'koreasouth:0a970517-189a-465e-90b3-7b40ad580900', + 'x-ms-ratelimit-remaining-subscription-reads', + '11999', + 'x-ms-correlation-request-id', + '79ee2a5f-4446-40d5-ab55-10434bd99c8a', + 'x-ms-routing-request-id', + 'KOREASOUTH:20211207T082114Z:79ee2a5f-4446-40d5-ab55-10434bd99c8a', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT' +]); diff --git a/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_list_test.js b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_list_test.js new file mode 100644 index 000000000000..9ec70577638a --- /dev/null +++ b/sdk/locks/arm-locks/recordings/node/locks_test/recording_managementlocks_list_test.js @@ -0,0 +1,145 @@ +let nock = require('nock'); + +module.exports.hash = "d815b1ab430b2a8af656b341c24ec58a"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/common/discovery/instance') + .query(true) + .reply(200, {"tenant_discovery_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '1fb76c60-469b-4711-a6f5-279de1c72000', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR2 ProdSlices', + 'Set-Cookie', + 'fpc=AlQtyr5hUP1NpOLv3-1OUkA; expires=Thu, 06-Jan-2022 08:21:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrKW2Ivt0qh4-Z5wR-s2_2259nSUbA7EN8niyoEiRVnrSsbnUD-pOhDpz9hS_LgewyKORFM22LNHLaHpLr0RhHVBQhwKHuOGZ_noOL-S-XQyBxqb-20XJ0OKcY9t8r16XUD4sjPO5wt9zhOR1T9atzabcZNBp_ib0JhKW4kMHckNQgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT', + 'Content-Length', + '980' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration') + .reply(200, {"token_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos","tenant_region_scope":"WW","cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}, [ + 'Cache-Control', + 'max-age=86400, private', + 'Content-Type', + 'application/json; charset=utf-8', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Access-Control-Allow-Origin', + '*', + 'Access-Control-Allow-Methods', + 'GET, OPTIONS', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '32611baa-0e55-4518-866d-8b42f10c2400', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR1 ProdSlices', + 'Set-Cookie', + 'fpc=An_Jwm88O9BOtHCDjqwXUCo; expires=Thu, 06-Jan-2022 08:21:14 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrRilnogcnJEx96B7scmyVyqHfwtaFtJsUQM8xxvKPJbnc5dVOHFO3V6ig92MJv2nw_BDTmNb653aYOnkvk6gH2CcNy-japt8urAM-jtjgeviKUE5n57jrFKAPCLYAsgXlj9e5AbZ9Nu2WdKwQUkNe9eERRzCdDhgdkKn3m_jPg3wgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT', + 'Content-Length', + '1753' +]); + +nock('https://login.microsoftonline.com:443', {"encodedQueryParams":true}) + .post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.3&x-client-OS=win32&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=52b1b189-cbeb-4379-acfa-fad2da6a3613&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22cp1%22%5D%7D%7D%7D") + .reply(200, {"token_type":"Bearer","expires_in":86399,"ext_expires_in":86399,"access_token":"access_token"}, [ + 'Cache-Control', + 'no-store, no-cache', + 'Pragma', + 'no-cache', + 'Content-Type', + 'application/json; charset=utf-8', + 'Expires', + '-1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'P3P', + 'CP="DSP CUR OTPi IND OTRi ONL FIN"', + 'x-ms-request-id', + '358d865e-2f1f-4436-ab98-a695c8d62200', + 'x-ms-ests-server', + '2.1.12249.17 - SEASLR1 ProdSlices', + 'x-ms-clitelem', + '1,0,0,,', + 'Set-Cookie', + 'fpc=AqHRmEW-519CjCuPP3oV49oWPr5BAQAAAHoQQdkOAAAA; expires=Thu, 06-Jan-2022 08:21:15 GMT; path=/; secure; HttpOnly; SameSite=None', + 'Set-Cookie', + 'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly', + 'Set-Cookie', + 'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT', + 'Content-Length', + '1374' +]); + +nock('https://management.azure.com:443', {"encodedQueryParams":true}) + .get('/subscriptions/azure_subscription_id/providers/Microsoft.Authorization/locks') + .query(true) + .reply(200, ["1f8b0800000000000400edbd07601c499625262f6dca7b7f4af54ad7e074a10880601324d8904010ecc188cde692ec1d69472329ab2a81ca6556655d661640cced9dbcf7de7befbdf7de7befbdf7ba3b9d4e27f7dfff3f5c6664016cf6ce4adac99e2180aac81f3f7e7c1f3f227ef1479759b9ce3f7af4bd5ffcd1aaae5679dd1679f3d1a35ffc51995fe6e5478f3e3ac9962faaf6695ee66dfed12f197d54cce8c3bbcd7ad24ceb62d516d5b2b9fb70effce1fdd9c1f9f6bde9a70fb6f777f7f6b71fee4e1f6c1f4ccf771e4c6793f3bdfdddbb04feb298e57573f78b625a574d75de8e8fd7edbcaa8b1f648073b7aca66f9bbb3fdde0677df1d1e8a3f67a45a87db4b13d355b660b34b32ffe92d1ad06432f562dbeffe86599674d9eceaa943e4967fc75dace8b26fdaac9ebf4b8698a8b653e4bcf66f9b22ddaebb458d2d7797afc83d7f9f465367d4b785527d5f2bcb878f5795ae74db5aea7797a5157eb559a35ae5dea1a5237ab7c396bd20ab08a664c687f7de29a3eb9cbe6aeedd0f5f7eaf3e80c7c912db38b7c664676774d0336e3d50f898631805f1d6f13d5da75b317054c0dbb5375d727ff73fa647b23589aa0f76380f704ff2336b11dbafe7e36d8e42a6782470153c3ee84de964d142c4dd0cf0a9b18f03f6213dba1ebef67834d886a44f0285c6ad79dcfdb728940a5e9f959611285fe231eb11dbafe7e367884fa6ce7536a5467e537cf2b21749aae9f159ee9f4f24bbeff","4bfe1f02f1fa9686090000"], [ + 'Cache-Control', + 'no-cache', + 'Pragma', + 'no-cache', + 'Transfer-Encoding', + 'chunked', + 'Content-Type', + 'application/json; charset=utf-8', + 'Content-Encoding', + 'gzip', + 'Expires', + '-1', + 'Vary', + 'Accept-Encoding,Accept-Encoding', + 'x-ms-request-id', + 'koreasouth:20a6a30c-7624-4679-b452-4ec0afb8b68f', + 'x-ms-ratelimit-remaining-subscription-reads', + '11998', + 'x-ms-correlation-request-id', + 'b68a638d-774e-449d-9a9e-7055065149a1', + 'x-ms-routing-request-id', + 'KOREASOUTH:20211207T082115Z:b68a638d-774e-449d-9a9e-7055065149a1', + 'Strict-Transport-Security', + 'max-age=31536000; includeSubDomains', + 'X-Content-Type-Options', + 'nosniff', + 'Date', + 'Tue, 07 Dec 2021 08:21:14 GMT' +]); diff --git a/sdk/locks/arm-locks/review/arm-locks.api.md b/sdk/locks/arm-locks/review/arm-locks.api.md index 5dce902eef3d..ee557e92a29a 100644 --- a/sdk/locks/arm-locks/review/arm-locks.api.md +++ b/sdk/locks/arm-locks/review/arm-locks.api.md @@ -11,16 +11,8 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging'; // @public export interface AuthorizationOperations { list(options?: AuthorizationOperationsListOptionalParams): PagedAsyncIterableIterator; - listNext(nextLink: string, options?: AuthorizationOperationsListNextOptionalParams): PagedAsyncIterableIterator; } -// @public -export interface AuthorizationOperationsListNextNextOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type AuthorizationOperationsListNextNextResponse = OperationListResult; - // @public export interface AuthorizationOperationsListNextOptionalParams extends coreClient.OperationOptions { } @@ -49,22 +41,17 @@ export enum KnownLockLevel { export type LockLevel = string; // @public (undocumented) -export class ManagementLockClient extends ManagementLockClientContext { - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ManagementLockClientOptionalParams); - // (undocumented) - authorizationOperations: AuthorizationOperations; - // (undocumented) - managementLocks: ManagementLocks; -} - -// @public (undocumented) -export class ManagementLockClientContext extends coreClient.ServiceClient { +export class ManagementLockClient extends coreClient.ServiceClient { // (undocumented) $host: string; constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ManagementLockClientOptionalParams); // (undocumented) apiVersion: string; // (undocumented) + authorizationOperations: AuthorizationOperations; + // (undocumented) + managementLocks: ManagementLocks; + // (undocumented) subscriptionId: string; } @@ -111,13 +98,9 @@ export interface ManagementLocks { getAtSubscriptionLevel(lockName: string, options?: ManagementLocksGetAtSubscriptionLevelOptionalParams): Promise; getByScope(scope: string, lockName: string, options?: ManagementLocksGetByScopeOptionalParams): Promise; listAtResourceGroupLevel(resourceGroupName: string, options?: ManagementLocksListAtResourceGroupLevelOptionalParams): PagedAsyncIterableIterator; - listAtResourceGroupLevelNext(resourceGroupName: string, nextLink: string, options?: ManagementLocksListAtResourceGroupLevelNextOptionalParams): PagedAsyncIterableIterator; listAtResourceLevel(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: ManagementLocksListAtResourceLevelOptionalParams): PagedAsyncIterableIterator; - listAtResourceLevelNext(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, nextLink: string, options?: ManagementLocksListAtResourceLevelNextOptionalParams): PagedAsyncIterableIterator; listAtSubscriptionLevel(options?: ManagementLocksListAtSubscriptionLevelOptionalParams): PagedAsyncIterableIterator; - listAtSubscriptionLevelNext(nextLink: string, options?: ManagementLocksListAtSubscriptionLevelNextOptionalParams): PagedAsyncIterableIterator; listByScope(scope: string, options?: ManagementLocksListByScopeOptionalParams): PagedAsyncIterableIterator; - listByScopeNext(scope: string, nextLink: string, options?: ManagementLocksListByScopeNextOptionalParams): PagedAsyncIterableIterator; } // @public @@ -192,14 +175,6 @@ export interface ManagementLocksGetByScopeOptionalParams extends coreClient.Oper // @public export type ManagementLocksGetByScopeResponse = ManagementLockObject; -// @public -export interface ManagementLocksListAtResourceGroupLevelNextNextOptionalParams extends coreClient.OperationOptions { - filter?: string; -} - -// @public -export type ManagementLocksListAtResourceGroupLevelNextNextResponse = ManagementLockListResult; - // @public export interface ManagementLocksListAtResourceGroupLevelNextOptionalParams extends coreClient.OperationOptions { filter?: string; @@ -216,14 +191,6 @@ export interface ManagementLocksListAtResourceGroupLevelOptionalParams extends c // @public export type ManagementLocksListAtResourceGroupLevelResponse = ManagementLockListResult; -// @public -export interface ManagementLocksListAtResourceLevelNextNextOptionalParams extends coreClient.OperationOptions { - filter?: string; -} - -// @public -export type ManagementLocksListAtResourceLevelNextNextResponse = ManagementLockListResult; - // @public export interface ManagementLocksListAtResourceLevelNextOptionalParams extends coreClient.OperationOptions { filter?: string; @@ -240,14 +207,6 @@ export interface ManagementLocksListAtResourceLevelOptionalParams extends coreCl // @public export type ManagementLocksListAtResourceLevelResponse = ManagementLockListResult; -// @public -export interface ManagementLocksListAtSubscriptionLevelNextNextOptionalParams extends coreClient.OperationOptions { - filter?: string; -} - -// @public -export type ManagementLocksListAtSubscriptionLevelNextNextResponse = ManagementLockListResult; - // @public export interface ManagementLocksListAtSubscriptionLevelNextOptionalParams extends coreClient.OperationOptions { filter?: string; @@ -264,14 +223,6 @@ export interface ManagementLocksListAtSubscriptionLevelOptionalParams extends co // @public export type ManagementLocksListAtSubscriptionLevelResponse = ManagementLockListResult; -// @public -export interface ManagementLocksListByScopeNextNextOptionalParams extends coreClient.OperationOptions { - filter?: string; -} - -// @public -export type ManagementLocksListByScopeNextNextResponse = ManagementLockListResult; - // @public export interface ManagementLocksListByScopeNextOptionalParams extends coreClient.OperationOptions { filter?: string; @@ -307,7 +258,6 @@ export interface OperationListResult { value?: Operation[]; } - // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/locks/arm-locks/src/index.ts b/sdk/locks/arm-locks/src/index.ts index 160bc61ddb3f..4d7fc996ba56 100644 --- a/sdk/locks/arm-locks/src/index.ts +++ b/sdk/locks/arm-locks/src/index.ts @@ -9,5 +9,4 @@ /// export * from "./models"; export { ManagementLockClient } from "./managementLockClient"; -export { ManagementLockClientContext } from "./managementLockClientContext"; export * from "./operationsInterfaces"; diff --git a/sdk/locks/arm-locks/src/managementLockClient.ts b/sdk/locks/arm-locks/src/managementLockClient.ts index d14da5a2df9f..2ee5e068cdf0 100644 --- a/sdk/locks/arm-locks/src/managementLockClient.ts +++ b/sdk/locks/arm-locks/src/managementLockClient.ts @@ -6,16 +6,20 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +import * as coreClient from "@azure/core-client"; import * as coreAuth from "@azure/core-auth"; import { AuthorizationOperationsImpl, ManagementLocksImpl } from "./operations"; import { AuthorizationOperations, ManagementLocks } from "./operationsInterfaces"; -import { ManagementLockClientContext } from "./managementLockClientContext"; import { ManagementLockClientOptionalParams } from "./models"; -export class ManagementLockClient extends ManagementLockClientContext { +export class ManagementLockClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + /** * Initializes a new instance of the ManagementLockClient class. * @param credentials Subscription credentials which uniquely identify client subscription. @@ -27,7 +31,46 @@ export class ManagementLockClient extends ManagementLockClientContext { subscriptionId: string, options?: ManagementLockClientOptionalParams ) { - super(credentials, subscriptionId, options); + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: ManagementLockClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-locks/2.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2016-09-01"; this.authorizationOperations = new AuthorizationOperationsImpl(this); this.managementLocks = new ManagementLocksImpl(this); } diff --git a/sdk/locks/arm-locks/src/managementLockClientContext.ts b/sdk/locks/arm-locks/src/managementLockClientContext.ts deleted file mode 100644 index 7badaa4c5b96..000000000000 --- a/sdk/locks/arm-locks/src/managementLockClientContext.ts +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 * as coreClient from "@azure/core-client"; -import * as coreAuth from "@azure/core-auth"; -import { ManagementLockClientOptionalParams } from "./models"; - -export class ManagementLockClientContext extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; - - /** - * Initializes a new instance of the ManagementLockClientContext class. - * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. - * @param options The parameter options - */ - constructor( - credentials: coreAuth.TokenCredential, - subscriptionId: string, - options?: ManagementLockClientOptionalParams - ) { - if (credentials === undefined) { - throw new Error("'credentials' cannot be null"); - } - if (subscriptionId === undefined) { - throw new Error("'subscriptionId' cannot be null"); - } - - // Initializing default values for options - if (!options) { - options = {}; - } - const defaults: ManagementLockClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; - - const packageDetails = `azsdk-js-arm-locks/2.0.0-beta.1`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - if (!options.credentialScopes) { - options.credentialScopes = ["https://management.azure.com/.default"]; - } - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix - }, - baseUri: options.endpoint || "https://management.azure.com" - }; - super(optionsWithDefaults); - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2016-09-01"; - } -} diff --git a/sdk/locks/arm-locks/src/models/index.ts b/sdk/locks/arm-locks/src/models/index.ts index 7a006d383ffd..f6a3353be403 100644 --- a/sdk/locks/arm-locks/src/models/index.ts +++ b/sdk/locks/arm-locks/src/models/index.ts @@ -105,13 +105,6 @@ export interface AuthorizationOperationsListNextOptionalParams /** Contains response data for the listNext operation. */ export type AuthorizationOperationsListNextResponse = OperationListResult; -/** Optional parameters. */ -export interface AuthorizationOperationsListNextNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNextNext operation. */ -export type AuthorizationOperationsListNextNextResponse = OperationListResult; - /** Optional parameters. */ export interface ManagementLocksCreateOrUpdateAtResourceGroupLevelOptionalParams extends coreClient.OperationOptions {} @@ -264,46 +257,6 @@ export interface ManagementLocksListByScopeNextOptionalParams /** Contains response data for the listByScopeNext operation. */ export type ManagementLocksListByScopeNextResponse = ManagementLockListResult; -/** Optional parameters. */ -export interface ManagementLocksListAtResourceGroupLevelNextNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. */ - filter?: string; -} - -/** Contains response data for the listAtResourceGroupLevelNextNext operation. */ -export type ManagementLocksListAtResourceGroupLevelNextNextResponse = ManagementLockListResult; - -/** Optional parameters. */ -export interface ManagementLocksListAtResourceLevelNextNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. */ - filter?: string; -} - -/** Contains response data for the listAtResourceLevelNextNext operation. */ -export type ManagementLocksListAtResourceLevelNextNextResponse = ManagementLockListResult; - -/** Optional parameters. */ -export interface ManagementLocksListAtSubscriptionLevelNextNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. */ - filter?: string; -} - -/** Contains response data for the listAtSubscriptionLevelNextNext operation. */ -export type ManagementLocksListAtSubscriptionLevelNextNextResponse = ManagementLockListResult; - -/** Optional parameters. */ -export interface ManagementLocksListByScopeNextNextOptionalParams - extends coreClient.OperationOptions { - /** The filter to apply on the operation. */ - filter?: string; -} - -/** Contains response data for the listByScopeNextNext operation. */ -export type ManagementLocksListByScopeNextNextResponse = ManagementLockListResult; - /** Optional parameters. */ export interface ManagementLockClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/locks/arm-locks/src/operations/authorizationOperations.ts b/sdk/locks/arm-locks/src/operations/authorizationOperations.ts index 0f855d1f891e..75981ed9b691 100644 --- a/sdk/locks/arm-locks/src/operations/authorizationOperations.ts +++ b/sdk/locks/arm-locks/src/operations/authorizationOperations.ts @@ -6,33 +6,30 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import "@azure/core-paging"; import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { AuthorizationOperations } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ManagementLockClientContext } from "../managementLockClientContext"; +import { ManagementLockClient } from "../managementLockClient"; import { Operation, AuthorizationOperationsListNextOptionalParams, AuthorizationOperationsListOptionalParams, - AuthorizationOperationsListNextNextOptionalParams, AuthorizationOperationsListResponse, - AuthorizationOperationsListNextResponse, - AuthorizationOperationsListNextNextResponse + AuthorizationOperationsListNextResponse } from "../models"; /// -/** Class representing a AuthorizationOperations. */ +/** Class containing AuthorizationOperations operations. */ export class AuthorizationOperationsImpl implements AuthorizationOperations { - private readonly client: ManagementLockClientContext; + private readonly client: ManagementLockClient; /** * Initialize a new instance of the class AuthorizationOperations class. * @param client Reference to the service client */ - constructor(client: ManagementLockClientContext) { + constructor(client: ManagementLockClient) { this.client = client; } @@ -78,52 +75,6 @@ export class AuthorizationOperationsImpl implements AuthorizationOperations { } } - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - public listNext( - nextLink: string, - options?: AuthorizationOperationsListNextOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listNextPagingAll(nextLink, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listNextPagingPage(nextLink, options); - } - }; - } - - private async *listNextPagingPage( - nextLink: string, - options?: AuthorizationOperationsListNextOptionalParams - ): AsyncIterableIterator { - let result = await this._listNext(nextLink, options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listNextNext(continuationToken, options); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listNextPagingAll( - nextLink: string, - options?: AuthorizationOperationsListNextOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listNextPagingPage(nextLink, options)) { - yield* page; - } - } - /** * Lists all of the available Microsoft.Authorization REST API operations. * @param options The options parameters. @@ -148,21 +99,6 @@ export class AuthorizationOperationsImpl implements AuthorizationOperations { listNextOperationSpec ); } - - /** - * ListNextNext - * @param nextLink The nextLink from the previous successful call to the ListNext method. - * @param options The options parameters. - */ - private _listNextNext( - nextLink: string, - options?: AuthorizationOperationsListNextNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextNextOperationSpec - ); - } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); @@ -193,16 +129,3 @@ const listNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const listNextNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/locks/arm-locks/src/operations/managementLocks.ts b/sdk/locks/arm-locks/src/operations/managementLocks.ts index 9f91b43b32b5..5415f161e012 100644 --- a/sdk/locks/arm-locks/src/operations/managementLocks.ts +++ b/sdk/locks/arm-locks/src/operations/managementLocks.ts @@ -6,13 +6,12 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import "@azure/core-paging"; import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { ManagementLocks } from "../operationsInterfaces"; import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ManagementLockClientContext } from "../managementLockClientContext"; +import { ManagementLockClient } from "../managementLockClient"; import { ManagementLockObject, ManagementLocksListAtResourceGroupLevelNextOptionalParams, @@ -23,10 +22,6 @@ import { ManagementLocksListAtSubscriptionLevelOptionalParams, ManagementLocksListByScopeNextOptionalParams, ManagementLocksListByScopeOptionalParams, - ManagementLocksListAtResourceGroupLevelNextNextOptionalParams, - ManagementLocksListAtResourceLevelNextNextOptionalParams, - ManagementLocksListAtSubscriptionLevelNextNextOptionalParams, - ManagementLocksListByScopeNextNextOptionalParams, ManagementLocksCreateOrUpdateAtResourceGroupLevelOptionalParams, ManagementLocksCreateOrUpdateAtResourceGroupLevelResponse, ManagementLocksDeleteAtResourceGroupLevelOptionalParams, @@ -54,23 +49,19 @@ import { ManagementLocksListAtResourceGroupLevelNextResponse, ManagementLocksListAtResourceLevelNextResponse, ManagementLocksListAtSubscriptionLevelNextResponse, - ManagementLocksListByScopeNextResponse, - ManagementLocksListAtResourceGroupLevelNextNextResponse, - ManagementLocksListAtResourceLevelNextNextResponse, - ManagementLocksListAtSubscriptionLevelNextNextResponse, - ManagementLocksListByScopeNextNextResponse + ManagementLocksListByScopeNextResponse } from "../models"; /// -/** Class representing a ManagementLocks. */ +/** Class containing ManagementLocks operations. */ export class ManagementLocksImpl implements ManagementLocks { - private readonly client: ManagementLockClientContext; + private readonly client: ManagementLockClient; /** * Initialize a new instance of the class ManagementLocks class. * @param client Reference to the service client */ - constructor(client: ManagementLockClientContext) { + constructor(client: ManagementLockClient) { this.client = client; } @@ -330,299 +321,6 @@ export class ManagementLocksImpl implements ManagementLocks { } } - /** - * ListAtResourceGroupLevelNext - * @param resourceGroupName The name of the resource group containing the locks to get. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceGroupLevel - * method. - * @param options The options parameters. - */ - public listAtResourceGroupLevelNext( - resourceGroupName: string, - nextLink: string, - options?: ManagementLocksListAtResourceGroupLevelNextOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAtResourceGroupLevelNextPagingAll( - resourceGroupName, - nextLink, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listAtResourceGroupLevelNextPagingPage( - resourceGroupName, - nextLink, - options - ); - } - }; - } - - private async *listAtResourceGroupLevelNextPagingPage( - resourceGroupName: string, - nextLink: string, - options?: ManagementLocksListAtResourceGroupLevelNextOptionalParams - ): AsyncIterableIterator { - let result = await this._listAtResourceGroupLevelNext( - resourceGroupName, - nextLink, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listAtResourceGroupLevelNextNext( - resourceGroupName, - continuationToken, - options - ); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listAtResourceGroupLevelNextPagingAll( - resourceGroupName: string, - nextLink: string, - options?: ManagementLocksListAtResourceGroupLevelNextOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAtResourceGroupLevelNextPagingPage( - resourceGroupName, - nextLink, - options - )) { - yield* page; - } - } - - /** - * ListAtResourceLevelNext - * @param resourceGroupName The name of the resource group containing the locked resource. The name is - * case insensitive. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param parentResourcePath The parent resource identity. - * @param resourceType The resource type of the locked resource. - * @param resourceName The name of the locked resource. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceLevel method. - * @param options The options parameters. - */ - public listAtResourceLevelNext( - resourceGroupName: string, - resourceProviderNamespace: string, - parentResourcePath: string, - resourceType: string, - resourceName: string, - nextLink: string, - options?: ManagementLocksListAtResourceLevelNextOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAtResourceLevelNextPagingAll( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - nextLink, - options - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listAtResourceLevelNextPagingPage( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - nextLink, - options - ); - } - }; - } - - private async *listAtResourceLevelNextPagingPage( - resourceGroupName: string, - resourceProviderNamespace: string, - parentResourcePath: string, - resourceType: string, - resourceName: string, - nextLink: string, - options?: ManagementLocksListAtResourceLevelNextOptionalParams - ): AsyncIterableIterator { - let result = await this._listAtResourceLevelNext( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - nextLink, - options - ); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listAtResourceLevelNextNext( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - continuationToken, - options - ); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listAtResourceLevelNextPagingAll( - resourceGroupName: string, - resourceProviderNamespace: string, - parentResourcePath: string, - resourceType: string, - resourceName: string, - nextLink: string, - options?: ManagementLocksListAtResourceLevelNextOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAtResourceLevelNextPagingPage( - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - nextLink, - options - )) { - yield* page; - } - } - - /** - * ListAtSubscriptionLevelNext - * @param nextLink The nextLink from the previous successful call to the ListAtSubscriptionLevel - * method. - * @param options The options parameters. - */ - public listAtSubscriptionLevelNext( - nextLink: string, - options?: ManagementLocksListAtSubscriptionLevelNextOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listAtSubscriptionLevelNextPagingAll(nextLink, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listAtSubscriptionLevelNextPagingPage(nextLink, options); - } - }; - } - - private async *listAtSubscriptionLevelNextPagingPage( - nextLink: string, - options?: ManagementLocksListAtSubscriptionLevelNextOptionalParams - ): AsyncIterableIterator { - let result = await this._listAtSubscriptionLevelNext(nextLink, options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listAtSubscriptionLevelNextNext( - continuationToken, - options - ); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listAtSubscriptionLevelNextPagingAll( - nextLink: string, - options?: ManagementLocksListAtSubscriptionLevelNextOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listAtSubscriptionLevelNextPagingPage( - nextLink, - options - )) { - yield* page; - } - } - - /** - * ListByScopeNext - * @param scope The scope for the lock. When providing a scope for the assignment, use - * '/subscriptions/{subscriptionId}' for subscriptions, - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - * for resources. - * @param nextLink The nextLink from the previous successful call to the ListByScope method. - * @param options The options parameters. - */ - public listByScopeNext( - scope: string, - nextLink: string, - options?: ManagementLocksListByScopeNextOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByScopeNextPagingAll(scope, nextLink, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: () => { - return this.listByScopeNextPagingPage(scope, nextLink, options); - } - }; - } - - private async *listByScopeNextPagingPage( - scope: string, - nextLink: string, - options?: ManagementLocksListByScopeNextOptionalParams - ): AsyncIterableIterator { - let result = await this._listByScopeNext(scope, nextLink, options); - yield result.value || []; - let continuationToken = result.nextLink; - while (continuationToken) { - result = await this._listByScopeNextNext( - scope, - continuationToken, - options - ); - continuationToken = result.nextLink; - yield result.value || []; - } - } - - private async *listByScopeNextPagingAll( - scope: string, - nextLink: string, - options?: ManagementLocksListByScopeNextOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByScopeNextPagingPage( - scope, - nextLink, - options - )) { - yield* page; - } - } - /** * When you apply a lock at a parent scope, all child resources inherit the same lock. To create * management locks, you must have access to Microsoft.Authorization/* or @@ -1068,96 +766,6 @@ export class ManagementLocksImpl implements ManagementLocks { listByScopeNextOperationSpec ); } - - /** - * ListAtResourceGroupLevelNextNext - * @param resourceGroupName The name of the resource group containing the locks to get. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceGroupLevelNext - * method. - * @param options The options parameters. - */ - private _listAtResourceGroupLevelNextNext( - resourceGroupName: string, - nextLink: string, - options?: ManagementLocksListAtResourceGroupLevelNextNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listAtResourceGroupLevelNextNextOperationSpec - ); - } - - /** - * ListAtResourceLevelNextNext - * @param resourceGroupName The name of the resource group containing the locked resource. The name is - * case insensitive. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param parentResourcePath The parent resource identity. - * @param resourceType The resource type of the locked resource. - * @param resourceName The name of the locked resource. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceLevelNext - * method. - * @param options The options parameters. - */ - private _listAtResourceLevelNextNext( - resourceGroupName: string, - resourceProviderNamespace: string, - parentResourcePath: string, - resourceType: string, - resourceName: string, - nextLink: string, - options?: ManagementLocksListAtResourceLevelNextNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - resourceProviderNamespace, - parentResourcePath, - resourceType, - resourceName, - nextLink, - options - }, - listAtResourceLevelNextNextOperationSpec - ); - } - - /** - * ListAtSubscriptionLevelNextNext - * @param nextLink The nextLink from the previous successful call to the ListAtSubscriptionLevelNext - * method. - * @param options The options parameters. - */ - private _listAtSubscriptionLevelNextNext( - nextLink: string, - options?: ManagementLocksListAtSubscriptionLevelNextNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listAtSubscriptionLevelNextNextOperationSpec - ); - } - - /** - * ListByScopeNextNext - * @param scope The scope for the lock. When providing a scope for the assignment, use - * '/subscriptions/{subscriptionId}' for subscriptions, - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - * for resources. - * @param nextLink The nextLink from the previous successful call to the ListByScopeNext method. - * @param options The options parameters. - */ - private _listByScopeNextNext( - scope: string, - nextLink: string, - options?: ManagementLocksListByScopeNextNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { scope, nextLink, options }, - listByScopeNextNextOperationSpec - ); - } } // Operation Specifications const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); @@ -1518,73 +1126,3 @@ const listByScopeNextOperationSpec: coreClient.OperationSpec = { headerParameters: [Parameters.accept], serializer }; -const listAtResourceGroupLevelNextNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ManagementLockListResult - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listAtResourceLevelNextNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ManagementLockListResult - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.resourceProviderNamespace, - Parameters.parentResourcePath, - Parameters.resourceType, - Parameters.resourceName - ], - headerParameters: [Parameters.accept], - serializer -}; -const listAtSubscriptionLevelNextNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ManagementLockListResult - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listByScopeNextNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.ManagementLockListResult - } - }, - queryParameters: [Parameters.apiVersion, Parameters.filter], - urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/locks/arm-locks/src/operationsInterfaces/authorizationOperations.ts b/sdk/locks/arm-locks/src/operationsInterfaces/authorizationOperations.ts index 6012ad0d6316..9e806d13345f 100644 --- a/sdk/locks/arm-locks/src/operationsInterfaces/authorizationOperations.ts +++ b/sdk/locks/arm-locks/src/operationsInterfaces/authorizationOperations.ts @@ -6,11 +6,9 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import "@azure/core-paging"; import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { Operation, - AuthorizationOperationsListNextOptionalParams, AuthorizationOperationsListOptionalParams } from "../models"; @@ -24,13 +22,4 @@ export interface AuthorizationOperations { list( options?: AuthorizationOperationsListOptionalParams ): PagedAsyncIterableIterator; - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - listNext( - nextLink: string, - options?: AuthorizationOperationsListNextOptionalParams - ): PagedAsyncIterableIterator; } diff --git a/sdk/locks/arm-locks/src/operationsInterfaces/managementLocks.ts b/sdk/locks/arm-locks/src/operationsInterfaces/managementLocks.ts index 72d7ab6ec8ce..7ffff412119f 100644 --- a/sdk/locks/arm-locks/src/operationsInterfaces/managementLocks.ts +++ b/sdk/locks/arm-locks/src/operationsInterfaces/managementLocks.ts @@ -6,17 +6,12 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import "@azure/core-paging"; import { PagedAsyncIterableIterator } from "@azure/core-paging"; import { ManagementLockObject, - ManagementLocksListAtResourceGroupLevelNextOptionalParams, ManagementLocksListAtResourceGroupLevelOptionalParams, - ManagementLocksListAtResourceLevelNextOptionalParams, ManagementLocksListAtResourceLevelOptionalParams, - ManagementLocksListAtSubscriptionLevelNextOptionalParams, ManagementLocksListAtSubscriptionLevelOptionalParams, - ManagementLocksListByScopeNextOptionalParams, ManagementLocksListByScopeOptionalParams, ManagementLocksCreateOrUpdateAtResourceGroupLevelOptionalParams, ManagementLocksCreateOrUpdateAtResourceGroupLevelResponse, @@ -90,63 +85,6 @@ export interface ManagementLocks { scope: string, options?: ManagementLocksListByScopeOptionalParams ): PagedAsyncIterableIterator; - /** - * ListAtResourceGroupLevelNext - * @param resourceGroupName The name of the resource group containing the locks to get. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceGroupLevel - * method. - * @param options The options parameters. - */ - listAtResourceGroupLevelNext( - resourceGroupName: string, - nextLink: string, - options?: ManagementLocksListAtResourceGroupLevelNextOptionalParams - ): PagedAsyncIterableIterator; - /** - * ListAtResourceLevelNext - * @param resourceGroupName The name of the resource group containing the locked resource. The name is - * case insensitive. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param parentResourcePath The parent resource identity. - * @param resourceType The resource type of the locked resource. - * @param resourceName The name of the locked resource. - * @param nextLink The nextLink from the previous successful call to the ListAtResourceLevel method. - * @param options The options parameters. - */ - listAtResourceLevelNext( - resourceGroupName: string, - resourceProviderNamespace: string, - parentResourcePath: string, - resourceType: string, - resourceName: string, - nextLink: string, - options?: ManagementLocksListAtResourceLevelNextOptionalParams - ): PagedAsyncIterableIterator; - /** - * ListAtSubscriptionLevelNext - * @param nextLink The nextLink from the previous successful call to the ListAtSubscriptionLevel - * method. - * @param options The options parameters. - */ - listAtSubscriptionLevelNext( - nextLink: string, - options?: ManagementLocksListAtSubscriptionLevelNextOptionalParams - ): PagedAsyncIterableIterator; - /** - * ListByScopeNext - * @param scope The scope for the lock. When providing a scope for the assignment, use - * '/subscriptions/{subscriptionId}' for subscriptions, - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' for resource groups, and - * '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - * for resources. - * @param nextLink The nextLink from the previous successful call to the ListByScope method. - * @param options The options parameters. - */ - listByScopeNext( - scope: string, - nextLink: string, - options?: ManagementLocksListByScopeNextOptionalParams - ): PagedAsyncIterableIterator; /** * When you apply a lock at a parent scope, all child resources inherit the same lock. To create * management locks, you must have access to Microsoft.Authorization/* or diff --git a/sdk/locks/arm-locks/test/locks_examples.ts b/sdk/locks/arm-locks/test/locks_examples.ts new file mode 100644 index 000000000000..89cc58d7ae31 --- /dev/null +++ b/sdk/locks/arm-locks/test/locks_examples.ts @@ -0,0 +1,95 @@ +/* + * 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 { + env, + record, + RecorderEnvironmentSetup, + Recorder, + delay, + isPlaybackMode +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; +import { ClientSecretCredential } from "@azure/identity"; +import { ManagementLockClient } from "../src/managementLockClient"; + +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: [] +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("Locks test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: ManagementLockClient; + let location: string; + let resourceGroup: string; + let lockName: string; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + subscriptionId = env.SUBSCRIPTION_ID; + // This is an example of how the environment variables are used + const credential = new ClientSecretCredential( + env.AZURE_TENANT_ID, + env.AZURE_CLIENT_ID, + env.AZURE_CLIENT_SECRET + ); + client = new ManagementLockClient(credential, subscriptionId); + location = "eastus"; + resourceGroup = "myjstest"; + lockName = "jslockrg"; + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("managementLocks create test", async function() { + const res = await client.managementLocks.createOrUpdateAtSubscriptionLevel(lockName,{level: "CanNotDelete"}); + assert.equal(res.name,lockName); + }); + + it("managementLocks get test", async function() { + const res = await client.managementLocks.getAtSubscriptionLevel(lockName); + assert.equal(res.name,lockName); + }); + + it("managementLocks list test", async function() { + const resArray = new Array(); + for await (const item of client.managementLocks.listAtSubscriptionLevel()) { + resArray.push(item); + } + assert.notEqual(resArray.length,0); + }); + + it("managementLocks delete test", async function() { + const res = await client.managementLocks.deleteAtSubscriptionLevel(lockName); + const resArray = new Array(); + for await (const item of client.managementLocks.listAtSubscriptionLevel()) { + resArray.push(item); + } + assert.notEqual(resArray.length,0); + }); +}); diff --git a/sdk/locks/arm-locks/tsconfig.json b/sdk/locks/arm-locks/tsconfig.json index 0ec8659c8e83..6e3251194117 100644 --- a/sdk/locks/arm-locks/tsconfig.json +++ b/sdk/locks/arm-locks/tsconfig.json @@ -9,12 +9,11 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "preserveConstEnums": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] }