diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 5edc03d16e04..d50ae13a2ba4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -585,7 +585,7 @@ importers: version: file:projects/arm-peering.tgz '@rush-temp/arm-playwrighttesting': specifier: file:./projects/arm-playwrighttesting.tgz - version: file:projects/arm-playwrighttesting.tgz + version: file:projects/arm-playwrighttesting.tgz(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2))(vite@5.4.11(@types/node@22.7.9)) '@rush-temp/arm-policy': specifier: file:./projects/arm-policy.tgz version: file:projects/arm-policy.tgz @@ -3203,7 +3203,7 @@ packages: version: 0.0.0 '@rush-temp/arm-playwrighttesting@file:projects/arm-playwrighttesting.tgz': - resolution: {integrity: sha512-DoFdSeAM4GWLDFECLvCLScg80mpkRsKvwLyXtbmZqer687UOBWpOW1fcKO+uVxkxbUzu1R8eoj6o4wuhE8zk8A==, tarball: file:projects/arm-playwrighttesting.tgz} + resolution: {integrity: sha512-f6PdQKWN3m1ulYHdoD2WwrIJ5ObWoqXmrRV1lOr1eZ9xhPaQ8DVw/lyzEWkncGF3s+KGq03WEU/qZt2KtA8IXA==, tarball: file:projects/arm-playwrighttesting.tgz} version: 0.0.0 '@rush-temp/arm-policy-profile-2020-09-01-hybrid@file:projects/arm-policy-profile-2020-09-01-hybrid.tgz': @@ -13958,25 +13958,38 @@ snapshots: - '@swc/wasm' - supports-color - '@rush-temp/arm-playwrighttesting@file:projects/arm-playwrighttesting.tgz': + '@rush-temp/arm-playwrighttesting@file:projects/arm-playwrighttesting.tgz(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2))(vite@5.4.11(@types/node@22.7.9))': dependencies: - '@azure-tools/test-credential': 1.3.1 - '@azure-tools/test-recorder': 3.5.2 - '@azure/abort-controller': 1.1.0 - '@azure/core-lro': 2.7.2 - '@types/chai': 4.3.20 - '@types/mocha': 10.0.10 + '@microsoft/api-extractor': 7.48.0(@types/node@18.19.68) '@types/node': 18.19.68 - chai: 4.5.0 + '@vitest/browser': 2.1.8(@types/node@18.19.68)(playwright@1.49.1)(typescript@5.7.2)(vite@5.4.11(@types/node@22.7.9))(vitest@2.1.8) + '@vitest/coverage-istanbul': 2.1.8(vitest@2.1.8) dotenv: 16.4.7 - mocha: 11.0.2 - ts-node: 10.9.2(@types/node@18.19.68)(typescript@5.7.2) + eslint: 9.17.0 + playwright: 1.49.1 tslib: 2.8.1 typescript: 5.7.2 + vitest: 2.1.8(@types/node@18.19.68)(@vitest/browser@2.1.8)(msw@2.6.8(@types/node@22.7.9)(typescript@5.7.2)) transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' + - '@edge-runtime/vm' + - '@vitest/ui' + - bufferutil + - happy-dom + - jiti + - jsdom + - less + - lightningcss + - msw + - safaridriver + - sass + - sass-embedded + - stylus + - sugarss - supports-color + - terser + - utf-8-validate + - vite + - webdriverio '@rush-temp/arm-policy-profile-2020-09-01-hybrid@file:projects/arm-policy-profile-2020-09-01-hybrid.tgz': dependencies: diff --git a/sdk/playwrighttesting/arm-playwrighttesting/CHANGELOG.md b/sdk/playwrighttesting/arm-playwrighttesting/CHANGELOG.md index 85fffeb29071..e849d97d015e 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/CHANGELOG.md +++ b/sdk/playwrighttesting/arm-playwrighttesting/CHANGELOG.md @@ -1,40 +1,7 @@ # Release History - -## 1.0.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.0-beta.2 (2024-01-31) -### Features Added - - - Added Interface AccountProperties - - Added Interface AccountUpdateProperties - - Added Interface QuotaProperties - - Interface Account has a new optional parameter properties - - Interface AccountUpdate has a new optional parameter properties - - Interface Quota has a new optional parameter properties - -### Breaking Changes +## 1.0.0 (2024-12-13) - - Interface Account no longer has parameter dashboardUri - - Interface Account no longer has parameter provisioningState - - Interface Account no longer has parameter regionalAffinity - - Interface Account no longer has parameter reporting - - Interface Account no longer has parameter scalableExecution - - Interface AccountUpdate no longer has parameter regionalAffinity - - Interface AccountUpdate no longer has parameter reporting - - Interface AccountUpdate no longer has parameter scalableExecution - - Interface Quota no longer has parameter freeTrial - - Interface Quota no longer has parameter provisioningState - - -## 1.0.0-beta.1 (2023-09-27) +### Features Added -The package of @azure/arm-playwrighttesting is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +This is the first stable version with the package of @azure/arm-playwrighttesting. diff --git a/sdk/playwrighttesting/arm-playwrighttesting/README.md b/sdk/playwrighttesting/arm-playwrighttesting/README.md index 687fedfd55b3..e48b63a694c7 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/README.md +++ b/sdk/playwrighttesting/arm-playwrighttesting/README.md @@ -1,12 +1,12 @@ -# Azure PlaywrightTesting client library for JavaScript +# AzurePlaywrightService client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure PlaywrightTesting client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzurePlaywrightService client. -Azure Playwright testing management service +Microsoft.AzurePlaywrightService Resource Provider Management API. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-playwrighttesting) | -[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview) | +[API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-playwrighttesting) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started @@ -24,16 +24,16 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-playwrighttesting` package -Install the Azure PlaywrightTesting client library for JavaScript with `npm`: +Install the AzurePlaywrightService client library for JavaScript with `npm`: ```bash npm install @azure/arm-playwrighttesting ``` -### Create and authenticate a `PlaywrightTestingClient` +### Create and authenticate a `AzurePlaywrightServiceClient` -To create a client object to access the Azure PlaywrightTesting API, you will need the `endpoint` of your Azure PlaywrightTesting resource and a `credential`. The Azure PlaywrightTesting client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure PlaywrightTesting resource in the [Azure Portal][azure_portal]. +To create a client object to access the AzurePlaywrightService API, you will need the `endpoint` of your AzurePlaywrightService resource and a `credential`. The AzurePlaywrightService client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzurePlaywrightService resource in the [Azure Portal][azure_portal]. 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). @@ -43,25 +43,24 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure PlaywrightTesting** 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`. +You will also need to **register a new AAD application and grant access to AzurePlaywrightService** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); const { DefaultAzureCredential } = require("@azure/identity"); // For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new PlaywrightTestingClient(new DefaultAzureCredential(), subscriptionId); +const client = new AzurePlaywrightServiceClient(new DefaultAzureCredential(), subscriptionId); // For client-side applications running in the browser, use this code instead: // const credential = new InteractiveBrowserCredential({ // tenantId: "", // clientId: "" // }); -// const client = new PlaywrightTestingClient(credential, subscriptionId); +// const client = new AzurePlaywrightServiceClient(credential, subscriptionId); ``` ### JavaScript Bundle @@ -70,9 +69,9 @@ To use this client library in the browser, first you need to use a bundler. For ## Key concepts -### PlaywrightTestingClient +### AzurePlaywrightServiceClient -`PlaywrightTestingClient` is the primary interface for developers using the Azure PlaywrightTesting client library. Explore the methods on this client object to understand the different features of the Azure PlaywrightTesting service that you can access. +`AzurePlaywrightServiceClient` is the primary interface for developers using the AzurePlaywrightService client library. Explore the methods on this client object to understand the different features of the AzurePlaywrightService service that you can access. ## Troubleshooting @@ -89,7 +88,7 @@ For more detailed instructions on how to enable logs, you can look at the [@azur ## Next steps -Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/samples) directory for detailed examples on how to use this library. ## Contributing diff --git a/sdk/playwrighttesting/arm-playwrighttesting/_meta.json b/sdk/playwrighttesting/arm-playwrighttesting/_meta.json deleted file mode 100644 index c11d1254f9e7..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/_meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "commit": "f3cd6922dbe117d78b4f719bbf8b03db46b30808", - "readme": "specification/playwrighttesting/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\playwrighttesting\\resource-manager\\readme.md --use=@autorest/typescript@6.0.13 --generate-sample=true", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", - "use": "@autorest/typescript@6.0.13" -} \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/api-extractor.json b/sdk/playwrighttesting/arm-playwrighttesting/api-extractor.json index ace4d6d1823b..d4a68ab4c10d 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/api-extractor.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/api-extractor.json @@ -1,6 +1,6 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "mainEntryPointFilePath": "dist/esm/index.d.ts", "docModel": { "enabled": true }, @@ -11,7 +11,7 @@ "dtsRollup": { "enabled": true, "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/arm-playwrighttesting.d.ts" + "publicTrimmedFilePath": "dist/arm-playwrighttesting.d.ts" }, "messages": { "tsdocMessageReporting": { @@ -28,4 +28,4 @@ } } } -} \ No newline at end of file +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/assets.json b/sdk/playwrighttesting/arm-playwrighttesting/assets.json index 75595f52e0af..17ed2ed73318 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/assets.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/playwrighttesting/arm-playwrighttesting", - "Tag": "js/playwrighttesting/arm-playwrighttesting_4638cdcb91" + "Tag": "js/playwrighttesting/arm-playwrighttesting_de8e95b7f7" } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/eslint.config.mjs b/sdk/playwrighttesting/arm-playwrighttesting/eslint.config.mjs new file mode 100644 index 000000000000..03244d34a19f --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/eslint.config.mjs @@ -0,0 +1,17 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default [ + ...azsdkEslint.configs.recommended, + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-module": "off", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn", + }, + }, +]; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/package.json b/sdk/playwrighttesting/arm-playwrighttesting/package.json index 97489c4f0d9d..1fb07cc3557a 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/package.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/package.json @@ -1,113 +1,164 @@ { "name": "@azure/arm-playwrighttesting", - "sdk-type": "mgmt", - "author": "Microsoft Corporation", - "description": "A generated SDK for PlaywrightTestingClient.", - "version": "1.0.0-beta.3", + "version": "1.0.0", + "description": "A generated SDK for AzurePlaywrightServiceClient.", "engines": { "node": ">=18.0.0" }, - "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.3.0", - "@azure/core-client": "^1.7.0", - "@azure/core-lro": "^2.5.4", - "@azure/core-paging": "^1.2.0", - "@azure/core-rest-pipeline": "^1.12.0", - "tslib": "^2.2.0" + "sideEffects": false, + "autoPublish": false, + "tshy": { + "project": "./tsconfig.src.json", + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], + "selfLink": false }, + "type": "module", "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" ], + "author": "Microsoft Corporation", "license": "MIT", - "main": "./dist/index.js", - "module": "./dist-esm/src/index.js", - "types": "./types/arm-playwrighttesting.d.ts", + "files": [ + "dist/", + "README.md", + "LICENSE", + "review/", + "CHANGELOG.md" + ], + "sdk-type": "mgmt", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/README.md", + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "//metadata": { + "constantPaths": [ + { + "path": "src/api/azurePlaywrightServiceContext.ts", + "prefix": "userAgentInfo" + } + ] + }, + "dependencies": { + "@azure-rest/core-client": "^2.3.1", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.6.0", + "@azure/core-lro": "^3.1.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/core-util": "^1.9.2", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2" + }, "devDependencies": { - "@azure-tools/test-credential": "^1.0.0", - "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.1.0", + "@azure-tools/test-utils-vitest": "^1.0.0", "@azure/dev-tool": "^1.0.0", - "@azure/identity": "^4.0.1", - "@types/chai": "^4.2.8", - "@types/mocha": "^10.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^4.2.1", + "@microsoft/api-extractor": "^7.40.3", "@types/node": "^18.0.0", - "chai": "^4.2.0", + "@vitest/browser": "^2.1.8", + "@vitest/coverage-istanbul": "^2.1.8", "dotenv": "^16.0.0", - "mocha": "^11.0.2", - "ts-node": "^10.0.0", - "typescript": "~5.7.2" - }, - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" + "eslint": "^9.9.0", + "playwright": "^1.49.1", + "typescript": "~5.7.2", + "vitest": "^2.1.8" }, - "files": [ - "dist/**/*.js", - "dist/**/*.js.map", - "dist/**/*.d.ts", - "dist/**/*.d.ts.map", - "dist-esm/**/*.js", - "dist-esm/**/*.js.map", - "dist-esm/**/*.d.ts", - "dist-esm/**/*.d.ts.map", - "src/**/*.ts", - "README.md", - "LICENSE", - "tsconfig.json", - "review/*", - "CHANGELOG.md", - "types/*" - ], "scripts": { - "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && dev-tool run vendored mkdirp ./review && npm run extract-api", - "build:browser": "echo skipped", - "build:node": "echo skipped", - "build:samples": "echo skipped.", - "build:test": "echo skipped", - "check-format": "echo skipped", + "build": "npm run clean && dev-tool run build-package && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", + "build:samples": "tsc -p tsconfig.samples.json && dev-tool samples publish -f", + "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", + "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "execute:samples": "echo skipped", - "extract-api": "dev-tool run extract-api", - "format": "echo skipped", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "dev-tool run vendored rimraf review && dev-tool run vendored mkdirp ./review && dev-tool run extract-api", + "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" \"samples-dev/*.ts\"", + "generate:client": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", "integration-test:browser": "echo skipped", - "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:node": "echo skipped", "lint": "echo skipped", + "lint:fix": "echo skipped", "minify": "dev-tool run vendored uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", "pack": "npm pack 2>&1", - "prepack": "npm run build", - "test": "npm run integration-test", - "test:browser": "echo skipped", - "test:node": "echo skipped", + "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "echo skipped", - "unit-test:node": "dev-tool run vendored cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", + "unit-test:node": "dev-tool run test:vitest", "update-snippets": "echo skipped" }, - "sideEffects": false, - "//metadata": { - "constantPaths": [ - { - "path": "src/playwrightTestingClient.ts", - "prefix": "packageDetails" - } - ] - }, - "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting", "//sampleConfiguration": { - "productName": "", + "productName": "@azure/arm-playwrighttesting", "productSlugs": [ "azure" ], "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js", + "browser": "./dist/browser/index.js", + "react-native": "./dist/react-native/index.js" } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting-models.api.md b/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting-models.api.md new file mode 100644 index 000000000000..6eecb964fb35 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting-models.api.md @@ -0,0 +1,230 @@ +## API Report File for "@azure/arm-playwrighttesting" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +// @public +export interface Account extends TrackedResource { + properties?: AccountProperties; +} + +// @public +export interface AccountFreeTrialProperties { + readonly allocatedValue: number; + readonly createdAt: Date; + readonly expiryAt: Date; + readonly percentageUsed: number; + readonly usedValue: number; +} + +// @public +export interface AccountProperties { + readonly dashboardUri?: string; + localAuth?: EnablementStatus; + readonly provisioningState?: ProvisioningState; + regionalAffinity?: EnablementStatus; + reporting?: EnablementStatus; + scalableExecution?: EnablementStatus; +} + +// @public +export interface AccountQuota extends ProxyResource { + properties?: AccountQuotaProperties; +} + +// @public +export interface AccountQuotaProperties { + freeTrial?: AccountFreeTrialProperties; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface AccountUpdate { + properties?: AccountUpdateProperties; + tags?: Record; +} + +// @public +export interface AccountUpdateProperties { + localAuth?: EnablementStatus; + regionalAffinity?: EnablementStatus; + reporting?: EnablementStatus; + scalableExecution?: EnablementStatus; +} + +// @public +export type ActionType = string; + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export type CreatedByType = string; + +// @public +export type EnablementStatus = string; + +// @public +export interface FreeTrialProperties { + readonly accountId: string; + readonly state: FreeTrialState; +} + +// @public +export type FreeTrialState = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownEnablementStatus { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownFreeTrialState { + Active = "Active", + Expired = "Expired", + NotEligible = "NotEligible", + NotRegistered = "NotRegistered" +} + +// @public +export enum KnownOfferingType { + GeneralAvailability = "GeneralAvailability", + NotApplicable = "NotApplicable", + PrivatePreview = "PrivatePreview", + PublicPreview = "PublicPreview" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownQuotaNames { + Reporting = "Reporting", + ScalableExecution = "ScalableExecution" +} + +// @public +export enum KnownVersions { + "V2024-12-01" = "2024-12-01" +} + +// @public +export type OfferingType = string; + +// @public +export interface Operation { + actionType?: ActionType; + readonly display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Quota extends ProxyResource { + properties?: QuotaProperties; +} + +// @public +export type QuotaNames = string; + +// @public +export interface QuotaProperties { + freeTrial?: FreeTrialProperties; + readonly offeringType?: OfferingType; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting.api.md b/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting.api.md index 0b21556485ab..9ef4904afdaa 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting.api.md +++ b/sdk/playwrighttesting/arm-playwrighttesting/review/arm-playwrighttesting.api.md @@ -4,11 +4,14 @@ ```ts -import * as coreAuth from '@azure/core-auth'; -import * as coreClient from '@azure/core-client'; +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; import { OperationState } from '@azure/core-lro'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { SimplePollerLike } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; // @public export interface Account extends TrackedResource { @@ -16,14 +19,18 @@ export interface Account extends TrackedResource { } // @public -export interface AccountListResult { - nextLink?: string; - value: Account[]; +export interface AccountFreeTrialProperties { + readonly allocatedValue: number; + readonly createdAt: Date; + readonly expiryAt: Date; + readonly percentageUsed: number; + readonly usedValue: number; } // @public export interface AccountProperties { readonly dashboardUri?: string; + localAuth?: EnablementStatus; readonly provisioningState?: ProvisioningState; regionalAffinity?: EnablementStatus; reporting?: EnablementStatus; @@ -31,95 +38,80 @@ export interface AccountProperties { } // @public -export interface Accounts { - beginCreateOrUpdate(resourceGroupName: string, name: string, resource: Account, options?: AccountsCreateOrUpdateOptionalParams): Promise, AccountsCreateOrUpdateResponse>>; - beginCreateOrUpdateAndWait(resourceGroupName: string, name: string, resource: Account, options?: AccountsCreateOrUpdateOptionalParams): Promise; - beginDelete(resourceGroupName: string, name: string, options?: AccountsDeleteOptionalParams): Promise, void>>; - beginDeleteAndWait(resourceGroupName: string, name: string, options?: AccountsDeleteOptionalParams): Promise; - get(resourceGroupName: string, name: string, options?: AccountsGetOptionalParams): Promise; - listByResourceGroup(resourceGroupName: string, options?: AccountsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; - listBySubscription(options?: AccountsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; - update(resourceGroupName: string, name: string, properties: AccountUpdate, options?: AccountsUpdateOptionalParams): Promise; +export interface AccountQuota extends ProxyResource { + properties?: AccountQuotaProperties; } // @public -export interface AccountsCreateOrUpdateHeaders { - retryAfter?: number; +export interface AccountQuotaProperties { + freeTrial?: AccountFreeTrialProperties; + readonly provisioningState?: ProvisioningState; } // @public -export interface AccountsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface AccountQuotasGetOptionalParams extends OperationOptions { } // @public -export type AccountsCreateOrUpdateResponse = Account; - -// @public -export interface AccountsDeleteHeaders { - location?: string; - retryAfter?: number; +export interface AccountQuotasListByAccountOptionalParams extends OperationOptions { } // @public -export interface AccountsDeleteOptionalParams extends coreClient.OperationOptions { - resumeFrom?: string; - updateIntervalInMs?: number; +export interface AccountQuotasOperations { + get: (resourceGroupName: string, accountName: string, quotaName: QuotaNames, options?: AccountQuotasGetOptionalParams) => Promise; + listByAccount: (resourceGroupName: string, accountName: string, options?: AccountQuotasListByAccountOptionalParams) => PagedAsyncIterableIterator; } // @public -export interface AccountsGetOptionalParams extends coreClient.OperationOptions { +export interface AccountsCheckNameAvailabilityOptionalParams extends OperationOptions { } // @public -export type AccountsGetResponse = Account; - -// @public -export interface AccountsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +export interface AccountsCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type AccountsListByResourceGroupNextResponse = AccountListResult; - -// @public -export interface AccountsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +export interface AccountsDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; } // @public -export type AccountsListByResourceGroupResponse = AccountListResult; - -// @public -export interface AccountsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface AccountsGetOptionalParams extends OperationOptions { } // @public -export type AccountsListBySubscriptionNextResponse = AccountListResult; - -// @public -export interface AccountsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface AccountsListByResourceGroupOptionalParams extends OperationOptions { } // @public -export type AccountsListBySubscriptionResponse = AccountListResult; +export interface AccountsListBySubscriptionOptionalParams extends OperationOptions { +} // @public -export interface AccountsUpdateOptionalParams extends coreClient.OperationOptions { +export interface AccountsOperations { + checkNameAvailability: (body: CheckNameAvailabilityRequest, options?: AccountsCheckNameAvailabilityOptionalParams) => Promise; + createOrUpdate: (resourceGroupName: string, accountName: string, resource: Account, options?: AccountsCreateOrUpdateOptionalParams) => PollerLike, Account>; + delete: (resourceGroupName: string, accountName: string, options?: AccountsDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, accountName: string, options?: AccountsGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: AccountsListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: AccountsListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, accountName: string, properties: AccountUpdate, options?: AccountsUpdateOptionalParams) => Promise; } // @public -export type AccountsUpdateResponse = Account; +export interface AccountsUpdateOptionalParams extends OperationOptions { +} // @public export interface AccountUpdate { properties?: AccountUpdateProperties; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // @public export interface AccountUpdateProperties { + localAuth?: EnablementStatus; regionalAffinity?: EnablementStatus; reporting?: EnablementStatus; scalableExecution?: EnablementStatus; @@ -128,54 +120,68 @@ export interface AccountUpdateProperties { // @public export type ActionType = string; +// @public (undocumented) +export class AzurePlaywrightServiceClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: AzurePlaywrightServiceClientOptionalParams); + readonly accountQuotas: AccountQuotasOperations; + readonly accounts: AccountsOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly quotas: QuotasOperations; +} + // @public -export type CreatedByType = string; +export interface AzurePlaywrightServiceClientOptionalParams extends ClientOptions { + apiVersion?: string; +} // @public -export type EnablementStatus = string; +export type CheckNameAvailabilityReason = string; // @public -export interface ErrorAdditionalInfo { - readonly info?: Record; - readonly type?: string; +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; } // @public -export interface ErrorDetail { - readonly additionalInfo?: ErrorAdditionalInfo[]; - readonly code?: string; - readonly details?: ErrorDetail[]; - readonly message?: string; - readonly target?: string; +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; } // @public -export interface ErrorResponse { - error?: ErrorDetail; -} +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CreatedByType = string; + +// @public +export type EnablementStatus = string; // @public export interface FreeTrialProperties { readonly accountId: string; - readonly allocatedValue: number; - readonly createdAt: Date; - readonly expiryAt: Date; - readonly percentageUsed: number; readonly state: FreeTrialState; - readonly usedValue: number; } // @public export type FreeTrialState = string; -// @public -export function getContinuationToken(page: unknown): string | undefined; - // @public export enum KnownActionType { Internal = "Internal" } +// @public +export enum KnownCheckNameAvailabilityReason { + AlreadyExists = "AlreadyExists", + Invalid = "Invalid" +} + // @public export enum KnownCreatedByType { Application = "Application", @@ -193,7 +199,17 @@ export enum KnownEnablementStatus { // @public export enum KnownFreeTrialState { Active = "Active", - Expired = "Expired" + Expired = "Expired", + NotEligible = "NotEligible", + NotRegistered = "NotRegistered" +} + +// @public +export enum KnownOfferingType { + GeneralAvailability = "GeneralAvailability", + NotApplicable = "NotApplicable", + PrivatePreview = "PrivatePreview", + PublicPreview = "PublicPreview" } // @public @@ -207,6 +223,7 @@ export enum KnownOrigin { export enum KnownProvisioningState { Accepted = "Accepted", Canceled = "Canceled", + Creating = "Creating", Deleting = "Deleting", Failed = "Failed", Succeeded = "Succeeded" @@ -214,13 +231,22 @@ export enum KnownProvisioningState { // @public export enum KnownQuotaNames { + Reporting = "Reporting", ScalableExecution = "ScalableExecution" } +// @public +export enum KnownVersions { + "V2024-12-01" = "2024-12-01" +} + +// @public +export type OfferingType = string; + // @public export interface Operation { - readonly actionType?: ActionType; - display?: OperationDisplay; + actionType?: ActionType; + readonly display?: OperationDisplay; readonly isDataAction?: boolean; readonly name?: string; readonly origin?: Origin; @@ -235,55 +261,27 @@ export interface OperationDisplay { } // @public -export interface OperationListResult { - readonly nextLink?: string; - readonly value?: Operation[]; -} - -// @public -export interface Operations { - list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +export interface OperationsListOptionalParams extends OperationOptions { } // @public -export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; } // @public -export type OperationsListNextResponse = OperationListResult; +export type Origin = string; // @public -export interface OperationsListOptionalParams extends coreClient.OperationOptions { +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; } // @public -export type OperationsListResponse = OperationListResult; - -// @public -export type Origin = string; - -// @public (undocumented) -export class PlaywrightTestingClient extends coreClient.ServiceClient { - // (undocumented) - $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: PlaywrightTestingClientOptionalParams); - // (undocumented) - accounts: Accounts; - // (undocumented) - apiVersion: string; - // (undocumented) - operations: Operations; - // (undocumented) - quotas: Quotas; - // (undocumented) - subscriptionId: string; -} - -// @public -export interface PlaywrightTestingClientOptionalParams extends coreClient.ServiceClientOptions { - $host?: string; - apiVersion?: string; - endpoint?: string; +export interface PageSettings { + continuationToken?: string; } // @public @@ -298,48 +296,30 @@ export interface Quota extends ProxyResource { properties?: QuotaProperties; } -// @public -export interface QuotaListResult { - nextLink?: string; - value: Quota[]; -} - // @public export type QuotaNames = string; // @public export interface QuotaProperties { freeTrial?: FreeTrialProperties; + readonly offeringType?: OfferingType; readonly provisioningState?: ProvisioningState; } // @public -export interface Quotas { - get(location: string, name: QuotaNames, options?: QuotasGetOptionalParams): Promise; - listBySubscription(location: string, options?: QuotasListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +export interface QuotasGetOptionalParams extends OperationOptions { } // @public -export interface QuotasGetOptionalParams extends coreClient.OperationOptions { -} - -// @public -export type QuotasGetResponse = Quota; - -// @public -export interface QuotasListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +export interface QuotasListBySubscriptionOptionalParams extends OperationOptions { } // @public -export type QuotasListBySubscriptionNextResponse = QuotaListResult; - -// @public -export interface QuotasListBySubscriptionOptionalParams extends coreClient.OperationOptions { +export interface QuotasOperations { + get: (location: string, quotaName: QuotaNames, options?: QuotasGetOptionalParams) => Promise; + listBySubscription: (location: string, options?: QuotasListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; } -// @public -export type QuotasListBySubscriptionResponse = QuotaListResult; - // @public export interface Resource { readonly id?: string; @@ -348,6 +328,16 @@ export interface Resource { readonly type?: string; } +// @public +export function restorePoller(client: AzurePlaywrightServiceClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + // @public export interface SystemData { createdAt?: Date; @@ -361,9 +351,7 @@ export interface SystemData { // @public export interface TrackedResource extends Resource { location: string; - tags?: { - [propertyName: string]: string; - }; + tags?: Record; } // (No @packageDocumentation comment for this package) diff --git a/sdk/playwrighttesting/arm-playwrighttesting/sample.env b/sdk/playwrighttesting/arm-playwrighttesting/sample.env index 672847a3fea0..508439fc7d62 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/sample.env +++ b/sdk/playwrighttesting/arm-playwrighttesting/sample.env @@ -1,4 +1 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasGetSample.ts new file mode 100644 index 000000000000..31aadfd4bb76 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get quota by name for an account. + * + * @summary get quota by name for an account. + * x-ms-original-file: 2024-12-01/AccountQuotas_Get.json + */ +async function accountQuotasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accountQuotas.get( + "dummyrg", + "myPlaywrightAccount", + "ScalableExecution", + ); + console.log(result); +} + +async function main() { + accountQuotasGet(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasListByAccountSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasListByAccountSample.ts new file mode 100644 index 000000000000..434fd727ab03 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountQuotasListByAccountSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list quotas for a given account. + * + * @summary list quotas for a given account. + * x-ms-original-file: 2024-12-01/AccountQuotas_ListByAccount.json + */ +async function accountQuotasListByAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accountQuotas.listByAccount("dummyrg", "myPlaywrightAccount")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + accountQuotasListByAccount(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCheckNameAvailabilitySample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..eb1a83abc341 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCheckNameAvailabilitySample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to adds check global name availability operation, normally used if a resource name must be globally unique. + * + * @summary adds check global name availability operation, normally used if a resource name must be globally unique. + * x-ms-original-file: 2024-12-01/Accounts_CheckNameAvailability.json + */ +async function accountsCheckNameAvailability() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.checkNameAvailability({ + name: "dummyName", + type: "Microsoft.AzurePlaywrightService/Accounts", + }); + console.log(result); +} + +async function main() { + accountsCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCreateOrUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCreateOrUpdateSample.ts index 99e43ee54ee0..34a5b57788d7 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCreateOrUpdateSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsCreateOrUpdateSample.ts @@ -1,44 +1,24 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Account, PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Create a Account + * This sample demonstrates how to create a Account * - * @summary Create a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json + * @summary create a Account + * x-ms-original-file: 2024-12-01/Accounts_CreateOrUpdate.json */ async function accountsCreateOrUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const resource: Account = { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.createOrUpdate("dummyrg", "myPlaywrightAccount", { location: "westus", + tags: { Team: "Dev Exp" }, properties: { regionalAffinity: "Enabled" }, - tags: { team: "Dev Exp" } - }; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginCreateOrUpdateAndWait( - resourceGroupName, - name, - resource - ); + }); console.log(result); } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsDeleteSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsDeleteSample.ts index 8ffc41ea3061..cf2b1524d848 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsDeleteSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsDeleteSample.ts @@ -1,39 +1,20 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Delete a Account + * This sample demonstrates how to delete a Account * - * @summary Delete a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json + * @summary delete a Account + * x-ms-original-file: 2024-12-01/Accounts_Delete.json */ async function accountsDelete() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginDeleteAndWait( - resourceGroupName, - name - ); - console.log(result); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + await client.accounts.delete("dummyrg", "myPlaywrightAccount"); } async function main() { diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsGetSample.ts deleted file mode 100644 index b861ded65f35..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsGetSample.ts +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a Account - * - * @summary Get a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - */ -async function accountsGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.get(resourceGroupName, name); - console.log(result); -} - -async function main() { - accountsGet(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListByResourceGroupSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListByResourceGroupSample.ts deleted file mode 100644 index 9b5b26e2a371..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List Account resources by resource group - * - * @summary List Account resources by resource group - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json - */ -async function accountsListByResourceGroup() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListBySubscriptionSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListBySubscriptionSample.ts deleted file mode 100644 index 333806a6c07b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsListBySubscriptionSample.ts +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List Account resources by subscription ID - * - * @summary List Account resources by subscription ID - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json - */ -async function accountsListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsUpdateSample.ts index 558728376361..db8aaa5353c6 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsUpdateSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/accountsUpdateSample.ts @@ -1,46 +1,23 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { - AccountUpdate, - PlaywrightTestingClient -} from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Update a Account + * This sample demonstrates how to update a Account * - * @summary Update a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json + * @summary update a Account + * x-ms-original-file: 2024-12-01/Accounts_Update.json */ async function accountsUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const properties: AccountUpdate = { - properties: { regionalAffinity: "Enabled" }, - tags: { division: "LT", team: "Dev Exp" } - }; const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.update( - resourceGroupName, - name, - properties - ); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.update("dummyrg", "myPlaywrightAccount", { + tags: { Team: "Dev Exp", Division: "LT" }, + properties: { regionalAffinity: "Enabled" }, + }); console.log(result); } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/operationsListSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/operationsListSample.ts index a7d239bca8d2..322f8e407c81 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/operationsListSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/operationsListSample.ts @@ -1,35 +1,24 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to List the operations for the provider + * This sample demonstrates how to list the operations for the provider * - * @summary List the operations for the provider - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json + * @summary list the operations for the provider + * x-ms-original-file: 2024-12-01/Operations_List.json */ async function operationsList() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); const resArray = new Array(); for await (let item of client.operations.list()) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasGetSample.ts index 2656f6a7ff3b..45998271d50f 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasGetSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasGetSample.ts @@ -1,34 +1,20 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to Get quota by name. + * This sample demonstrates how to get subscription quota by name. * - * @summary Get quota by name. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json + * @summary get subscription quota by name. + * x-ms-original-file: 2024-12-01/Quotas_Get.json */ async function quotasGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; - const name = "ScalableExecution"; const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.quotas.get(location, name); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.quotas.get("eastus", "ScalableExecution"); console.log(result); } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasListBySubscriptionSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasListBySubscriptionSample.ts index eb0c566fd45c..560793ab289a 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasListBySubscriptionSample.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples-dev/quotasListBySubscriptionSample.ts @@ -1,36 +1,24 @@ -/* - * 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. - */ - // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to List quotas for a given subscription Id. + * This sample demonstrates how to list quotas for a given subscription Id. * - * @summary List quotas for a given subscription Id. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json + * @summary list quotas for a given subscription Id. + * x-ms-original-file: 2024-12-01/Quotas_ListBySubscription.json */ async function quotasListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.quotas.listBySubscription(location)) { + for await (let item of client.quotas.listBySubscription("eastus")) { resArray.push(item); } + console.log(resArray); } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/README.md b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/README.md deleted file mode 100644 index c9c8d747235a..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [accountsCreateOrUpdateSample.js][accountscreateorupdatesample] | Create a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json | -| [accountsDeleteSample.js][accountsdeletesample] | Delete a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json | -| [accountsGetSample.js][accountsgetsample] | Get a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json | -| [accountsListByResourceGroupSample.js][accountslistbyresourcegroupsample] | List Account resources by resource group x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json | -| [accountsListBySubscriptionSample.js][accountslistbysubscriptionsample] | List Account resources by subscription ID x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json | -| [accountsUpdateSample.js][accountsupdatesample] | Update a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json | -| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json | -| [quotasGetSample.js][quotasgetsample] | Get quota by name. x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json | -| [quotasListBySubscriptionSample.js][quotaslistbysubscriptionsample] | List quotas for a given subscription Id. x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node accountsCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env PLAYWRIGHTTESTING_SUBSCRIPTION_ID="" PLAYWRIGHTTESTING_RESOURCE_GROUP="" node accountsCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[accountscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsCreateOrUpdateSample.js -[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsDeleteSample.js -[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsGetSample.js -[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListByResourceGroupSample.js -[accountslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListBySubscriptionSample.js -[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsUpdateSample.js -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/operationsListSample.js -[quotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasGetSample.js -[quotaslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasListBySubscriptionSample.js -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/README.md diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsCreateOrUpdateSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsCreateOrUpdateSample.js deleted file mode 100644 index 5fd51252cfe3..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsCreateOrUpdateSample.js +++ /dev/null @@ -1,45 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create a Account - * - * @summary Create a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json - */ -async function accountsCreateOrUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const resource = { - location: "westus", - properties: { regionalAffinity: "Enabled" }, - tags: { team: "Dev Exp" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginCreateOrUpdateAndWait( - resourceGroupName, - name, - resource, - ); - console.log(result); -} - -async function main() { - accountsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsDeleteSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsDeleteSample.js deleted file mode 100644 index efd6706fd78c..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsDeleteSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete a Account - * - * @summary Delete a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json - */ -async function accountsDelete() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginDeleteAndWait(resourceGroupName, name); - console.log(result); -} - -async function main() { - accountsDelete(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsGetSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsGetSample.js deleted file mode 100644 index 912d54322f40..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsGetSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get a Account - * - * @summary Get a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - */ -async function accountsGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.get(resourceGroupName, name); - console.log(result); -} - -async function main() { - accountsGet(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListByResourceGroupSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListByResourceGroupSample.js deleted file mode 100644 index cdf2895d2285..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListByResourceGroupSample.js +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Account resources by resource group - * - * @summary List Account resources by resource group - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json - */ -async function accountsListByResourceGroup() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListBySubscriptionSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListBySubscriptionSample.js deleted file mode 100644 index bf4ff79ffc3c..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsListBySubscriptionSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List Account resources by subscription ID - * - * @summary List Account resources by subscription ID - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json - */ -async function accountsListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsUpdateSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsUpdateSample.js deleted file mode 100644 index 0006112ba3b8..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/accountsUpdateSample.js +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update a Account - * - * @summary Update a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json - */ -async function accountsUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const properties = { - properties: { regionalAffinity: "Enabled" }, - tags: { division: "LT", team: "Dev Exp" }, - }; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.update(resourceGroupName, name, properties); - console.log(result); -} - -async function main() { - accountsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/operationsListSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/operationsListSample.js deleted file mode 100644 index abe53cad2326..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasGetSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasGetSample.js deleted file mode 100644 index 003b45762792..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasGetSample.js +++ /dev/null @@ -1,36 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get quota by name. - * - * @summary Get quota by name. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - */ -async function quotasGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; - const name = "ScalableExecution"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.quotas.get(location, name); - console.log(result); -} - -async function main() { - quotasGet(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasListBySubscriptionSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasListBySubscriptionSample.js deleted file mode 100644 index dd7b01544747..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/quotasListBySubscriptionSample.js +++ /dev/null @@ -1,38 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { PlaywrightTestingClient } = require("@azure/arm-playwrighttesting"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List quotas for a given subscription Id. - * - * @summary List quotas for a given subscription Id. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json - */ -async function quotasListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.quotas.listBySubscription(location)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - quotasListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/sample.env b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/README.md b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/README.md deleted file mode 100644 index 3f7862859baa..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [accountsCreateOrUpdateSample.ts][accountscreateorupdatesample] | Create a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json | -| [accountsDeleteSample.ts][accountsdeletesample] | Delete a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json | -| [accountsGetSample.ts][accountsgetsample] | Get a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json | -| [accountsListByResourceGroupSample.ts][accountslistbyresourcegroupsample] | List Account resources by resource group x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json | -| [accountsListBySubscriptionSample.ts][accountslistbysubscriptionsample] | List Account resources by subscription ID x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json | -| [accountsUpdateSample.ts][accountsupdatesample] | Update a Account x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json | -| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json | -| [quotasGetSample.ts][quotasgetsample] | Get quota by name. x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json | -| [quotasListBySubscriptionSample.ts][quotaslistbysubscriptionsample] | List quotas for a given subscription Id. x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/accountsCreateOrUpdateSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env PLAYWRIGHTTESTING_SUBSCRIPTION_ID="" PLAYWRIGHTTESTING_RESOURCE_GROUP="" node dist/accountsCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[accountscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsCreateOrUpdateSample.ts -[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsDeleteSample.ts -[accountsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsGetSample.ts -[accountslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListByResourceGroupSample.ts -[accountslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListBySubscriptionSample.ts -[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsUpdateSample.ts -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/operationsListSample.ts -[quotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasGetSample.ts -[quotaslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasListBySubscriptionSample.ts -[apiref]: https://learn.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/sample.env b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsCreateOrUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsCreateOrUpdateSample.ts deleted file mode 100644 index 99e43ee54ee0..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsCreateOrUpdateSample.ts +++ /dev/null @@ -1,49 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { Account, PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Create a Account - * - * @summary Create a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_CreateOrUpdate.json - */ -async function accountsCreateOrUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const resource: Account = { - location: "westus", - properties: { regionalAffinity: "Enabled" }, - tags: { team: "Dev Exp" } - }; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginCreateOrUpdateAndWait( - resourceGroupName, - name, - resource - ); - console.log(result); -} - -async function main() { - accountsCreateOrUpdate(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsDeleteSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsDeleteSample.ts deleted file mode 100644 index 8ffc41ea3061..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsDeleteSample.ts +++ /dev/null @@ -1,43 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete a Account - * - * @summary Delete a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Delete.json - */ -async function accountsDelete() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.beginDeleteAndWait( - resourceGroupName, - name - ); - console.log(result); -} - -async function main() { - accountsDelete(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsGetSample.ts deleted file mode 100644 index b861ded65f35..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsGetSample.ts +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get a Account - * - * @summary Get a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Get.json - */ -async function accountsGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.get(resourceGroupName, name); - console.log(result); -} - -async function main() { - accountsGet(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListByResourceGroupSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListByResourceGroupSample.ts deleted file mode 100644 index 9b5b26e2a371..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List Account resources by resource group - * - * @summary List Account resources by resource group - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListByResourceGroup.json - */ -async function accountsListByResourceGroup() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListBySubscriptionSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListBySubscriptionSample.ts deleted file mode 100644 index 333806a6c07b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsListBySubscriptionSample.ts +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List Account resources by subscription ID - * - * @summary List Account resources by subscription ID - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_ListBySubscription.json - */ -async function accountsListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.accounts.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - accountsListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsUpdateSample.ts deleted file mode 100644 index 558728376361..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/accountsUpdateSample.ts +++ /dev/null @@ -1,51 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - AccountUpdate, - PlaywrightTestingClient -} from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Update a Account - * - * @summary Update a Account - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Accounts_Update.json - */ -async function accountsUpdate() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["PLAYWRIGHTTESTING_RESOURCE_GROUP"] || "dummyrg"; - const name = "myPlaywrightAccount"; - const properties: AccountUpdate = { - properties: { regionalAffinity: "Enabled" }, - tags: { division: "LT", team: "Dev Exp" } - }; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.accounts.update( - resourceGroupName, - name, - properties - ); - console.log(result); -} - -async function main() { - accountsUpdate(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/operationsListSample.ts deleted file mode 100644 index a7d239bca8d2..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,40 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasGetSample.ts deleted file mode 100644 index 2656f6a7ff3b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasGetSample.ts +++ /dev/null @@ -1,39 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get quota by name. - * - * @summary Get quota by name. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_Get.json - */ -async function quotasGet() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; - const name = "ScalableExecution"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const result = await client.quotas.get(location, name); - console.log(result); -} - -async function main() { - quotasGet(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasListBySubscriptionSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasListBySubscriptionSample.ts deleted file mode 100644 index eb0c566fd45c..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/src/quotasListBySubscriptionSample.ts +++ /dev/null @@ -1,41 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { PlaywrightTestingClient } from "@azure/arm-playwrighttesting"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List quotas for a given subscription Id. - * - * @summary List quotas for a given subscription Id. - * x-ms-original-file: specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/preview/2023-10-01-preview/examples/Quotas_ListBySubscription.json - */ -async function quotasListBySubscription() { - const subscriptionId = - process.env["PLAYWRIGHTTESTING_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const location = "eastus"; - const credential = new DefaultAzureCredential(); - const client = new PlaywrightTestingClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.quotas.listBySubscription(location)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - quotasListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/README.md b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/README.md new file mode 100644 index 000000000000..81b8de7fecf8 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/README.md @@ -0,0 +1,66 @@ +# @azure/arm-playwrighttesting client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for @azure/arm-playwrighttesting in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accountQuotasGetSample.js][accountquotasgetsample] | get quota by name for an account. x-ms-original-file: 2024-12-01/AccountQuotas_Get.json | +| [accountQuotasListByAccountSample.js][accountquotaslistbyaccountsample] | list quotas for a given account. x-ms-original-file: 2024-12-01/AccountQuotas_ListByAccount.json | +| [accountsCheckNameAvailabilitySample.js][accountschecknameavailabilitysample] | adds check global name availability operation, normally used if a resource name must be globally unique. x-ms-original-file: 2024-12-01/Accounts_CheckNameAvailability.json | +| [accountsCreateOrUpdateSample.js][accountscreateorupdatesample] | create a Account x-ms-original-file: 2024-12-01/Accounts_CreateOrUpdate.json | +| [accountsDeleteSample.js][accountsdeletesample] | delete a Account x-ms-original-file: 2024-12-01/Accounts_Delete.json | +| [accountsUpdateSample.js][accountsupdatesample] | update a Account x-ms-original-file: 2024-12-01/Accounts_Update.json | +| [operationsListSample.js][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-12-01/Operations_List.json | +| [quotasGetSample.js][quotasgetsample] | get subscription quota by name. x-ms-original-file: 2024-12-01/Quotas_Get.json | +| [quotasListBySubscriptionSample.js][quotaslistbysubscriptionsample] | list quotas for a given subscription Id. x-ms-original-file: 2024-12-01/Quotas_ListBySubscription.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node accountQuotasGetSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx dev-tool run vendored cross-env node accountQuotasGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountquotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasGetSample.js +[accountquotaslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasListByAccountSample.js +[accountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCheckNameAvailabilitySample.js +[accountscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCreateOrUpdateSample.js +[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsDeleteSample.js +[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsUpdateSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/operationsListSample.js +[quotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasGetSample.js +[quotaslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasListBySubscriptionSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/README.md diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasGetSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasGetSample.js new file mode 100644 index 000000000000..3014c0883bcb --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasGetSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get quota by name for an account. + * + * @summary get quota by name for an account. + * x-ms-original-file: 2024-12-01/AccountQuotas_Get.json + */ +async function accountQuotasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accountQuotas.get( + "dummyrg", + "myPlaywrightAccount", + "ScalableExecution", + ); + console.log(result); +} + +async function main() { + accountQuotasGet(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasListByAccountSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasListByAccountSample.js new file mode 100644 index 000000000000..f3bd1547e73c --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountQuotasListByAccountSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list quotas for a given account. + * + * @summary list quotas for a given account. + * x-ms-original-file: 2024-12-01/AccountQuotas_ListByAccount.json + */ +async function accountQuotasListByAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accountQuotas.listByAccount("dummyrg", "myPlaywrightAccount")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + accountQuotasListByAccount(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCheckNameAvailabilitySample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..5217fa38e784 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCheckNameAvailabilitySample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to adds check global name availability operation, normally used if a resource name must be globally unique. + * + * @summary adds check global name availability operation, normally used if a resource name must be globally unique. + * x-ms-original-file: 2024-12-01/Accounts_CheckNameAvailability.json + */ +async function accountsCheckNameAvailability() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.checkNameAvailability({ + name: "dummyName", + type: "Microsoft.AzurePlaywrightService/Accounts", + }); + console.log(result); +} + +async function main() { + accountsCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCreateOrUpdateSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCreateOrUpdateSample.js new file mode 100644 index 000000000000..048a1d4911e7 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsCreateOrUpdateSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to create a Account + * + * @summary create a Account + * x-ms-original-file: 2024-12-01/Accounts_CreateOrUpdate.json + */ +async function accountsCreateOrUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.createOrUpdate("dummyrg", "myPlaywrightAccount", { + location: "westus", + tags: { Team: "Dev Exp" }, + properties: { regionalAffinity: "Enabled" }, + }); + console.log(result); +} + +async function main() { + accountsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsDeleteSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsDeleteSample.js new file mode 100644 index 000000000000..45b7626c120d --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsDeleteSample.js @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to delete a Account + * + * @summary delete a Account + * x-ms-original-file: 2024-12-01/Accounts_Delete.json + */ +async function accountsDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + await client.accounts.delete("dummyrg", "myPlaywrightAccount"); +} + +async function main() { + accountsDelete(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsUpdateSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsUpdateSample.js new file mode 100644 index 000000000000..040d0f8251f8 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/accountsUpdateSample.js @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to update a Account + * + * @summary update a Account + * x-ms-original-file: 2024-12-01/Accounts_Update.json + */ +async function accountsUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.update("dummyrg", "myPlaywrightAccount", { + tags: { Team: "Dev Exp", Division: "LT" }, + properties: { regionalAffinity: "Enabled" }, + }); + console.log(result); +} + +async function main() { + accountsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/operationsListSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/operationsListSample.js new file mode 100644 index 000000000000..5d242e707078 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/operationsListSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2024-12-01/Operations_List.json + */ +async function operationsList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + operationsList(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/package.json b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/package.json similarity index 77% rename from sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/package.json rename to sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/package.json index 9140e33f9aa5..6f43e9f0cbc3 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/javascript/package.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-playwrighttesting-js-beta", + "name": "@azure-samples/arm-playwrighttesting-js", "private": true, "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", + "description": "@azure/arm-playwrighttesting client library samples for JavaScript", "engines": { "node": ">=18.0.0" }, @@ -14,6 +14,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -25,7 +26,7 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting", "dependencies": { - "@azure/arm-playwrighttesting": "next", + "@azure/arm-playwrighttesting": "latest", "dotenv": "latest", "@azure/identity": "^4.2.1" } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasGetSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasGetSample.js new file mode 100644 index 000000000000..66ce05a1affb --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasGetSample.js @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to get subscription quota by name. + * + * @summary get subscription quota by name. + * x-ms-original-file: 2024-12-01/Quotas_Get.json + */ +async function quotasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.quotas.get("eastus", "ScalableExecution"); + console.log(result); +} + +async function main() { + quotasGet(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasListBySubscriptionSample.js b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasListBySubscriptionSample.js new file mode 100644 index 000000000000..67a1bd2f325a --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/quotasListBySubscriptionSample.js @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +const { AzurePlaywrightServiceClient } = require("@azure/arm-playwrighttesting"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to list quotas for a given subscription Id. + * + * @summary list quotas for a given subscription Id. + * x-ms-original-file: 2024-12-01/Quotas_ListBySubscription.json + */ +async function quotasListBySubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.quotas.listBySubscription("eastus")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + quotasListBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/sample.env b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/javascript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/README.md b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/README.md new file mode 100644 index 000000000000..43454f55870d --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/README.md @@ -0,0 +1,79 @@ +# @azure/arm-playwrighttesting client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for @azure/arm-playwrighttesting in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accountQuotasGetSample.ts][accountquotasgetsample] | get quota by name for an account. x-ms-original-file: 2024-12-01/AccountQuotas_Get.json | +| [accountQuotasListByAccountSample.ts][accountquotaslistbyaccountsample] | list quotas for a given account. x-ms-original-file: 2024-12-01/AccountQuotas_ListByAccount.json | +| [accountsCheckNameAvailabilitySample.ts][accountschecknameavailabilitysample] | adds check global name availability operation, normally used if a resource name must be globally unique. x-ms-original-file: 2024-12-01/Accounts_CheckNameAvailability.json | +| [accountsCreateOrUpdateSample.ts][accountscreateorupdatesample] | create a Account x-ms-original-file: 2024-12-01/Accounts_CreateOrUpdate.json | +| [accountsDeleteSample.ts][accountsdeletesample] | delete a Account x-ms-original-file: 2024-12-01/Accounts_Delete.json | +| [accountsUpdateSample.ts][accountsupdatesample] | update a Account x-ms-original-file: 2024-12-01/Accounts_Update.json | +| [operationsListSample.ts][operationslistsample] | list the operations for the provider x-ms-original-file: 2024-12-01/Operations_List.json | +| [quotasGetSample.ts][quotasgetsample] | get subscription quota by name. x-ms-original-file: 2024-12-01/Quotas_Get.json | +| [quotasListBySubscriptionSample.ts][quotaslistbysubscriptionsample] | list quotas for a given subscription Id. x-ms-original-file: 2024-12-01/Quotas_ListBySubscription.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/accountQuotasGetSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx dev-tool run vendored cross-env node dist/accountQuotasGetSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accountquotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasGetSample.ts +[accountquotaslistbyaccountsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasListByAccountSample.ts +[accountschecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCheckNameAvailabilitySample.ts +[accountscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCreateOrUpdateSample.ts +[accountsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsDeleteSample.ts +[accountsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsUpdateSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/operationsListSample.ts +[quotasgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasGetSample.ts +[quotaslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasListBySubscriptionSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-playwrighttesting?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/package.json b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/package.json similarity index 78% rename from sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/package.json rename to sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/package.json index 58b277c4bb7d..c97993f95023 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/package.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/package.json @@ -1,8 +1,8 @@ { - "name": "@azure-samples/arm-playwrighttesting-ts-beta", + "name": "@azure-samples/arm-playwrighttesting-ts", "private": true, "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", + "description": "@azure/arm-playwrighttesting client library samples for TypeScript", "engines": { "node": ">=18.0.0" }, @@ -18,6 +18,7 @@ "keywords": [ "node", "azure", + "cloud", "typescript", "browser", "isomorphic" @@ -29,13 +30,13 @@ }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/arm-playwrighttesting", "dependencies": { - "@azure/arm-playwrighttesting": "next", + "@azure/arm-playwrighttesting": "latest", "dotenv": "latest", "@azure/identity": "^4.2.1" }, "devDependencies": { "@types/node": "^18.0.0", - "typescript": "~5.7.2", + "typescript": "~5.6.2", "rimraf": "latest" } } diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/sample.env b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..508439fc7d62 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasGetSample.ts new file mode 100644 index 000000000000..31aadfd4bb76 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasGetSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get quota by name for an account. + * + * @summary get quota by name for an account. + * x-ms-original-file: 2024-12-01/AccountQuotas_Get.json + */ +async function accountQuotasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accountQuotas.get( + "dummyrg", + "myPlaywrightAccount", + "ScalableExecution", + ); + console.log(result); +} + +async function main() { + accountQuotasGet(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasListByAccountSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasListByAccountSample.ts new file mode 100644 index 000000000000..434fd727ab03 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountQuotasListByAccountSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list quotas for a given account. + * + * @summary list quotas for a given account. + * x-ms-original-file: 2024-12-01/AccountQuotas_ListByAccount.json + */ +async function accountQuotasListByAccount() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accountQuotas.listByAccount("dummyrg", "myPlaywrightAccount")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + accountQuotasListByAccount(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCheckNameAvailabilitySample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..eb1a83abc341 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCheckNameAvailabilitySample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to adds check global name availability operation, normally used if a resource name must be globally unique. + * + * @summary adds check global name availability operation, normally used if a resource name must be globally unique. + * x-ms-original-file: 2024-12-01/Accounts_CheckNameAvailability.json + */ +async function accountsCheckNameAvailability() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.checkNameAvailability({ + name: "dummyName", + type: "Microsoft.AzurePlaywrightService/Accounts", + }); + console.log(result); +} + +async function main() { + accountsCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCreateOrUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..34a5b57788d7 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsCreateOrUpdateSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Account + * + * @summary create a Account + * x-ms-original-file: 2024-12-01/Accounts_CreateOrUpdate.json + */ +async function accountsCreateOrUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.createOrUpdate("dummyrg", "myPlaywrightAccount", { + location: "westus", + tags: { Team: "Dev Exp" }, + properties: { regionalAffinity: "Enabled" }, + }); + console.log(result); +} + +async function main() { + accountsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsDeleteSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsDeleteSample.ts new file mode 100644 index 000000000000..cf2b1524d848 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsDeleteSample.ts @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Account + * + * @summary delete a Account + * x-ms-original-file: 2024-12-01/Accounts_Delete.json + */ +async function accountsDelete() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + await client.accounts.delete("dummyrg", "myPlaywrightAccount"); +} + +async function main() { + accountsDelete(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsUpdateSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsUpdateSample.ts new file mode 100644 index 000000000000..db8aaa5353c6 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/accountsUpdateSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a Account + * + * @summary update a Account + * x-ms-original-file: 2024-12-01/Accounts_Update.json + */ +async function accountsUpdate() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.accounts.update("dummyrg", "myPlaywrightAccount", { + tags: { Team: "Dev Exp", Division: "LT" }, + properties: { regionalAffinity: "Enabled" }, + }); + console.log(result); +} + +async function main() { + accountsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/operationsListSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..322f8e407c81 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/operationsListSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2024-12-01/Operations_List.json + */ +async function operationsList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + operationsList(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasGetSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasGetSample.ts new file mode 100644 index 000000000000..45998271d50f --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasGetSample.ts @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get subscription quota by name. + * + * @summary get subscription quota by name. + * x-ms-original-file: 2024-12-01/Quotas_Get.json + */ +async function quotasGet() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const result = await client.quotas.get("eastus", "ScalableExecution"); + console.log(result); +} + +async function main() { + quotasGet(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasListBySubscriptionSample.ts b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasListBySubscriptionSample.ts new file mode 100644 index 000000000000..560793ab289a --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/src/quotasListBySubscriptionSample.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "@azure/arm-playwrighttesting"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list quotas for a given subscription Id. + * + * @summary list quotas for a given subscription Id. + * x-ms-original-file: 2024-12-01/Quotas_ListBySubscription.json + */ +async function quotasListBySubscription() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const client = new AzurePlaywrightServiceClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.quotas.listBySubscription("eastus")) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + quotasListBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/tsconfig.json b/sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/tsconfig.json similarity index 100% rename from sdk/playwrighttesting/arm-playwrighttesting/samples/v1-beta/typescript/tsconfig.json rename to sdk/playwrighttesting/arm-playwrighttesting/samples/v1/typescript/tsconfig.json diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/accountQuotas/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/accountQuotas/index.ts new file mode 100644 index 000000000000..7c7c6ca7ccb1 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/accountQuotas/index.ts @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AccountQuotasGetOptionalParams, + AccountQuotasListByAccountOptionalParams, + AzurePlaywrightServiceContext as Client, +} from "../index.js"; +import { + AccountQuota, + accountQuotaDeserializer, + QuotaNames, + _AccountQuotaListResult, + _accountQuotaListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _accountQuotasGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + quotaName: QuotaNames, + options: AccountQuotasGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}", + subscriptionId, + resourceGroupName, + accountName, + quotaName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountQuotasGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return accountQuotaDeserializer(result.body); +} + +/** Get quota by name for an account. */ +export async function accountQuotasGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + quotaName: QuotaNames, + options: AccountQuotasGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _accountQuotasGetSend( + context, + subscriptionId, + resourceGroupName, + accountName, + quotaName, + options, + ); + return _accountQuotasGetDeserialize(result); +} + +export function _accountQuotasListByAccountSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountQuotasListByAccountOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas", + subscriptionId, + resourceGroupName, + accountName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountQuotasListByAccountDeserialize( + result: PathUncheckedResponse, +): Promise<_AccountQuotaListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _accountQuotaListResultDeserializer(result.body); +} + +/** List quotas for a given account. */ +export function accountQuotasListByAccount( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountQuotasListByAccountOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _accountQuotasListByAccountSend( + context, + subscriptionId, + resourceGroupName, + accountName, + options, + ), + _accountQuotasListByAccountDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/accounts/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/accounts/index.ts new file mode 100644 index 000000000000..241e586f02a3 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/accounts/index.ts @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AccountsCheckNameAvailabilityOptionalParams, + AccountsCreateOrUpdateOptionalParams, + AccountsDeleteOptionalParams, + AccountsGetOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountsListBySubscriptionOptionalParams, + AccountsUpdateOptionalParams, + AzurePlaywrightServiceContext as Client, +} from "../index.js"; +import { + Account, + accountSerializer, + accountDeserializer, + AccountUpdate, + accountUpdateSerializer, + _AccountListResult, + _accountListResultDeserializer, + CheckNameAvailabilityRequest, + checkNameAvailabilityRequestSerializer, + CheckNameAvailabilityResponse, + checkNameAvailabilityResponseDeserializer, +} from "../../models/models.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _accountsGetSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountsGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + subscriptionId, + resourceGroupName, + accountName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountsGetDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return accountDeserializer(result.body); +} + +/** Get a Account */ +export async function accountsGet( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountsGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _accountsGetSend( + context, + subscriptionId, + resourceGroupName, + accountName, + options, + ); + return _accountsGetDeserialize(result); +} + +export function _accountsCreateOrUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + resource: Account, + options: AccountsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + subscriptionId, + resourceGroupName, + accountName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + body: accountSerializer(resource), + }); +} + +export async function _accountsCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return accountDeserializer(result.body); +} + +/** Create a Account */ +export function accountsCreateOrUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + resource: Account, + options: AccountsCreateOrUpdateOptionalParams = { requestOptions: {} }, +): PollerLike, Account> { + return getLongRunningPoller(context, _accountsCreateOrUpdateDeserialize, ["200", "201"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _accountsCreateOrUpdateSend( + context, + subscriptionId, + resourceGroupName, + accountName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }) as PollerLike, Account>; +} + +export function _accountsUpdateSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + properties: AccountUpdate, + options: AccountsUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + subscriptionId, + resourceGroupName, + accountName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + body: accountUpdateSerializer(properties), + }); +} + +export async function _accountsUpdateDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return accountDeserializer(result.body); +} + +/** Update a Account */ +export async function accountsUpdate( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + properties: AccountUpdate, + options: AccountsUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _accountsUpdateSend( + context, + subscriptionId, + resourceGroupName, + accountName, + properties, + options, + ); + return _accountsUpdateDeserialize(result); +} + +export function _accountsDeleteSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountsDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}", + subscriptionId, + resourceGroupName, + accountName, + ) + .delete({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountsDeleteDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return; +} + +/** Delete a Account */ +export function accountsDelete( + context: Client, + subscriptionId: string, + resourceGroupName: string, + accountName: string, + options: AccountsDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller(context, _accountsDeleteDeserialize, ["202", "204", "200"], { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _accountsDeleteSend(context, subscriptionId, resourceGroupName, accountName, options), + resourceLocationConfig: "location", + }) as PollerLike, void>; +} + +export function _accountsListByResourceGroupSend( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AccountsListByResourceGroupOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts", + subscriptionId, + resourceGroupName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountsListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_AccountListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _accountListResultDeserializer(result.body); +} + +/** List Account resources by resource group */ +export function accountsListByResourceGroup( + context: Client, + subscriptionId: string, + resourceGroupName: string, + options: AccountsListByResourceGroupOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _accountsListByResourceGroupSend(context, subscriptionId, resourceGroupName, options), + _accountsListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _accountsListBySubscriptionSend( + context: Client, + subscriptionId: string, + options: AccountsListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts", + subscriptionId, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _accountsListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_AccountListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _accountListResultDeserializer(result.body); +} + +/** List Account resources by subscription ID */ +export function accountsListBySubscription( + context: Client, + subscriptionId: string, + options: AccountsListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _accountsListBySubscriptionSend(context, subscriptionId, options), + _accountsListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _accountsCheckNameAvailabilitySend( + context: Client, + subscriptionId: string, + body: CheckNameAvailabilityRequest, + options: AccountsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability", + subscriptionId, + ) + .post({ + ...operationOptionsToRequestParameters(options), + body: checkNameAvailabilityRequestSerializer(body), + }); +} + +export async function _accountsCheckNameAvailabilityDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return checkNameAvailabilityResponseDeserializer(result.body); +} + +/** Adds check global name availability operation, normally used if a resource name must be globally unique. */ +export async function accountsCheckNameAvailability( + context: Client, + subscriptionId: string, + body: CheckNameAvailabilityRequest, + options: AccountsCheckNameAvailabilityOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _accountsCheckNameAvailabilitySend(context, subscriptionId, body, options); + return _accountsCheckNameAvailabilityDeserialize(result); +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/azurePlaywrightServiceContext.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/azurePlaywrightServiceContext.ts new file mode 100644 index 000000000000..8315978e2b15 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/azurePlaywrightServiceContext.ts @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Microsoft.AzurePlaywrightService Resource Provider Management API. */ +export interface AzurePlaywrightServiceContext extends Client {} + +/** Optional parameters for the client. */ +export interface AzurePlaywrightServiceClientOptionalParams extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Microsoft.AzurePlaywrightService Resource Provider Management API. */ +export function createAzurePlaywrightService( + credential: TokenCredential, + options: AzurePlaywrightServiceClientOptionalParams = {}, +): AzurePlaywrightServiceContext { + const endpointUrl = options.endpoint ?? options.baseUrl ?? `https://management.azure.com`; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-playwrighttesting/1.0.0`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2024-12-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return clientContext; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/index.ts new file mode 100644 index 000000000000..c0f08c233140 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/index.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + createAzurePlaywrightService, + AzurePlaywrightServiceContext, + AzurePlaywrightServiceClientOptionalParams, +} from "./azurePlaywrightServiceContext.js"; +export { + OperationsListOptionalParams, + AccountsGetOptionalParams, + AccountsCreateOrUpdateOptionalParams, + AccountsUpdateOptionalParams, + AccountsDeleteOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountsListBySubscriptionOptionalParams, + AccountsCheckNameAvailabilityOptionalParams, + QuotasGetOptionalParams, + QuotasListBySubscriptionOptionalParams, + AccountQuotasGetOptionalParams, + AccountQuotasListByAccountOptionalParams, +} from "./options.js"; +export { accountQuotasGet, accountQuotasListByAccount } from "./accountQuotas/index.js"; +export { + accountsGet, + accountsCreateOrUpdate, + accountsUpdate, + accountsDelete, + accountsListByResourceGroup, + accountsListBySubscription, + accountsCheckNameAvailability, +} from "./accounts/index.js"; +export { operationsList } from "./operations/index.js"; +export { quotasGet, quotasListBySubscription } from "./quotas/index.js"; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/operations/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/operations/index.ts new file mode 100644 index 000000000000..bf701f7b6813 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/operations/index.ts @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceContext as Client, OperationsListOptionalParams } from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationsListSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/providers/Microsoft.AzurePlaywrightService/operations") + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _operationsListDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function operationsList( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _operationsListSend(context, options), + _operationsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/options.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/options.ts new file mode 100644 index 000000000000..15c87f9bdab8 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/options.ts @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountsGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountsCreateOrUpdateOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AccountsUpdateOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountsDeleteOptionalParams extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AccountsListByResourceGroupOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountsListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountsCheckNameAvailabilityOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface QuotasGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface QuotasListBySubscriptionOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountQuotasGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AccountQuotasListByAccountOptionalParams extends OperationOptions {} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/api/quotas/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/api/quotas/index.ts new file mode 100644 index 000000000000..ec16b6b78950 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/api/quotas/index.ts @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AzurePlaywrightServiceContext as Client, + QuotasGetOptionalParams, + QuotasListBySubscriptionOptionalParams, +} from "../index.js"; +import { + QuotaNames, + Quota, + quotaDeserializer, + _QuotaListResult, + _quotaListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _quotasGetSend( + context: Client, + subscriptionId: string, + location: string, + quotaName: QuotaNames, + options: QuotasGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}", + subscriptionId, + location, + quotaName, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _quotasGetDeserialize(result: PathUncheckedResponse): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return quotaDeserializer(result.body); +} + +/** Get subscription quota by name. */ +export async function quotasGet( + context: Client, + subscriptionId: string, + location: string, + quotaName: QuotaNames, + options: QuotasGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _quotasGetSend(context, subscriptionId, location, quotaName, options); + return _quotasGetDeserialize(result); +} + +export function _quotasListBySubscriptionSend( + context: Client, + subscriptionId: string, + location: string, + options: QuotasListBySubscriptionOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas", + subscriptionId, + location, + ) + .get({ ...operationOptionsToRequestParameters(options) }); +} + +export async function _quotasListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_QuotaListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + throw createRestError(result); + } + + return _quotaListResultDeserializer(result.body); +} + +/** List quotas for a given subscription Id. */ +export function quotasListBySubscription( + context: Client, + subscriptionId: string, + location: string, + options: QuotasListBySubscriptionOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _quotasListBySubscriptionSend(context, subscriptionId, location, options), + _quotasListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/azurePlaywrightServiceClient.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/azurePlaywrightServiceClient.ts new file mode 100644 index 000000000000..470fd2e66263 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/azurePlaywrightServiceClient.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { getOperationsOperations, OperationsOperations } from "./classic/operations/index.js"; +import { getAccountsOperations, AccountsOperations } from "./classic/accounts/index.js"; +import { getQuotasOperations, QuotasOperations } from "./classic/quotas/index.js"; +import { + getAccountQuotasOperations, + AccountQuotasOperations, +} from "./classic/accountQuotas/index.js"; +import { + createAzurePlaywrightService, + AzurePlaywrightServiceContext, + AzurePlaywrightServiceClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { AzurePlaywrightServiceClientOptionalParams } from "./api/azurePlaywrightServiceContext.js"; + +export class AzurePlaywrightServiceClient { + private _client: AzurePlaywrightServiceContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Microsoft.AzurePlaywrightService Resource Provider Management API. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: AzurePlaywrightServiceClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createAzurePlaywrightService(credential, { + ...options, + userAgentOptions: { userAgentPrefix }, + }); + this.pipeline = this._client.pipeline; + this.operations = getOperationsOperations(this._client); + this.accounts = getAccountsOperations(this._client, subscriptionId); + this.quotas = getQuotasOperations(this._client, subscriptionId); + this.accountQuotas = getAccountQuotasOperations(this._client, subscriptionId); + } + + /** The operation groups for Operations */ + public readonly operations: OperationsOperations; + /** The operation groups for Accounts */ + public readonly accounts: AccountsOperations; + /** The operation groups for Quotas */ + public readonly quotas: QuotasOperations; + /** The operation groups for AccountQuotas */ + public readonly accountQuotas: AccountQuotasOperations; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accountQuotas/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accountQuotas/index.ts new file mode 100644 index 000000000000..e264f40249f8 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accountQuotas/index.ts @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceContext } from "../../api/azurePlaywrightServiceContext.js"; +import { accountQuotasGet, accountQuotasListByAccount } from "../../api/accountQuotas/index.js"; +import { AccountQuota, QuotaNames } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { + AccountQuotasGetOptionalParams, + AccountQuotasListByAccountOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a AccountQuotas operations. */ +export interface AccountQuotasOperations { + /** Get quota by name for an account. */ + get: ( + resourceGroupName: string, + accountName: string, + quotaName: QuotaNames, + options?: AccountQuotasGetOptionalParams, + ) => Promise; + /** List quotas for a given account. */ + listByAccount: ( + resourceGroupName: string, + accountName: string, + options?: AccountQuotasListByAccountOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getAccountQuotas(context: AzurePlaywrightServiceContext, subscriptionId: string) { + return { + get: ( + resourceGroupName: string, + accountName: string, + quotaName: QuotaNames, + options?: AccountQuotasGetOptionalParams, + ) => + accountQuotasGet(context, subscriptionId, resourceGroupName, accountName, quotaName, options), + listByAccount: ( + resourceGroupName: string, + accountName: string, + options?: AccountQuotasListByAccountOptionalParams, + ) => + accountQuotasListByAccount(context, subscriptionId, resourceGroupName, accountName, options), + }; +} + +export function getAccountQuotasOperations( + context: AzurePlaywrightServiceContext, + subscriptionId: string, +): AccountQuotasOperations { + return { + ...getAccountQuotas(context, subscriptionId), + }; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accounts/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accounts/index.ts new file mode 100644 index 000000000000..cfde8e63e651 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/accounts/index.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceContext } from "../../api/azurePlaywrightServiceContext.js"; +import { + accountsGet, + accountsCreateOrUpdate, + accountsUpdate, + accountsDelete, + accountsListByResourceGroup, + accountsListBySubscription, + accountsCheckNameAvailability, +} from "../../api/accounts/index.js"; +import { + Account, + AccountUpdate, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + AccountsGetOptionalParams, + AccountsCreateOrUpdateOptionalParams, + AccountsUpdateOptionalParams, + AccountsDeleteOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountsListBySubscriptionOptionalParams, + AccountsCheckNameAvailabilityOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a Accounts operations. */ +export interface AccountsOperations { + /** Get a Account */ + get: ( + resourceGroupName: string, + accountName: string, + options?: AccountsGetOptionalParams, + ) => Promise; + /** Create a Account */ + createOrUpdate: ( + resourceGroupName: string, + accountName: string, + resource: Account, + options?: AccountsCreateOrUpdateOptionalParams, + ) => PollerLike, Account>; + /** Update a Account */ + update: ( + resourceGroupName: string, + accountName: string, + properties: AccountUpdate, + options?: AccountsUpdateOptionalParams, + ) => Promise; + /** Delete a Account */ + delete: ( + resourceGroupName: string, + accountName: string, + options?: AccountsDeleteOptionalParams, + ) => PollerLike, void>; + /** List Account resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** List Account resources by subscription ID */ + listBySubscription: ( + options?: AccountsListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** Adds check global name availability operation, normally used if a resource name must be globally unique. */ + checkNameAvailability: ( + body: CheckNameAvailabilityRequest, + options?: AccountsCheckNameAvailabilityOptionalParams, + ) => Promise; +} + +export function getAccounts(context: AzurePlaywrightServiceContext, subscriptionId: string) { + return { + get: (resourceGroupName: string, accountName: string, options?: AccountsGetOptionalParams) => + accountsGet(context, subscriptionId, resourceGroupName, accountName, options), + createOrUpdate: ( + resourceGroupName: string, + accountName: string, + resource: Account, + options?: AccountsCreateOrUpdateOptionalParams, + ) => + accountsCreateOrUpdate( + context, + subscriptionId, + resourceGroupName, + accountName, + resource, + options, + ), + update: ( + resourceGroupName: string, + accountName: string, + properties: AccountUpdate, + options?: AccountsUpdateOptionalParams, + ) => + accountsUpdate(context, subscriptionId, resourceGroupName, accountName, properties, options), + delete: ( + resourceGroupName: string, + accountName: string, + options?: AccountsDeleteOptionalParams, + ) => accountsDelete(context, subscriptionId, resourceGroupName, accountName, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams, + ) => accountsListByResourceGroup(context, subscriptionId, resourceGroupName, options), + listBySubscription: (options?: AccountsListBySubscriptionOptionalParams) => + accountsListBySubscription(context, subscriptionId, options), + checkNameAvailability: ( + body: CheckNameAvailabilityRequest, + options?: AccountsCheckNameAvailabilityOptionalParams, + ) => accountsCheckNameAvailability(context, subscriptionId, body, options), + }; +} + +export function getAccountsOperations( + context: AzurePlaywrightServiceContext, + subscriptionId: string, +): AccountsOperations { + return { + ...getAccounts(context, subscriptionId), + }; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/classic/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/index.ts new file mode 100644 index 000000000000..6c82ea65a801 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/index.ts @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { AccountQuotasOperations } from "./accountQuotas/index.js"; +export { AccountsOperations } from "./accounts/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { QuotasOperations } from "./quotas/index.js"; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/classic/operations/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/operations/index.ts new file mode 100644 index 000000000000..19f5cc7a7cb1 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/operations/index.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceContext } from "../../api/azurePlaywrightServiceContext.js"; +import { operationsList } from "../../api/operations/index.js"; +import { OperationsListOptionalParams } from "../../api/options.js"; +import { Operation } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +export function getOperations(context: AzurePlaywrightServiceContext) { + return { + list: (options?: OperationsListOptionalParams) => operationsList(context, options), + }; +} + +export function getOperationsOperations( + context: AzurePlaywrightServiceContext, +): OperationsOperations { + return { + ...getOperations(context), + }; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/classic/quotas/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/quotas/index.ts new file mode 100644 index 000000000000..1a6e7279ab36 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/classic/quotas/index.ts @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceContext } from "../../api/azurePlaywrightServiceContext.js"; +import { + QuotasGetOptionalParams, + QuotasListBySubscriptionOptionalParams, +} from "../../api/options.js"; +import { quotasGet, quotasListBySubscription } from "../../api/quotas/index.js"; +import { QuotaNames, Quota } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; + +/** Interface representing a Quotas operations. */ +export interface QuotasOperations { + /** Get subscription quota by name. */ + get: ( + location: string, + quotaName: QuotaNames, + options?: QuotasGetOptionalParams, + ) => Promise; + /** List quotas for a given subscription Id. */ + listBySubscription: ( + location: string, + options?: QuotasListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; +} + +export function getQuotas(context: AzurePlaywrightServiceContext, subscriptionId: string) { + return { + get: (location: string, quotaName: QuotaNames, options?: QuotasGetOptionalParams) => + quotasGet(context, subscriptionId, location, quotaName, options), + listBySubscription: (location: string, options?: QuotasListBySubscriptionOptionalParams) => + quotasListBySubscription(context, subscriptionId, location, options), + }; +} + +export function getQuotasOperations( + context: AzurePlaywrightServiceContext, + subscriptionId: string, +): QuotasOperations { + return { + ...getQuotas(context, subscriptionId), + }; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/helpers/serializerHelpers.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/helpers/serializerHelpers.ts new file mode 100644 index 000000000000..7518a16c2ee9 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/helpers/serializerHelpers.ts @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export function serializeRecord( + item: Record, +): Record; +export function serializeRecord( + item: Record, + serializer: (item: T) => R, +): Record; +export function serializeRecord( + item: Record, + serializer?: (item: T) => R, +): Record { + return Object.keys(item).reduce( + (acc, key) => { + if (isSupportedRecordType(item[key])) { + acc[key] = item[key] as any; + } else if (serializer) { + const value = item[key]; + if (value !== undefined) { + acc[key] = serializer(value); + } + } else { + console.warn(`Don't know how to serialize ${item[key]}`); + acc[key] = item[key] as any; + } + return acc; + }, + {} as Record, + ); +} + +function isSupportedRecordType(t: any) { + return ["number", "string", "boolean", "null"].includes(typeof t) || t instanceof Date; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/index.ts index 75ca25c171aa..b9aa6c8e53fe 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/index.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/index.ts @@ -1,13 +1,72 @@ -/* - * 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. - */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. -/// -export { getContinuationToken } from "./pagingHelper"; -export * from "./models"; -export { PlaywrightTestingClient } from "./playwrightTestingClient"; -export * from "./operationsInterfaces"; +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { AzurePlaywrightServiceClient } from "./azurePlaywrightServiceClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + AccountQuota, + AccountQuotaProperties, + AccountFreeTrialProperties, + KnownProvisioningState, + ProvisioningState, + KnownQuotaNames, + QuotaNames, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + Quota, + QuotaProperties, + FreeTrialProperties, + KnownFreeTrialState, + FreeTrialState, + KnownOfferingType, + OfferingType, + Account, + AccountProperties, + KnownEnablementStatus, + EnablementStatus, + TrackedResource, + AccountUpdate, + AccountUpdateProperties, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + KnownCheckNameAvailabilityReason, + CheckNameAvailabilityReason, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + KnownVersions, +} from "./models/index.js"; +export { + AzurePlaywrightServiceClientOptionalParams, + OperationsListOptionalParams, + AccountsGetOptionalParams, + AccountsCreateOrUpdateOptionalParams, + AccountsUpdateOptionalParams, + AccountsDeleteOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountsListBySubscriptionOptionalParams, + AccountsCheckNameAvailabilityOptionalParams, + QuotasGetOptionalParams, + QuotasListBySubscriptionOptionalParams, + AccountQuotasGetOptionalParams, + AccountQuotasListByAccountOptionalParams, +} from "./api/index.js"; +export { + AccountQuotasOperations, + AccountsOperations, + OperationsOperations, + QuotasOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/logger.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/logger.ts new file mode 100644 index 000000000000..8dfd2b1dad1d --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-playwrighttesting"); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/lroImpl.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/lroImpl.ts deleted file mode 100644 index 52f6eaacfb83..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/lroImpl.ts +++ /dev/null @@ -1,42 +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. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { AbortSignalLike } from "@azure/abort-controller"; -import { LongRunningOperation, LroResponse } from "@azure/core-lro"; - -export function createLroSpec(inputs: { - sendOperationFn: (args: any, spec: any) => Promise>; - args: Record; - spec: { - readonly requestBody?: unknown; - readonly path?: string; - readonly httpMethod: string; - } & Record; -}): LongRunningOperation { - const { args, spec, sendOperationFn } = inputs; - return { - requestMethod: spec.httpMethod, - requestPath: spec.path!, - sendInitialRequest: () => sendOperationFn(args, spec), - sendPollRequest: ( - path: string, - options?: { abortSignal?: AbortSignalLike } - ) => { - const { requestBody, ...restSpec } = spec; - return sendOperationFn(args, { - ...restSpec, - httpMethod: "GET", - path, - abortSignal: options?.abortSignal - }); - } - }; -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/models/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/models/index.ts index 6d578daa7def..af073ca53ded 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/models/index.ts +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/models/index.ts @@ -1,549 +1,42 @@ -/* - * 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"; - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface OperationListResult { - /** - * List of operations supported by the resource provider - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly value?: Operation[]; - /** - * URL to get the next set of operation list results (if there are any). - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly nextLink?: string; -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** - * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly origin?: Origin; - /** - * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly actionType?: ActionType; -} - -/** Localized display information for this particular operation. */ -export interface OperationDisplay { - /** - * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provider?: string; - /** - * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly resource?: string; - /** - * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly operation?: string; - /** - * The short, localized friendly description of the operation; suitable for tool tips and detailed views. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly description?: string; -} - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -/** The error detail. */ -export interface ErrorDetail { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; - /** - * The error details. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * The additional info. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly info?: Record; -} - -/** The response of a Account list operation. */ -export interface AccountListResult { - /** The Account items on this page */ - value: Account[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** Account properties */ -export interface AccountProperties { - /** - * The Playwright testing dashboard URI for the account resource. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly dashboardUri?: string; - /** This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. */ - regionalAffinity?: EnablementStatus; - /** When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ - scalableExecution?: EnablementStatus; - /** When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. */ - reporting?: EnablementStatus; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** - * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly id?: string; - /** - * The name of the resource - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly name?: string; - /** - * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly type?: string; - /** - * Azure Resource Manager metadata containing createdBy and modifiedBy information. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly systemData?: SystemData; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -/** The response of a Quota list operation. */ -export interface QuotaListResult { - /** The Quota items on this page */ - value: Quota[]; - /** The link to the next page of items */ - nextLink?: string; -} - -/** Quota properties */ -export interface QuotaProperties { - /** The free-trial quota. */ - freeTrial?: FreeTrialProperties; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; -} - -/** The free-trial properties */ -export interface FreeTrialProperties { - /** - * The playwright account id. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly accountId: string; - /** - * The free-trial createdAt utcDateTime. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly createdAt: Date; - /** - * The free-trial expiryAt utcDateTime. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly expiryAt: Date; - /** - * The free-trial allocated limit value eg. allocated free minutes. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly allocatedValue: number; - /** - * The free-trial used value eg. used free minutes. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly usedValue: number; - /** - * The free-trial percentage used. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly percentageUsed: number; - /** - * The free-trial state. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly state: FreeTrialState; -} - -/** The type used for update operations of the Account. */ -export interface AccountUpdate { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The updatable properties of the Account. */ - properties?: AccountUpdateProperties; -} - -/** The updatable properties of the Account. */ -export interface AccountUpdateProperties { - /** This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. */ - regionalAffinity?: EnablementStatus; - /** When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ - scalableExecution?: EnablementStatus; - /** When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. */ - reporting?: EnablementStatus; -} - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: { [propertyName: string]: string }; - /** The geo-location where the resource lives */ - location: string; -} - -/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ -export interface ProxyResource extends Resource {} - -/** An account resource */ -export interface Account extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: AccountProperties; -} - -/** A quota resource */ -export interface Quota extends ProxyResource { - /** The resource-specific properties for this resource. */ - properties?: QuotaProperties; -} - -/** Defines headers for Accounts_createOrUpdate operation. */ -export interface AccountsCreateOrUpdateHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; -} - -/** Defines headers for Accounts_delete operation. */ -export interface AccountsDeleteHeaders { - /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ - retryAfter?: number; - /** The Location header contains the URL where the status of the long running operation can be checked. */ - location?: string; -} - -/** Known values of {@link Origin} that the service accepts. */ -export enum KnownOrigin { - /** User */ - User = "user", - /** System */ - System = "system", - /** UserSystem */ - UserSystem = "user,system" -} - -/** - * Defines values for Origin. \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user** \ - * **system** \ - * **user,system** - */ -export type Origin = string; - -/** Known values of {@link ActionType} that the service accepts. */ -export enum KnownActionType { - /** Internal */ - Internal = "Internal" -} - -/** - * Defines values for ActionType. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal** - */ -export type ActionType = string; - -/** Known values of {@link EnablementStatus} that the service accepts. */ -export enum KnownEnablementStatus { - /** The feature is Enabled. */ - Enabled = "Enabled", - /** The feature is Disabled. */ - Disabled = "Disabled" -} - -/** - * Defines values for EnablementStatus. \ - * {@link KnownEnablementStatus} can be used interchangeably with EnablementStatus, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Enabled**: The feature is Enabled. \ - * **Disabled**: The feature is Disabled. - */ -export type EnablementStatus = string; - -/** Known values of {@link ProvisioningState} that the service accepts. */ -export enum KnownProvisioningState { - /** Resource has been created. */ - Succeeded = "Succeeded", - /** Resource creation failed. */ - Failed = "Failed", - /** Resource creation was canceled. */ - Canceled = "Canceled", - /** Deletion in progress */ - Deleting = "Deleting", - /** Change accepted for processing */ - Accepted = "Accepted" -} - -/** - * Defines values for ProvisioningState. \ - * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Succeeded**: Resource has been created. \ - * **Failed**: Resource creation failed. \ - * **Canceled**: Resource creation was canceled. \ - * **Deleting**: Deletion in progress \ - * **Accepted**: Change accepted for processing - */ -export type ProvisioningState = string; - -/** Known values of {@link CreatedByType} that the service accepts. */ -export enum KnownCreatedByType { - /** User */ - User = "User", - /** Application */ - Application = "Application", - /** ManagedIdentity */ - ManagedIdentity = "ManagedIdentity", - /** Key */ - Key = "Key" -} - -/** - * Defines values for CreatedByType. \ - * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User** \ - * **Application** \ - * **ManagedIdentity** \ - * **Key** - */ -export type CreatedByType = string; - -/** Known values of {@link FreeTrialState} that the service accepts. */ -export enum KnownFreeTrialState { - /** The free-trial is Active. */ - Active = "Active", - /** The free-trial is Expired. */ - Expired = "Expired" -} - -/** - * Defines values for FreeTrialState. \ - * {@link KnownFreeTrialState} can be used interchangeably with FreeTrialState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Active**: The free-trial is Active. \ - * **Expired**: The free-trial is Expired. - */ -export type FreeTrialState = string; - -/** Known values of {@link QuotaNames} that the service accepts. */ -export enum KnownQuotaNames { - /** The quota details for scalable execution feature. When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ - ScalableExecution = "ScalableExecution" -} - -/** - * Defines values for QuotaNames. \ - * {@link KnownQuotaNames} can be used interchangeably with QuotaNames, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **ScalableExecution**: The quota details for scalable execution feature. When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. - */ -export type QuotaNames = string; - -/** Optional parameters. */ -export interface OperationsListOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the list operation. */ -export type OperationsListResponse = OperationListResult; - -/** Optional parameters. */ -export interface OperationsListNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listNext operation. */ -export type OperationsListNextResponse = OperationListResult; - -/** Optional parameters. */ -export interface AccountsListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type AccountsListBySubscriptionResponse = AccountListResult; - -/** Optional parameters. */ -export interface AccountsListByResourceGroupOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroup operation. */ -export type AccountsListByResourceGroupResponse = AccountListResult; - -/** Optional parameters. */ -export interface AccountsGetOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type AccountsGetResponse = Account; - -/** Optional parameters. */ -export interface AccountsCreateOrUpdateOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Contains response data for the createOrUpdate operation. */ -export type AccountsCreateOrUpdateResponse = Account; - -/** Optional parameters. */ -export interface AccountsUpdateOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the update operation. */ -export type AccountsUpdateResponse = Account; - -/** Optional parameters. */ -export interface AccountsDeleteOptionalParams - extends coreClient.OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ - resumeFrom?: string; -} - -/** Optional parameters. */ -export interface AccountsListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type AccountsListBySubscriptionNextResponse = AccountListResult; - -/** Optional parameters. */ -export interface AccountsListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listByResourceGroupNext operation. */ -export type AccountsListByResourceGroupNextResponse = AccountListResult; - -/** Optional parameters. */ -export interface QuotasListBySubscriptionOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscription operation. */ -export type QuotasListBySubscriptionResponse = QuotaListResult; - -/** Optional parameters. */ -export interface QuotasGetOptionalParams extends coreClient.OperationOptions {} - -/** Contains response data for the get operation. */ -export type QuotasGetResponse = Quota; - -/** Optional parameters. */ -export interface QuotasListBySubscriptionNextOptionalParams - extends coreClient.OperationOptions {} - -/** Contains response data for the listBySubscriptionNext operation. */ -export type QuotasListBySubscriptionNextResponse = QuotaListResult; - -/** Optional parameters. */ -export interface PlaywrightTestingClientOptionalParams - extends coreClient.ServiceClientOptions { - /** server parameter */ - $host?: string; - /** Api Version */ - apiVersion?: string; - /** Overrides client endpoint. */ - endpoint?: string; -} +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + AccountQuota, + AccountQuotaProperties, + AccountFreeTrialProperties, + KnownProvisioningState, + ProvisioningState, + KnownQuotaNames, + QuotaNames, + ProxyResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + Quota, + QuotaProperties, + FreeTrialProperties, + KnownFreeTrialState, + FreeTrialState, + KnownOfferingType, + OfferingType, + Account, + AccountProperties, + KnownEnablementStatus, + EnablementStatus, + TrackedResource, + AccountUpdate, + AccountUpdateProperties, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + KnownCheckNameAvailabilityReason, + CheckNameAvailabilityReason, + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + KnownVersions, +} from "./models.js"; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/models/mappers.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/models/mappers.ts deleted file mode 100644 index 3aef08e4bc08..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/models/mappers.ts +++ /dev/null @@ -1,640 +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"; - -export const OperationListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "value", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Operation: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - isDataAction: { - serializedName: "isDataAction", - readOnly: true, - type: { - name: "Boolean" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - readOnly: true, - type: { - name: "String" - } - }, - actionType: { - serializedName: "actionType", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const OperationDisplay: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - readOnly: true, - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - readOnly: true, - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - readOnly: true, - type: { - name: "String" - } - }, - description: { - serializedName: "description", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponse: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail" - } - } - } - } -}; - -export const ErrorDetail: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String" - } - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String" - } - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String" - } - }, - details: { - serializedName: "details", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail" - } - } - } - }, - additionalInfo: { - serializedName: "additionalInfo", - readOnly: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo" - } - } - } - } - } - } -}; - -export const ErrorAdditionalInfo: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - info: { - serializedName: "info", - readOnly: true, - type: { - name: "Dictionary", - value: { type: { name: "any" } } - } - } - } - } -}; - -export const AccountListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Account" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const AccountProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountProperties", - modelProperties: { - dashboardUri: { - serializedName: "dashboardUri", - readOnly: true, - type: { - name: "String" - } - }, - regionalAffinity: { - serializedName: "regionalAffinity", - type: { - name: "String" - } - }, - scalableExecution: { - serializedName: "scalableExecution", - type: { - name: "String" - } - }, - reporting: { - serializedName: "reporting", - type: { - name: "String" - } - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const Resource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Resource", - modelProperties: { - id: { - serializedName: "id", - readOnly: true, - type: { - name: "String" - } - }, - name: { - serializedName: "name", - readOnly: true, - type: { - name: "String" - } - }, - type: { - serializedName: "type", - readOnly: true, - type: { - name: "String" - } - }, - systemData: { - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const SystemData: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "SystemData", - modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", - type: { - name: "String" - } - }, - lastModifiedAt: { - serializedName: "lastModifiedAt", - type: { - name: "DateTime" - } - } - } - } -}; - -export const QuotaListResult: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QuotaListResult", - modelProperties: { - value: { - serializedName: "value", - required: true, - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Quota" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "QuotaProperties", - modelProperties: { - freeTrial: { - serializedName: "freeTrial", - type: { - name: "Composite", - className: "FreeTrialProperties" - } - }, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const FreeTrialProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "FreeTrialProperties", - modelProperties: { - accountId: { - serializedName: "accountId", - required: true, - readOnly: true, - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - required: true, - readOnly: true, - type: { - name: "DateTime" - } - }, - expiryAt: { - serializedName: "expiryAt", - required: true, - readOnly: true, - type: { - name: "DateTime" - } - }, - allocatedValue: { - serializedName: "allocatedValue", - required: true, - readOnly: true, - type: { - name: "Number" - } - }, - usedValue: { - serializedName: "usedValue", - required: true, - readOnly: true, - type: { - name: "Number" - } - }, - percentageUsed: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0 - }, - serializedName: "percentageUsed", - required: true, - readOnly: true, - type: { - name: "Number" - } - }, - state: { - serializedName: "state", - required: true, - readOnly: true, - type: { - name: "String" - } - } - } - } -}; - -export const AccountUpdate: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountUpdate", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AccountUpdateProperties" - } - } - } - } -}; - -export const AccountUpdateProperties: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountUpdateProperties", - modelProperties: { - regionalAffinity: { - serializedName: "regionalAffinity", - type: { - name: "String" - } - }, - scalableExecution: { - serializedName: "scalableExecution", - type: { - name: "String" - } - }, - reporting: { - serializedName: "reporting", - type: { - name: "String" - } - } - } - } -}; - -export const TrackedResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { type: { name: "String" } } - } - }, - location: { - serializedName: "location", - required: true, - type: { - name: "String" - } - } - } - } -}; - -export const ProxyResource: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "ProxyResource", - modelProperties: { - ...Resource.type.modelProperties - } - } -}; - -export const Account: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Account", - modelProperties: { - ...TrackedResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "AccountProperties" - } - } - } - } -}; - -export const Quota: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "Quota", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "QuotaProperties" - } - } - } - } -}; - -export const AccountsCreateOrUpdateHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountsCreateOrUpdateHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - } - } - } -}; - -export const AccountsDeleteHeaders: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "AccountsDeleteHeaders", - modelProperties: { - retryAfter: { - serializedName: "retry-after", - type: { - name: "Number" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - } - } - } -}; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/models/models.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/models/models.ts new file mode 100644 index 000000000000..c5f364fa35d9 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/models/models.ts @@ -0,0 +1,684 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** A quota resource for a Playwright service account. */ +export interface AccountQuota extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: AccountQuotaProperties; +} + +export function accountQuotaDeserializer(item: any): AccountQuota { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : accountQuotaPropertiesDeserializer(item["properties"]), + }; +} + +/** The Playwright service account quota resource properties. */ +export interface AccountQuotaProperties { + /** The Playwright service account quota resource free-trial properties. */ + freeTrial?: AccountFreeTrialProperties; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function accountQuotaPropertiesDeserializer(item: any): AccountQuotaProperties { + return { + freeTrial: !item["freeTrial"] + ? item["freeTrial"] + : accountFreeTrialPropertiesDeserializer(item["freeTrial"]), + provisioningState: item["provisioningState"], + }; +} + +/** The Playwright service account quota resource free-trial properties. */ +export interface AccountFreeTrialProperties { + /** The free-trial createdAt utcDateTime. */ + readonly createdAt: Date; + /** The free-trial expiryAt utcDateTime. */ + readonly expiryAt: Date; + /** The free-trial allocated limit value eg. allocated free minutes. */ + readonly allocatedValue: number; + /** The free-trial used value eg. used free minutes. */ + readonly usedValue: number; + /** The free-trial percentage used. */ + readonly percentageUsed: number; +} + +export function accountFreeTrialPropertiesDeserializer(item: any): AccountFreeTrialProperties { + return { + createdAt: new Date(item["createdAt"]), + expiryAt: new Date(item["expiryAt"]), + allocatedValue: item["allocatedValue"], + usedValue: item["usedValue"], + percentageUsed: item["percentageUsed"], + }; +} + +/** The status of the current operation. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** Creation in progress.. */ + Creating = "Creating", + /** Deletion in progress.. */ + Deleting = "Deleting", + /** Change accepted for processing.. */ + Accepted = "Accepted", +} + +/** + * The status of the current operation. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Creating**: Creation in progress.. \ + * **Deleting**: Deletion in progress.. \ + * **Accepted**: Change accepted for processing.. + */ +export type ProvisioningState = string; + +/** The enum for quota name. */ +export enum KnownQuotaNames { + /** The quota details for scalable execution feature. When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ + ScalableExecution = "ScalableExecution", + /** The quota details for reporting feature. When enabled, Playwright client will be able to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. */ + Reporting = "Reporting", +} + +/** + * The enum for quota name. \ + * {@link KnownQuotaNames} can be used interchangeably with QuotaNames, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ScalableExecution**: The quota details for scalable execution feature. When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. \ + * **Reporting**: The quota details for reporting feature. When enabled, Playwright client will be able to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. + */ +export type QuotaNames = string; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +export function proxyResourceDeserializer(item: any): ProxyResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] ? item["createdAt"] : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The response of a AccountQuota list operation. */ +export interface _AccountQuotaListResult { + /** The AccountQuota items on this page */ + value: AccountQuota[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _accountQuotaListResultDeserializer(item: any): _AccountQuotaListResult { + return { + value: accountQuotaArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function accountQuotaArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return accountQuotaDeserializer(item); + }); +} + +/** A subscription quota resource. */ +export interface Quota extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: QuotaProperties; +} + +export function quotaDeserializer(item: any): Quota { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : quotaPropertiesDeserializer(item["properties"]), + }; +} + +/** The subscription quota resource properties. */ +export interface QuotaProperties { + /** The subscription quota resource free-trial properties. */ + freeTrial?: FreeTrialProperties; + /** Indicates the offering type for the subscription. */ + readonly offeringType?: OfferingType; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function quotaPropertiesDeserializer(item: any): QuotaProperties { + return { + freeTrial: !item["freeTrial"] + ? item["freeTrial"] + : freeTrialPropertiesDeserializer(item["freeTrial"]), + offeringType: item["offeringType"], + provisioningState: item["provisioningState"], + }; +} + +/** The subscription quota resource free-trial properties. */ +export interface FreeTrialProperties { + /** The Playwright service account id. */ + readonly accountId: string; + /** The free-trial state. */ + readonly state: FreeTrialState; +} + +export function freeTrialPropertiesDeserializer(item: any): FreeTrialProperties { + return { + accountId: item["accountId"], + state: item["state"], + }; +} + +/** The free-trial state. */ +export enum KnownFreeTrialState { + /** The free-trial is Active. */ + Active = "Active", + /** The free-trial is Expired. */ + Expired = "Expired", + /** The free-trial is Not Eligible. */ + NotEligible = "NotEligible", + /** The free-trial is Not Registered. */ + NotRegistered = "NotRegistered", +} + +/** + * The free-trial state. \ + * {@link KnownFreeTrialState} can be used interchangeably with FreeTrialState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: The free-trial is Active. \ + * **Expired**: The free-trial is Expired. \ + * **NotEligible**: The free-trial is Not Eligible. \ + * **NotRegistered**: The free-trial is Not Registered. + */ +export type FreeTrialState = string; + +/** Offering type state. */ +export enum KnownOfferingType { + /** The offeringType is NotApplicable. */ + NotApplicable = "NotApplicable", + /** The offeringType is PrivatePreview. */ + PrivatePreview = "PrivatePreview", + /** The offeringType is PublicPreview. */ + PublicPreview = "PublicPreview", + /** The offeringType is GeneralAvailability. */ + GeneralAvailability = "GeneralAvailability", +} + +/** + * Offering type state. \ + * {@link KnownOfferingType} can be used interchangeably with OfferingType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotApplicable**: The offeringType is NotApplicable. \ + * **PrivatePreview**: The offeringType is PrivatePreview. \ + * **PublicPreview**: The offeringType is PublicPreview. \ + * **GeneralAvailability**: The offeringType is GeneralAvailability. + */ +export type OfferingType = string; + +/** The response of a Quota list operation. */ +export interface _QuotaListResult { + /** The Quota items on this page */ + value: Quota[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _quotaListResultDeserializer(item: any): _QuotaListResult { + return { + value: quotaArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function quotaArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return quotaDeserializer(item); + }); +} + +/** A Playwright service account resource. */ +export interface Account extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: AccountProperties; +} + +export function accountSerializer(item: Account): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : accountPropertiesSerializer(item["properties"]), + }; +} + +export function accountDeserializer(item: any): Account { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : accountPropertiesDeserializer(item["properties"]), + }; +} + +/** Account resource properties. */ +export interface AccountProperties { + /** The Playwright testing dashboard URI for the account resource. */ + readonly dashboardUri?: string; + /** This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. */ + regionalAffinity?: EnablementStatus; + /** When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ + scalableExecution?: EnablementStatus; + /** When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. */ + reporting?: EnablementStatus; + /** When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. */ + localAuth?: EnablementStatus; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function accountPropertiesSerializer(item: AccountProperties): any { + return { + regionalAffinity: item["regionalAffinity"], + scalableExecution: item["scalableExecution"], + reporting: item["reporting"], + localAuth: item["localAuth"], + }; +} + +export function accountPropertiesDeserializer(item: any): AccountProperties { + return { + dashboardUri: item["dashboardUri"], + regionalAffinity: item["regionalAffinity"], + scalableExecution: item["scalableExecution"], + reporting: item["reporting"], + localAuth: item["localAuth"], + provisioningState: item["provisioningState"], + }; +} + +/** The enablement status of a feature. */ +export enum KnownEnablementStatus { + /** The feature is Enabled. */ + Enabled = "Enabled", + /** The feature is Disabled. */ + Disabled = "Disabled", +} + +/** + * The enablement status of a feature. \ + * {@link KnownEnablementStatus} can be used interchangeably with EnablementStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: The feature is Enabled. \ + * **Disabled**: The feature is Disabled. + */ +export type EnablementStatus = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** The type used for update operations of the Account. */ +export interface AccountUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: AccountUpdateProperties; +} + +export function accountUpdateSerializer(item: AccountUpdate): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : accountUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the Account. */ +export interface AccountUpdateProperties { + /** This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect to browsers in the closest Azure region, ensuring lower latency. If disabled, workers connect to browsers in the Azure region in which the workspace was initially created. */ + regionalAffinity?: EnablementStatus; + /** When enabled, Playwright client workers can connect to cloud-hosted browsers. This can increase the number of parallel workers for a test run, significantly minimizing test completion durations. */ + scalableExecution?: EnablementStatus; + /** When enabled, this feature allows the workspace to upload and display test results, including artifacts like traces and screenshots, in the Playwright portal. This enables faster and more efficient troubleshooting. */ + reporting?: EnablementStatus; + /** When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. */ + localAuth?: EnablementStatus; +} + +export function accountUpdatePropertiesSerializer(item: AccountUpdateProperties): any { + return { + regionalAffinity: item["regionalAffinity"], + scalableExecution: item["scalableExecution"], + reporting: item["reporting"], + localAuth: item["localAuth"], + }; +} + +/** The response of a Account list operation. */ +export interface _AccountListResult { + /** The Account items on this page */ + value: Account[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _accountListResultDeserializer(item: any): _AccountListResult { + return { + value: accountArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function accountArraySerializer(result: Array): any[] { + return result.map((item) => { + return accountSerializer(item); + }); +} + +export function accountArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return accountDeserializer(item); + }); +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +export function checkNameAvailabilityRequestSerializer(item: CheckNameAvailabilityRequest): any { + return { name: item["name"], type: item["type"] }; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is not available. */ + message?: string; +} + +export function checkNameAvailabilityResponseDeserializer( + item: any, +): CheckNameAvailabilityResponse { + return { + nameAvailable: item["nameAvailable"], + reason: item["reason"], + message: item["message"], + }; +} + +/** Possible reasons for a name not being available. */ +export enum KnownCheckNameAvailabilityReason { + /** Name is invalid. */ + Invalid = "Invalid", + /** Name already exists. */ + AlreadyExists = "AlreadyExists", +} + +/** + * Possible reasons for a name not being available. \ + * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid**: Name is invalid. \ + * **AlreadyExists**: Name already exists. + */ +export type CheckNameAvailabilityReason = string; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer(item: any): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + readonly display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] ? item["display"] : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + User = "user", + /** Indicates the operation is initiated by a system. */ + System = "system", + /** Indicates the operation is initiated by a user or system. */ + UserSystem = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Microsoft.AzurePlaywrightService Management API Versions. */ +export enum KnownVersions { + /** 2024-12-01 version */ + "V2024-12-01" = "2024-12-01", +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/models/parameters.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/models/parameters.ts deleted file mode 100644 index 7ad813f01c90..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/models/parameters.ts +++ /dev/null @@ -1,154 +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 { - OperationParameter, - OperationURLParameter, - OperationQueryParameter -} from "@azure/core-client"; -import { - Account as AccountMapper, - AccountUpdate as AccountUpdateMapper -} from "../models/mappers"; - -export const accept: OperationParameter = { - parameterPath: "accept", - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Accept", - type: { - name: "String" - } - } -}; - -export const $host: OperationURLParameter = { - parameterPath: "$host", - mapper: { - serializedName: "$host", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const apiVersion: OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - defaultValue: "2023-10-01-preview", - isConstant: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; - -export const nextLink: OperationURLParameter = { - parameterPath: "nextLink", - mapper: { - serializedName: "nextLink", - required: true, - type: { - name: "String" - } - }, - skipEncoding: true -}; - -export const subscriptionId: OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - constraints: { - MinLength: 1 - }, - serializedName: "subscriptionId", - required: true, - type: { - name: "String" - } - } -}; - -export const resourceGroupName: OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - constraints: { - MaxLength: 90, - MinLength: 1 - }, - serializedName: "resourceGroupName", - required: true, - type: { - name: "String" - } - } -}; - -export const name: OperationURLParameter = { - parameterPath: "name", - mapper: { - constraints: { - Pattern: new RegExp("^[a-zA-Z]{1}[a-zA-Z0-9]{2,63}$"), - MaxLength: 64, - MinLength: 3 - }, - serializedName: "name", - required: true, - type: { - name: "String" - } - } -}; - -export const contentType: OperationParameter = { - parameterPath: ["options", "contentType"], - mapper: { - defaultValue: "application/json", - isConstant: true, - serializedName: "Content-Type", - type: { - name: "String" - } - } -}; - -export const resource: OperationParameter = { - parameterPath: "resource", - mapper: AccountMapper -}; - -export const properties: OperationParameter = { - parameterPath: "properties", - mapper: AccountUpdateMapper -}; - -export const location: OperationURLParameter = { - parameterPath: "location", - mapper: { - serializedName: "location", - required: true, - type: { - name: "String" - } - } -}; - -export const name1: OperationURLParameter = { - parameterPath: "name", - mapper: { - serializedName: "name", - required: true, - type: { - name: "String" - } - } -}; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/accounts.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operations/accounts.ts deleted file mode 100644 index 75ff86897593..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/accounts.ts +++ /dev/null @@ -1,630 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Accounts } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { PlaywrightTestingClient } from "../playwrightTestingClient"; -import { - SimplePollerLike, - OperationState, - createHttpPoller -} from "@azure/core-lro"; -import { createLroSpec } from "../lroImpl"; -import { - Account, - AccountsListBySubscriptionNextOptionalParams, - AccountsListBySubscriptionOptionalParams, - AccountsListBySubscriptionResponse, - AccountsListByResourceGroupNextOptionalParams, - AccountsListByResourceGroupOptionalParams, - AccountsListByResourceGroupResponse, - AccountsGetOptionalParams, - AccountsGetResponse, - AccountsCreateOrUpdateOptionalParams, - AccountsCreateOrUpdateResponse, - AccountUpdate, - AccountsUpdateOptionalParams, - AccountsUpdateResponse, - AccountsDeleteOptionalParams, - AccountsListBySubscriptionNextResponse, - AccountsListByResourceGroupNextResponse -} from "../models"; - -/// -/** Class containing Accounts operations. */ -export class AccountsImpl implements Accounts { - private readonly client: PlaywrightTestingClient; - - /** - * Initialize a new instance of the class Accounts class. - * @param client Reference to the service client - */ - constructor(client: PlaywrightTestingClient) { - this.client = client; - } - - /** - * List Account resources by subscription ID - * @param options The options parameters. - */ - public listBySubscription( - options?: AccountsListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(options, settings); - } - }; - } - - private async *listBySubscriptionPagingPage( - options?: AccountsListBySubscriptionOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: AccountsListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySubscriptionPagingAll( - options?: AccountsListBySubscriptionOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage(options)) { - yield* page; - } - } - - /** - * List Account resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - public listByResourceGroup( - resourceGroupName: string, - options?: AccountsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listByResourceGroupPagingPage( - resourceGroupName, - options, - settings - ); - } - }; - } - - private async *listByResourceGroupPagingPage( - resourceGroupName: string, - options?: AccountsListByResourceGroupOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: AccountsListByResourceGroupResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listByResourceGroup(resourceGroupName, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listByResourceGroupNext( - resourceGroupName, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listByResourceGroupPagingAll( - resourceGroupName: string, - options?: AccountsListByResourceGroupOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listByResourceGroupPagingPage( - resourceGroupName, - options - )) { - yield* page; - } - } - - /** - * List Account resources by subscription ID - * @param options The options parameters. - */ - private _listBySubscription( - options?: AccountsListBySubscriptionOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { options }, - listBySubscriptionOperationSpec - ); - } - - /** - * List Account resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - private _listByResourceGroup( - resourceGroupName: string, - options?: AccountsListByResourceGroupOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, options }, - listByResourceGroupOperationSpec - ); - } - - /** - * Get a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - get( - resourceGroupName: string, - name: string, - options?: AccountsGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, name, options }, - getOperationSpec - ); - } - - /** - * Create a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdate( - resourceGroupName: string, - name: string, - resource: Account, - options?: AccountsCreateOrUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - AccountsCreateOrUpdateResponse - > - > { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, name, resource, options }, - spec: createOrUpdateOperationSpec - }); - const poller = await createHttpPoller< - AccountsCreateOrUpdateResponse, - OperationState - >(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "azure-async-operation" - }); - await poller.poll(); - return poller; - } - - /** - * Create a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param resource Resource create parameters. - * @param options The options parameters. - */ - async beginCreateOrUpdateAndWait( - resourceGroupName: string, - name: string, - resource: Account, - options?: AccountsCreateOrUpdateOptionalParams - ): Promise { - const poller = await this.beginCreateOrUpdate( - resourceGroupName, - name, - resource, - options - ); - return poller.pollUntilDone(); - } - - /** - * Update a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - name: string, - properties: AccountUpdate, - options?: AccountsUpdateOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, name, properties, options }, - updateOperationSpec - ); - } - - /** - * Delete a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - async beginDelete( - resourceGroupName: string, - name: string, - options?: AccountsDeleteOptionalParams - ): Promise, void>> { - const directSendOperation = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ): Promise => { - return this.client.sendOperationRequest(args, spec); - }; - const sendOperationFn = async ( - args: coreClient.OperationArguments, - spec: coreClient.OperationSpec - ) => { - let currentRawResponse: - | coreClient.FullOperationResponse - | undefined = undefined; - const providedCallback = args.options?.onResponse; - const callback: coreClient.RawResponseCallback = ( - rawResponse: coreClient.FullOperationResponse, - flatResponse: unknown - ) => { - currentRawResponse = rawResponse; - providedCallback?.(rawResponse, flatResponse); - }; - const updatedArgs = { - ...args, - options: { - ...args.options, - onResponse: callback - } - }; - const flatResponse = await directSendOperation(updatedArgs, spec); - return { - flatResponse, - rawResponse: { - statusCode: currentRawResponse!.status, - body: currentRawResponse!.parsedBody, - headers: currentRawResponse!.headers.toJSON() - } - }; - }; - - const lro = createLroSpec({ - sendOperationFn, - args: { resourceGroupName, name, options }, - spec: deleteOperationSpec - }); - const poller = await createHttpPoller>(lro, { - restoreFrom: options?.resumeFrom, - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: "location" - }); - await poller.poll(); - return poller; - } - - /** - * Delete a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - async beginDeleteAndWait( - resourceGroupName: string, - name: string, - options?: AccountsDeleteOptionalParams - ): Promise { - const poller = await this.beginDelete(resourceGroupName, name, options); - return poller.pollUntilDone(); - } - - /** - * ListBySubscriptionNext - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - nextLink: string, - options?: AccountsListBySubscriptionNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listBySubscriptionNextOperationSpec - ); - } - - /** - * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. - * @param options The options parameters. - */ - private _listByResourceGroupNext( - resourceGroupName: string, - nextLink: string, - options?: AccountsListByResourceGroupNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AccountListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host, Parameters.subscriptionId], - headerParameters: [Parameters.accept], - serializer -}; -const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AccountListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Account - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.name - ], - headerParameters: [Parameters.accept], - serializer -}; -const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", - httpMethod: "PUT", - responses: { - 200: { - bodyMapper: Mappers.Account - }, - 201: { - bodyMapper: Mappers.Account - }, - 202: { - bodyMapper: Mappers.Account - }, - 204: { - bodyMapper: Mappers.Account - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.resource, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.name - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", - httpMethod: "PATCH", - responses: { - 200: { - bodyMapper: Mappers.Account - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - requestBody: Parameters.properties, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.name - ], - headerParameters: [Parameters.accept, Parameters.contentType], - mediaType: "json", - serializer -}; -const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{name}", - httpMethod: "DELETE", - responses: { - 200: {}, - 201: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.name - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AccountListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId - ], - headerParameters: [Parameters.accept], - serializer -}; -const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.AccountListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operations/index.ts deleted file mode 100644 index e8eae0a6b68b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/index.ts +++ /dev/null @@ -1,11 +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. - */ - -export * from "./operations"; -export * from "./accounts"; -export * from "./quotas"; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/operations.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operations/operations.ts deleted file mode 100644 index d22feda4a79d..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/operations.ts +++ /dev/null @@ -1,149 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Operations } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { PlaywrightTestingClient } from "../playwrightTestingClient"; -import { - Operation, - OperationsListNextOptionalParams, - OperationsListOptionalParams, - OperationsListResponse, - OperationsListNextResponse -} from "../models"; - -/// -/** Class containing Operations operations. */ -export class OperationsImpl implements Operations { - private readonly client: PlaywrightTestingClient; - - /** - * Initialize a new instance of the class Operations class. - * @param client Reference to the service client - */ - constructor(client: PlaywrightTestingClient) { - this.client = client; - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - public list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listPagingAll(options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listPagingPage(options, settings); - } - }; - } - - private async *listPagingPage( - options?: OperationsListOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: OperationsListResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._list(options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listNext(continuationToken, options); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listPagingAll( - options?: OperationsListOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listPagingPage(options)) { - yield* page; - } - } - - /** - * List the operations for the provider - * @param options The options parameters. - */ - private _list( - options?: OperationsListOptionalParams - ): Promise { - return this.client.sendOperationRequest({ options }, listOperationSpec); - } - - /** - * ListNext - * @param nextLink The nextLink from the previous successful call to the List method. - * @param options The options parameters. - */ - private _listNext( - nextLink: string, - options?: OperationsListNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { nextLink, options }, - listNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listOperationSpec: coreClient.OperationSpec = { - path: "/providers/Microsoft.AzurePlaywrightService/operations", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [Parameters.$host], - headerParameters: [Parameters.accept], - serializer -}; -const listNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [Parameters.$host, Parameters.nextLink], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/quotas.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operations/quotas.ts deleted file mode 100644 index 5cd4ff68a161..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operations/quotas.ts +++ /dev/null @@ -1,219 +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 { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; -import { setContinuationToken } from "../pagingHelper"; -import { Quotas } from "../operationsInterfaces"; -import * as coreClient from "@azure/core-client"; -import * as Mappers from "../models/mappers"; -import * as Parameters from "../models/parameters"; -import { PlaywrightTestingClient } from "../playwrightTestingClient"; -import { - Quota, - QuotasListBySubscriptionNextOptionalParams, - QuotasListBySubscriptionOptionalParams, - QuotasListBySubscriptionResponse, - QuotaNames, - QuotasGetOptionalParams, - QuotasGetResponse, - QuotasListBySubscriptionNextResponse -} from "../models"; - -/// -/** Class containing Quotas operations. */ -export class QuotasImpl implements Quotas { - private readonly client: PlaywrightTestingClient; - - /** - * Initialize a new instance of the class Quotas class. - * @param client Reference to the service client - */ - constructor(client: PlaywrightTestingClient) { - this.client = client; - } - - /** - * List quotas for a given subscription Id. - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param options The options parameters. - */ - public listBySubscription( - location: string, - options?: QuotasListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator { - const iter = this.listBySubscriptionPagingAll(location, options); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: (settings?: PageSettings) => { - if (settings?.maxPageSize) { - throw new Error("maxPageSize is not supported by this operation."); - } - return this.listBySubscriptionPagingPage(location, options, settings); - } - }; - } - - private async *listBySubscriptionPagingPage( - location: string, - options?: QuotasListBySubscriptionOptionalParams, - settings?: PageSettings - ): AsyncIterableIterator { - let result: QuotasListBySubscriptionResponse; - let continuationToken = settings?.continuationToken; - if (!continuationToken) { - result = await this._listBySubscription(location, options); - let page = result.value || []; - continuationToken = result.nextLink; - setContinuationToken(page, continuationToken); - yield page; - } - while (continuationToken) { - result = await this._listBySubscriptionNext( - location, - continuationToken, - options - ); - continuationToken = result.nextLink; - let page = result.value || []; - setContinuationToken(page, continuationToken); - yield page; - } - } - - private async *listBySubscriptionPagingAll( - location: string, - options?: QuotasListBySubscriptionOptionalParams - ): AsyncIterableIterator { - for await (const page of this.listBySubscriptionPagingPage( - location, - options - )) { - yield* page; - } - } - - /** - * List quotas for a given subscription Id. - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param options The options parameters. - */ - private _listBySubscription( - location: string, - options?: QuotasListBySubscriptionOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { location, options }, - listBySubscriptionOperationSpec - ); - } - - /** - * Get quota by name. - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param name The quota name. - * @param options The options parameters. - */ - get( - location: string, - name: QuotaNames, - options?: QuotasGetOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { location, name, options }, - getOperationSpec - ); - } - - /** - * ListBySubscriptionNext - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. - * @param options The options parameters. - */ - private _listBySubscriptionNext( - location: string, - nextLink: string, - options?: QuotasListBySubscriptionNextOptionalParams - ): Promise { - return this.client.sendOperationRequest( - { location, nextLink, options }, - listBySubscriptionNextOperationSpec - ); - } -} -// Operation Specifications -const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); - -const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.QuotaListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.location - ], - headerParameters: [Parameters.accept], - serializer -}; -const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{name}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.Quota - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - queryParameters: [Parameters.apiVersion], - urlParameters: [ - Parameters.$host, - Parameters.subscriptionId, - Parameters.location, - Parameters.name1 - ], - headerParameters: [Parameters.accept], - serializer -}; -const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { - path: "{nextLink}", - httpMethod: "GET", - responses: { - 200: { - bodyMapper: Mappers.QuotaListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - urlParameters: [ - Parameters.$host, - Parameters.nextLink, - Parameters.subscriptionId, - Parameters.location - ], - headerParameters: [Parameters.accept], - serializer -}; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/accounts.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/accounts.ts deleted file mode 100644 index 4f2c04a63a1b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/accounts.ts +++ /dev/null @@ -1,121 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { SimplePollerLike, OperationState } from "@azure/core-lro"; -import { - Account, - AccountsListBySubscriptionOptionalParams, - AccountsListByResourceGroupOptionalParams, - AccountsGetOptionalParams, - AccountsGetResponse, - AccountsCreateOrUpdateOptionalParams, - AccountsCreateOrUpdateResponse, - AccountUpdate, - AccountsUpdateOptionalParams, - AccountsUpdateResponse, - AccountsDeleteOptionalParams -} from "../models"; - -/// -/** Interface representing a Accounts. */ -export interface Accounts { - /** - * List Account resources by subscription ID - * @param options The options parameters. - */ - listBySubscription( - options?: AccountsListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator; - /** - * List Account resources by resource group - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The options parameters. - */ - listByResourceGroup( - resourceGroupName: string, - options?: AccountsListByResourceGroupOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - get( - resourceGroupName: string, - name: string, - options?: AccountsGetOptionalParams - ): Promise; - /** - * Create a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdate( - resourceGroupName: string, - name: string, - resource: Account, - options?: AccountsCreateOrUpdateOptionalParams - ): Promise< - SimplePollerLike< - OperationState, - AccountsCreateOrUpdateResponse - > - >; - /** - * Create a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param resource Resource create parameters. - * @param options The options parameters. - */ - beginCreateOrUpdateAndWait( - resourceGroupName: string, - name: string, - resource: Account, - options?: AccountsCreateOrUpdateOptionalParams - ): Promise; - /** - * Update a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param properties The resource properties to be updated. - * @param options The options parameters. - */ - update( - resourceGroupName: string, - name: string, - properties: AccountUpdate, - options?: AccountsUpdateOptionalParams - ): Promise; - /** - * Delete a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - beginDelete( - resourceGroupName: string, - name: string, - options?: AccountsDeleteOptionalParams - ): Promise, void>>; - /** - * Delete a Account - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param name Name of account - * @param options The options parameters. - */ - beginDeleteAndWait( - resourceGroupName: string, - name: string, - options?: AccountsDeleteOptionalParams - ): Promise; -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/index.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/index.ts deleted file mode 100644 index e8eae0a6b68b..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/index.ts +++ /dev/null @@ -1,11 +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. - */ - -export * from "./operations"; -export * from "./accounts"; -export * from "./quotas"; diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/operations.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/operations.ts deleted file mode 100644 index 5cf5581845bd..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/operations.ts +++ /dev/null @@ -1,22 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { Operation, OperationsListOptionalParams } from "../models"; - -/// -/** Interface representing a Operations. */ -export interface Operations { - /** - * List the operations for the provider - * @param options The options parameters. - */ - list( - options?: OperationsListOptionalParams - ): PagedAsyncIterableIterator; -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/quotas.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/quotas.ts deleted file mode 100644 index 002703dcda35..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/operationsInterfaces/quotas.ts +++ /dev/null @@ -1,41 +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 { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { - Quota, - QuotasListBySubscriptionOptionalParams, - QuotaNames, - QuotasGetOptionalParams, - QuotasGetResponse -} from "../models"; - -/// -/** Interface representing a Quotas. */ -export interface Quotas { - /** - * List quotas for a given subscription Id. - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param options The options parameters. - */ - listBySubscription( - location: string, - options?: QuotasListBySubscriptionOptionalParams - ): PagedAsyncIterableIterator; - /** - * Get quota by name. - * @param location The location of quota in ARM Normalized format like eastus, southeastasia etc. - * @param name The quota name. - * @param options The options parameters. - */ - get( - location: string, - name: QuotaNames, - options?: QuotasGetOptionalParams - ): Promise; -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/pagingHelper.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/pagingHelper.ts deleted file mode 100644 index 269a2b9814b5..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/pagingHelper.ts +++ /dev/null @@ -1,39 +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. - */ - -export interface PageInfo { - continuationToken?: string; -} - -const pageMap = new WeakMap(); - -/** - * Given the last `.value` produced by the `byPage` iterator, - * returns a continuation token that can be used to begin paging from - * that point later. - * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. - * @returns The continuation token that can be passed into byPage() during future calls. - */ -export function getContinuationToken(page: unknown): string | undefined { - if (typeof page !== "object" || page === null) { - return undefined; - } - return pageMap.get(page)?.continuationToken; -} - -export function setContinuationToken( - page: unknown, - continuationToken: string | undefined -): void { - if (typeof page !== "object" || page === null || !continuationToken) { - return; - } - const pageInfo = pageMap.get(page) ?? {}; - pageInfo.continuationToken = continuationToken; - pageMap.set(page, pageInfo); -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/playwrightTestingClient.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/playwrightTestingClient.ts deleted file mode 100644 index 506bcec0c878..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/src/playwrightTestingClient.ts +++ /dev/null @@ -1,144 +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 coreRestPipeline from "@azure/core-rest-pipeline"; -import { - PipelineRequest, - PipelineResponse, - SendRequest -} from "@azure/core-rest-pipeline"; -import * as coreAuth from "@azure/core-auth"; -import { OperationsImpl, AccountsImpl, QuotasImpl } from "./operations"; -import { Operations, Accounts, Quotas } from "./operationsInterfaces"; -import { PlaywrightTestingClientOptionalParams } from "./models"; - -export class PlaywrightTestingClient extends coreClient.ServiceClient { - $host: string; - apiVersion: string; - subscriptionId: string; - - /** - * Initializes a new instance of the PlaywrightTestingClient 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?: PlaywrightTestingClientOptionalParams - ) { - 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: PlaywrightTestingClientOptionalParams = { - requestContentType: "application/json; charset=utf-8", - credential: credentials - }; - - const packageDetails = `azsdk-js-arm-playwrighttesting/1.0.0-beta.3`; - const userAgentPrefix = - options.userAgentOptions && options.userAgentOptions.userAgentPrefix - ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` - : `${packageDetails}`; - - const optionsWithDefaults = { - ...defaults, - ...options, - userAgentOptions: { - userAgentPrefix - }, - endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" - }; - super(optionsWithDefaults); - - let bearerTokenAuthenticationPolicyFound: boolean = false; - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - } - if ( - !options || - !options.pipeline || - options.pipeline.getOrderedPolicies().length == 0 || - !bearerTokenAuthenticationPolicyFound - ) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - credential: credentials, - scopes: - optionsWithDefaults.credentialScopes ?? - `${optionsWithDefaults.endpoint}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - // Parameter assignments - this.subscriptionId = subscriptionId; - - // Assigning values to Constant parameters - this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-10-01-preview"; - this.operations = new OperationsImpl(this); - this.accounts = new AccountsImpl(this); - this.quotas = new QuotasImpl(this); - this.addCustomApiVersionPolicy(options.apiVersion); - } - - /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ - private addCustomApiVersionPolicy(apiVersion?: string) { - if (!apiVersion) { - return; - } - const apiVersionPolicy = { - name: "CustomApiVersionPolicy", - async sendRequest( - request: PipelineRequest, - next: SendRequest - ): Promise { - const param = request.url.split("?"); - if (param.length > 1) { - const newParams = param[1].split("&").map((item) => { - if (item.indexOf("api-version") > -1) { - return "api-version=" + apiVersion; - } else { - return item; - } - }); - request.url = param[0] + "?" + newParams.join("&"); - } - return next(request); - } - }; - this.pipeline.addPolicy(apiVersionPolicy); - } - - operations: Operations; - accounts: Accounts; - quotas: Quotas; -} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/restorePollerHelpers.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/restorePollerHelpers.ts new file mode 100644 index 000000000000..a88d14b4e2ee --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/restorePollerHelpers.ts @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { AzurePlaywrightServiceClient } from "./azurePlaywrightServiceClient.js"; +import { + _accountsCreateOrUpdateDeserialize, + _accountsDeleteDeserialize, +} from "./api/accounts/index.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { OperationOptions, PathUncheckedResponse } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: AzurePlaywrightServiceClient, + serializedState: string, + sourceOperation: (...args: any[]) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}": + { + deserializer: _accountsCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}": + { + deserializer: _accountsDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) { + if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test( + pathParts[j] || "", + ); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pagingHelpers.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pagingHelpers.ts new file mode 100644 index 000000000000..ce33af5f4178 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Client, createRestError, PathUncheckedResponse } from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: (pageLink?: string) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator(pagedResult); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined" && nextLink !== null) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse, expectedStatuses: string[]): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pollingHelpers.ts b/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pollingHelpers.ts new file mode 100644 index 000000000000..f01c41bab69d --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { Client, PathUncheckedResponse, createRestError } from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error("Either restoreFrom or getInitialResponse must be specified"); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error("getInitialResponse is required when initializing a new poller"); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/test/playwrighttesting_operations_test.spec.ts b/sdk/playwrighttesting/arm-playwrighttesting/test/playwrighttesting_operations_test.spec.ts deleted file mode 100644 index 19ed722724a0..000000000000 --- a/sdk/playwrighttesting/arm-playwrighttesting/test/playwrighttesting_operations_test.spec.ts +++ /dev/null @@ -1,72 +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 { - env, - Recorder, - RecorderStartOptions, - delay, - isPlaybackMode, -} from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { PlaywrightTestingClient } from "../src/playwrightTestingClient"; - -const replaceableVariables: Record = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, - removeCentralSanitizers: [ - "AZSDK3493", // .name in the body is not a secret and is listed below in the beforeEach section - "AZSDK3430", // .id in the body is not a secret and is listed below in the beforeEach section - ], -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("PlaywrightTesting test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: PlaywrightTestingClient; - let location: string; - let resourceGroup: string; - let resourcename: string; - - beforeEach(async function (this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ''; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new PlaywrightTestingClient(credential, subscriptionId, recorder.configureClientOptions({})); - location = "eastus"; - resourceGroup = "myjstest"; - resourcename = "resourcetest"; - - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("operation list test", async function () { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - }); - -}) diff --git a/sdk/playwrighttesting/arm-playwrighttesting/test/public/playwrighttesting_operations_test.spec.ts b/sdk/playwrighttesting/arm-playwrighttesting/test/public/playwrighttesting_operations_test.spec.ts new file mode 100644 index 000000000000..f383475e1afc --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/test/public/playwrighttesting_operations_test.spec.ts @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { env, Recorder, isPlaybackMode } from "@azure-tools/test-recorder"; +import { createTestCredential } from "@azure-tools/test-credential"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; +import { createRecorder } from "./utils/recordedClient.js"; +import { AzurePlaywrightServiceClient } from "../../src/azurePlaywrightServiceClient.js"; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("PlaywrightService test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: AzurePlaywrightServiceClient; + + beforeEach(async (context) => { + process.env.SystemRoot = process.env.SystemRoot || "C:\\Windows"; + recorder = await createRecorder(context); + subscriptionId = env.SUBSCRIPTION_ID || ""; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new AzurePlaywrightServiceClient( + credential, + subscriptionId, + recorder.configureClientOptions({}), + ); + }); + + afterEach(async function () { + await recorder.stop(); + }); + it("operations list test", async function () { + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + assert.notEqual(resArray.length, 0); + }); +}); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/test/public/utils/recordedClient.ts b/sdk/playwrighttesting/arm-playwrighttesting/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..14dcd9fa397c --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/test/public/utils/recordedClient.ts @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { Recorder, RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder(context: VitestTestContext): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.browser.config.json b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.browser.config.json new file mode 100644 index 000000000000..75871518e3a0 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.browser.config.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.json b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.json index 4fbccf111a16..19ceb382b521 100644 --- a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.json +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.json @@ -1,33 +1,13 @@ { - "compilerOptions": { - "module": "es6", - "moduleResolution": "node", - "strict": true, - "target": "es6", - "sourceMap": true, - "declarationMap": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "lib": [ - "es6", - "dom" - ], - "declaration": true, - "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-playwrighttesting": [ - "./src/index" - ] + "references": [ + { + "path": "./tsconfig.src.json" + }, + { + "path": "./tsconfig.samples.json" + }, + { + "path": "./tsconfig.test.json" } - }, - "include": [ - "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" - ], - "exclude": [ - "node_modules" ] -} \ No newline at end of file +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.samples.json b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.samples.json new file mode 100644 index 000000000000..15b5ea99552f --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.samples.json @@ -0,0 +1,8 @@ +{ + "extends": "../../../tsconfig.samples.base.json", + "compilerOptions": { + "paths": { + "@azure/arm-playwrighttesting": ["./dist/esm"] + } + } +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.src.json b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.src.json new file mode 100644 index 000000000000..bae70752dd38 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.src.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../tsconfig.lib.json" +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.test.json b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.test.json new file mode 100644 index 000000000000..290ca214aebc --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsconfig.test.json @@ -0,0 +1,3 @@ +{ + "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"] +} diff --git a/sdk/playwrighttesting/arm-playwrighttesting/tsp-location.yaml b/sdk/playwrighttesting/arm-playwrighttesting/tsp-location.yaml new file mode 100644 index 000000000000..f1db921b3f54 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/playwrighttesting/PlaywrightTesting.Management +commit: fa6c6015b1633a701edb629c1a759433aa1fdaf2 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/playwrighttesting/arm-playwrighttesting/vitest.browser.config.ts b/sdk/playwrighttesting/arm-playwrighttesting/vitest.browser.config.ts new file mode 100644 index 000000000000..b48c61b2ef46 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/vitest.browser.config.ts @@ -0,0 +1,17 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.browser.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + include: [ + "dist-test/browser/test/**/*.spec.js", + ], + }, + }), +); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/vitest.config.ts b/sdk/playwrighttesting/arm-playwrighttesting/vitest.config.ts new file mode 100644 index 000000000000..86a71911ccc2 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/vitest.config.ts @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig, mergeConfig } from "vitest/config"; +import viteConfig from "../../../vitest.shared.config.ts"; + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + testTimeout: 1200000, + hookTimeout: 1200000, + }, + }), +); diff --git a/sdk/playwrighttesting/arm-playwrighttesting/vitest.esm.config.ts b/sdk/playwrighttesting/arm-playwrighttesting/vitest.esm.config.ts new file mode 100644 index 000000000000..a70127279fc9 --- /dev/null +++ b/sdk/playwrighttesting/arm-playwrighttesting/vitest.esm.config.ts @@ -0,0 +1,12 @@ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { mergeConfig } from "vitest/config"; +import vitestConfig from "./vitest.config.ts"; +import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; + +export default mergeConfig( + vitestConfig, + vitestEsmConfig +); diff --git a/sdk/playwrighttesting/ci.mgmt.yml b/sdk/playwrighttesting/ci.mgmt.yml index 81fb51275e42..272221b4cda8 100644 --- a/sdk/playwrighttesting/ci.mgmt.yml +++ b/sdk/playwrighttesting/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -13,7 +13,6 @@ trigger: include: - sdk/playwrighttesting/arm-playwrighttesting - sdk/playwrighttesting/ci.mgmt.yml - pr: branches: include: @@ -27,7 +26,6 @@ pr: include: - sdk/playwrighttesting/arm-playwrighttesting - sdk/playwrighttesting/ci.mgmt.yml - extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -35,4 +33,3 @@ extends: Artifacts: - name: azure-arm-playwrighttesting safeName: azurearmplaywrighttesting - \ No newline at end of file diff --git a/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/clInfoProvider.spec.ts b/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/clInfoProvider.spec.ts index 14cfbc01e1d0..18f1a577140e 100644 --- a/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/clInfoProvider.spec.ts +++ b/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/clInfoProvider.spec.ts @@ -8,6 +8,7 @@ describe("CIInfoProvider", () => { beforeEach(() => { sandbox = sinon.createSandbox(); + environmentVariables = process.env; }); afterEach(() => { diff --git a/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/reporterUtils.spec.ts b/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/reporterUtils.spec.ts index 6c20db6e620a..876c937ac1a2 100644 --- a/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/reporterUtils.spec.ts +++ b/sdk/playwrighttesting/microsoft-playwright-testing/test/utils/reporterUtils.spec.ts @@ -19,7 +19,7 @@ describe("Reporter Utils", () => { correlationId: "test-correlation-id", region: "test-region", }; - + environmentVariables = process.env; reporterUtils = new ReporterUtils(envVariablesMock, {} as any, {} as any); }); afterEach(() => {