diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e913a3cf8c0a..ceee80f171e3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -634,6 +634,9 @@ sdk/orbital/arm-orbital @qiaozha @dw511214992 # PRLabel: %Mgmt sdk/portal/arm-portal @qiaozha @dw511214992 +# PRLabel: %Mgmt +sdk/loadtestservice/arm-loadtestservice @qiaozha @dw511214992 + # PRLabel: %Monitor /sdk/monitor/ @hectorhdzg @applicationinsights-js-owners /sdk/monitor/monitor-query @KarishmaGhiya @maorleger diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9ff772e3972e..b1588fce90b4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -34,6 +34,7 @@ specifiers: '@rush-temp/arm-features': file:./projects/arm-features.tgz '@rush-temp/arm-keyvault': file:./projects/arm-keyvault.tgz '@rush-temp/arm-links': file:./projects/arm-links.tgz + '@rush-temp/arm-loadtestservice': file:./projects/arm-loadtestservice.tgz '@rush-temp/arm-locks': file:./projects/arm-locks.tgz '@rush-temp/arm-logic': file:./projects/arm-logic.tgz '@rush-temp/arm-managedapplications': file:./projects/arm-managedapplications.tgz @@ -202,6 +203,7 @@ dependencies: '@rush-temp/arm-features': file:projects/arm-features.tgz '@rush-temp/arm-keyvault': file:projects/arm-keyvault.tgz '@rush-temp/arm-links': file:projects/arm-links.tgz + '@rush-temp/arm-loadtestservice': file:projects/arm-loadtestservice.tgz '@rush-temp/arm-locks': file:projects/arm-locks.tgz '@rush-temp/arm-logic': file:projects/arm-logic.tgz '@rush-temp/arm-managedapplications': file:projects/arm-managedapplications.tgz @@ -9202,7 +9204,7 @@ packages: dev: false file:projects/arm-links.tgz: - resolution: {integrity: sha512-2ZTazs3FCqlUoZm0svStZ0fihgqOREebNXNXOQguP/IYxVa+LdmNM7UkouVO0WbVDo6c3yWByJkhJopxXadTcw==, tarball: file:projects/arm-links.tgz} + resolution: {integrity: sha512-t3TXBd/Fxm80E+cWuS3tQiUdSUeaEtul7+exkY4rNj9ecjK93FsfYTQ4a5FpR2WcEecOKQYXLYBfz4JgODQlbw==, tarball: file:projects/arm-links.tgz} name: '@rush-temp/arm-links' version: 0.0.0 dependencies: @@ -9223,6 +9225,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-loadtestservice.tgz: + resolution: {integrity: sha512-3l/W5FfyJNffvaFfoxv6k4msHAjJl/50pBxia8D+H4qHrdvV5GnujnpvE/tDv7s+eIfWqgymB1AHpXM79z6z5Q==, tarball: file:projects/arm-loadtestservice.tgz} + name: '@rush-temp/arm-loadtestservice' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.19 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.3 + dev: false + file:projects/arm-locks.tgz: resolution: {integrity: sha512-0Qahks7SI2QPbAb0Sz5jVOFBHCj7pVW09BWU6pEbAoco3AVRDysIT3W6GzwfijdoGQsFC9tvDKRx1Od+Qxzobg==, tarball: file:projects/arm-locks.tgz} name: '@rush-temp/arm-locks' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index bf1f2c91c5b1..f2ce1d0ef473 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -8,13 +8,8 @@ https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-cha https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/samples/typescript https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob-changefeed/test/ https://github.com/Azure/azure-digital-twins/blob/private-preview/Documentation/how-to-manage-routes.md -https://docs.microsoft.com/javascript/api/@azure/arm-desktopvirtualization -https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/desktopvirtualization/arm-desktopvirtualization -https://docs.microsoft.com/javascript/api/@azure/arm-datalake-analytics?view=azure-node-preview -https://docs.microsoft.com/javascript/api/@azure/arm-orbital -https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/orbital/arm-orbital -https://docs.microsoft.com/javascript/api/@azure/arm-orbital?view=azure-node-preview -https://docs.microsoft.com/javascript/api/@azure/arm-botservice?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-portal?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-portal https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/portal/arm-portal +https://docs.microsoft.com/javascript/api/@azure/arm-loadtestservice +https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/arm-loadtestservice diff --git a/rush.json b/rush.json index 3c5cbe56ed3b..a7e20ebf1c9d 100644 --- a/rush.json +++ b/rush.json @@ -1150,6 +1150,11 @@ "packageName": "@azure/arm-cognitiveservices", "projectFolder": "sdk/cognitiveservices/arm-cognitiveservices", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-loadtestservice", + "projectFolder": "sdk/loadtestservice/arm-loadtestservice", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/loadtestservice/arm-loadtestservice/CHANGELOG.md b/sdk/loadtestservice/arm-loadtestservice/CHANGELOG.md new file mode 100644 index 000000000000..4a254821d9ae --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-08) + +- Initial Release diff --git a/sdk/loadtestservice/arm-loadtestservice/LICENSE b/sdk/loadtestservice/arm-loadtestservice/LICENSE new file mode 100644 index 000000000000..ccb63b166732 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/loadtestservice/arm-loadtestservice/README.md b/sdk/loadtestservice/arm-loadtestservice/README.md new file mode 100644 index 000000000000..8a22e178a061 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/README.md @@ -0,0 +1,98 @@ +# Azure LoadTest client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure LoadTest client. + +LoadTest client provides access to LoadTest Resource and it's status operations. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/arm-loadtestservice) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-loadtestservice) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-loadtestservice) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-loadtestservice` package + +Install the Azure LoadTest client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-loadtestservice +``` + +### Create and authenticate a `LoadTestClient` + +To create a client object to access the Azure LoadTest API, you will need the `endpoint` of your Azure LoadTest resource and a `credential`. The Azure LoadTest client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure LoadTest 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). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure LoadTest** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { LoadTestClient } = require("@azure/arm-loadtestservice"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new LoadTestClient(new DefaultAzureCredential(), subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### LoadTestClient + +`LoadTestClient` is the primary interface for developers using the Azure LoadTest client library. Explore the methods on this client object to understand the different features of the Azure LoadTest service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Floadtestservice%2Farm-loadtestservice%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/loadtestservice/arm-loadtestservice/_meta.json b/sdk/loadtestservice/arm-loadtestservice/_meta.json new file mode 100644 index 000000000000..e218454fa589 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "d90729bbada2b4f784f2737ab4b4e39693a7aab8", + "readme": "specification/loadtestservice/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/loadtestservice/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/loadtestservice/arm-loadtestservice/api-extractor.json b/sdk/loadtestservice/arm-loadtestservice/api-extractor.json new file mode 100644 index 000000000000..161e2e2a40b7 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-loadtestservice.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/loadtestservice/arm-loadtestservice/package.json b/sdk/loadtestservice/arm-loadtestservice/package.json new file mode 100644 index 000000000000..ba2425cc5d9f --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/package.json @@ -0,0 +1,92 @@ +{ + "name": "@azure/arm-loadtestservice", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for LoadTestClient.", + "version": "1.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" + }, + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-loadtestservice.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/loadtestservice/arm-loadtestservice", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, + "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", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/loadtestservice/arm-loadtestservice/recordings/node/my_test/recording_sample_test.js b/sdk/loadtestservice/arm-loadtestservice/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 000000000000..0f6ecb857acf --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/loadtestservice/arm-loadtestservice/review/arm-loadtestservice.api.md b/sdk/loadtestservice/arm-loadtestservice/review/arm-loadtestservice.api.md new file mode 100644 index 000000000000..ce02d82d013a --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/review/arm-loadtestservice.api.md @@ -0,0 +1,287 @@ +## API Report File for "@azure/arm-loadtestservice" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export enum KnownActionType { + // (undocumented) + Internal = "Internal" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownOrigin { + // (undocumented) + System = "system", + // (undocumented) + User = "user", + // (undocumented) + UserSystem = "user,system" +} + +// @public +export enum KnownResourceState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownSystemAssignedServiceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public (undocumented) +export class LoadTestClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: LoadTestClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + loadTests: LoadTests; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface LoadTestClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type LoadTestResource = TrackedResource & { + identity?: SystemAssignedServiceIdentity; + description?: string; + readonly provisioningState?: ResourceState; + readonly dataPlaneURI?: string; +}; + +// @public +export interface LoadTestResourcePageList { + nextLink?: string; + value?: LoadTestResource[]; +} + +// @public +export interface LoadTestResourcePatchRequestBody { + identity?: SystemAssignedServiceIdentity; + properties?: LoadTestResourcePatchRequestBodyProperties; + tags?: Record; +} + +// @public +export interface LoadTestResourcePatchRequestBodyProperties { + description?: string; +} + +// @public +export interface LoadTests { + beginDelete(resourceGroupName: string, loadTestName: string, options?: LoadTestsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, loadTestName: string, options?: LoadTestsDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, loadTestName: string, loadTestResource: LoadTestResource, options?: LoadTestsCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, loadTestName: string, options?: LoadTestsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: LoadTestsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: LoadTestsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, loadTestName: string, loadTestResourcePatchRequestBody: LoadTestResourcePatchRequestBody, options?: LoadTestsUpdateOptionalParams): Promise; +} + +// @public +export interface LoadTestsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsCreateOrUpdateResponse = LoadTestResource; + +// @public +export interface LoadTestsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface LoadTestsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsGetResponse = LoadTestResource; + +// @public +export interface LoadTestsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsListByResourceGroupNextResponse = LoadTestResourcePageList; + +// @public +export interface LoadTestsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsListByResourceGroupResponse = LoadTestResourcePageList; + +// @public +export interface LoadTestsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsListBySubscriptionNextResponse = LoadTestResourcePageList; + +// @public +export interface LoadTestsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsListBySubscriptionResponse = LoadTestResourcePageList; + +// @public +export interface LoadTestsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LoadTestsUpdateResponse = LoadTestResource; + +// @public +export interface Operation { + readonly actionType?: ActionType; + 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 interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type ResourceState = string; + +// @public +export interface SystemAssignedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: SystemAssignedServiceIdentityType; +} + +// @public +export type SystemAssignedServiceIdentityType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/loadtestservice/arm-loadtestservice/rollup.config.js b/sdk/loadtestservice/arm-loadtestservice/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/rollup.config.js @@ -0,0 +1,188 @@ +/* + * 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 nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/loadtestservice/arm-loadtestservice/src/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/index.ts new file mode 100644 index 000000000000..72e871835f15 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/index.ts @@ -0,0 +1,12 @@ +/* + * 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 "./models"; +export { LoadTestClient } from "./loadTestClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts new file mode 100644 index 000000000000..da09f4178a31 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/loadTestClient.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl, LoadTestsImpl } from "./operations"; +import { Operations, LoadTests } from "./operationsInterfaces"; +import { LoadTestClientOptionalParams } from "./models"; + +export class LoadTestClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the LoadTestClient 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?: LoadTestClientOptionalParams + ) { + 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: LoadTestClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-loadtestservice/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-12-01-preview"; + this.operations = new OperationsImpl(this); + this.loadTests = new LoadTestsImpl(this); + } + + operations: Operations; + loadTests: LoadTests; +} diff --git a/sdk/loadtestservice/arm-loadtestservice/src/lroImpl.ts b/sdk/loadtestservice/arm-loadtestservice/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * 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 { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts new file mode 100644 index 000000000000..bfcfc48d7fa0 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/index.ts @@ -0,0 +1,399 @@ +/* + * 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; +} + +/** List of resources page result. */ +export interface LoadTestResourcePageList { + /** List of resources in current page. */ + value?: LoadTestResource[]; + /** Link to next page of resources. */ + nextLink?: string; +} + +/** Managed service identity (either system assigned, or none) */ +export interface SystemAssignedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (either system assigned, or none). */ + type: SystemAssignedServiceIdentityType; +} + +/** 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; +} + +/** LoadTest resource patch request body. */ +export interface LoadTestResourcePatchRequestBody { + /** Resource tags. */ + tags?: Record; + /** The type of identity used for the resource. */ + identity?: SystemAssignedServiceIdentity; + /** Load Test resource properties */ + properties?: LoadTestResourcePatchRequestBodyProperties; +} + +/** Load Test resource properties */ +export interface LoadTestResourcePatchRequestBodyProperties { + /** Description of the resource. */ + description?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** LoadTest details */ +export type LoadTestResource = TrackedResource & { + /** The type of identity used for the resource. */ + identity?: SystemAssignedServiceIdentity; + /** Description of the resource. */ + description?: string; + /** + * Resource provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ResourceState; + /** + * Resource data plane URI. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dataPlaneURI?: string; +}; + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + User = "user", + System = "system", + 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" +} + +/** + * 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 ResourceState} that the service accepts. */ +export enum KnownResourceState { + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted" +} + +/** + * Defines values for ResourceState. \ + * {@link KnownResourceState} can be used interchangeably with ResourceState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** + */ +export type ResourceState = string; + +/** Known values of {@link SystemAssignedServiceIdentityType} that the service accepts. */ +export enum KnownSystemAssignedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + +/** + * Defines values for SystemAssignedServiceIdentityType. \ + * {@link KnownSystemAssignedServiceIdentityType} can be used interchangeably with SystemAssignedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** + */ +export type SystemAssignedServiceIdentityType = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + 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; + +/** 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 LoadTestsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type LoadTestsListBySubscriptionResponse = LoadTestResourcePageList; + +/** Optional parameters. */ +export interface LoadTestsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type LoadTestsListByResourceGroupResponse = LoadTestResourcePageList; + +/** Optional parameters. */ +export interface LoadTestsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type LoadTestsGetResponse = LoadTestResource; + +/** Optional parameters. */ +export interface LoadTestsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type LoadTestsCreateOrUpdateResponse = LoadTestResource; + +/** Optional parameters. */ +export interface LoadTestsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type LoadTestsUpdateResponse = LoadTestResource; + +/** Optional parameters. */ +export interface LoadTestsDeleteOptionalParams + 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 LoadTestsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type LoadTestsListBySubscriptionNextResponse = LoadTestResourcePageList; + +/** Optional parameters. */ +export interface LoadTestsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type LoadTestsListByResourceGroupNextResponse = LoadTestResourcePageList; + +/** Optional parameters. */ +export interface LoadTestClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts new file mode 100644 index 000000000000..5634c0043bdd --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/mappers.ts @@ -0,0 +1,469 @@ +/* + * 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 LoadTestResourcePageList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LoadTestResourcePageList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LoadTestResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const SystemAssignedServiceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "Uuid" + } + }, + type: { + serializedName: "type", + required: 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 LoadTestResourcePatchRequestBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBody", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBodyProperties" + } + } + } + } +}; + +export const LoadTestResourcePatchRequestBodyProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LoadTestResourcePatchRequestBodyProperties", + modelProperties: { + description: { + constraints: { + MaxLength: 512 + }, + serializedName: "description", + 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 LoadTestResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LoadTestResource", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "SystemAssignedServiceIdentity" + } + }, + description: { + constraints: { + MaxLength: 512 + }, + serializedName: "properties.description", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + dataPlaneURI: { + constraints: { + MaxLength: 2083 + }, + serializedName: "properties.dataPlaneURI", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts b/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts new file mode 100644 index 000000000000..606e293f1fd1 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/models/parameters.ts @@ -0,0 +1,127 @@ +/* + * 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 { + LoadTestResource as LoadTestResourceMapper, + LoadTestResourcePatchRequestBody as LoadTestResourcePatchRequestBodyMapper +} 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: "2021-12-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 loadTestName: OperationURLParameter = { + parameterPath: "loadTestName", + mapper: { + serializedName: "loadTestName", + 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 loadTestResource: OperationParameter = { + parameterPath: "loadTestResource", + mapper: LoadTestResourceMapper +}; + +export const loadTestResourcePatchRequestBody: OperationParameter = { + parameterPath: "loadTestResourcePatchRequestBody", + mapper: LoadTestResourcePatchRequestBodyMapper +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts new file mode 100644 index 000000000000..8a5be7b40018 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * 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 "./loadTests"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts new file mode 100644 index 000000000000..ea0151a93ae5 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/loadTests.ts @@ -0,0 +1,519 @@ +/* + * 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 { LoadTests } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { LoadTestClient } from "../loadTestClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + LoadTestResource, + LoadTestsListBySubscriptionNextOptionalParams, + LoadTestsListBySubscriptionOptionalParams, + LoadTestsListByResourceGroupNextOptionalParams, + LoadTestsListByResourceGroupOptionalParams, + LoadTestsListBySubscriptionResponse, + LoadTestsListByResourceGroupResponse, + LoadTestsGetOptionalParams, + LoadTestsGetResponse, + LoadTestsCreateOrUpdateOptionalParams, + LoadTestsCreateOrUpdateResponse, + LoadTestResourcePatchRequestBody, + LoadTestsUpdateOptionalParams, + LoadTestsUpdateResponse, + LoadTestsDeleteOptionalParams, + LoadTestsListBySubscriptionNextResponse, + LoadTestsListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing LoadTests operations. */ +export class LoadTestsImpl implements LoadTests { + private readonly client: LoadTestClient; + + /** + * Initialize a new instance of the class LoadTests class. + * @param client Reference to the service client + */ + constructor(client: LoadTestClient) { + this.client = client; + } + + /** + * Lists loadtests resources in a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: LoadTestsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: LoadTestsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: LoadTestsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Lists loadtest resources in a 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?: LoadTestsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: LoadTestsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: LoadTestsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists loadtests resources in a subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: LoadTestsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Lists loadtest resources in a 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?: LoadTestsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, loadTestName, options }, + getOperationSpec + ); + } + + /** + * Create or update LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResource LoadTest resource data + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + loadTestName: string, + loadTestResource: LoadTestResource, + options?: LoadTestsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, loadTestName, loadTestResource, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Update a loadtest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data + * @param options The options parameters. + */ + update( + resourceGroupName: string, + loadTestName: string, + loadTestResourcePatchRequestBody: LoadTestResourcePatchRequestBody, + options?: LoadTestsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + loadTestName, + loadTestResourcePatchRequestBody, + options + }, + updateOperationSpec + ); + } + + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, loadTestName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + loadTestName, + 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?: LoadTestsListBySubscriptionNextOptionalParams + ): 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?: LoadTestsListByResourceGroupNextOptionalParams + ): 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.LoadTestService/loadTests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + 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.LoadTestService/loadTests", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + 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.LoadTestService/loadTests/{loadTestName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.loadTestResource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.loadTestResourcePatchRequestBody, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.loadTestName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LoadTestResourcePageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts b/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts new file mode 100644 index 000000000000..fe65332ed7af --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * 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 { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { LoadTestClient } from "../loadTestClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: LoadTestClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: LoadTestClient) { + this.client = client; + } + + /** + * Lists all the available API operations for Load Test Resource. + * @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: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all the available API operations for Load Test Resource. + * @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.LoadTestService/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 + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/index.ts b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..8a5be7b40018 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * 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 "./loadTests"; diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/loadTests.ts b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/loadTests.ts new file mode 100644 index 000000000000..3d222e890f40 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/loadTests.ts @@ -0,0 +1,103 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + LoadTestResource, + LoadTestsListBySubscriptionOptionalParams, + LoadTestsListByResourceGroupOptionalParams, + LoadTestsGetOptionalParams, + LoadTestsGetResponse, + LoadTestsCreateOrUpdateOptionalParams, + LoadTestsCreateOrUpdateResponse, + LoadTestResourcePatchRequestBody, + LoadTestsUpdateOptionalParams, + LoadTestsUpdateResponse, + LoadTestsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a LoadTests. */ +export interface LoadTests { + /** + * Lists loadtests resources in a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: LoadTestsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists loadtest resources in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: LoadTestsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsGetOptionalParams + ): Promise; + /** + * Create or update LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResource LoadTest resource data + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + loadTestName: string, + loadTestResource: LoadTestResource, + options?: LoadTestsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a loadtest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data + * @param options The options parameters. + */ + update( + resourceGroupName: string, + loadTestName: string, + loadTestResourcePatchRequestBody: LoadTestResourcePatchRequestBody, + options?: LoadTestsUpdateOptionalParams + ): Promise; + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a LoadTest resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + loadTestName: string, + options?: LoadTestsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/operations.ts b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..c9afaa2566ad --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * 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 { + /** + * Lists all the available API operations for Load Test Resource. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/loadtestservice/arm-loadtestservice/test/sampleTest.ts b/sdk/loadtestservice/arm-loadtestservice/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/loadtestservice/arm-loadtestservice/tsconfig.json b/sdk/loadtestservice/arm-loadtestservice/tsconfig.json new file mode 100644 index 000000000000..6e3251194117 --- /dev/null +++ b/sdk/loadtestservice/arm-loadtestservice/tsconfig.json @@ -0,0 +1,19 @@ +{ + "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 + }, + "include": ["./src/**/*.ts", "./test/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/sdk/loadtestservice/ci.yml b/sdk/loadtestservice/ci.yml new file mode 100644 index 000000000000..197d303c8e14 --- /dev/null +++ b/sdk/loadtestservice/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/loadtestservice/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/loadtestservice/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: loadtestservice + Artifacts: + - name: azure-arm-loadtestservice + safeName: azurearmloadtestservice + \ No newline at end of file