diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 035065ca35d2..22f5633d803f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -194,6 +194,7 @@ specifiers: '@rush-temp/arm-storage-profile-2020-09-01-hybrid': file:./projects/arm-storage-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-storagecache': file:./projects/arm-storagecache.tgz '@rush-temp/arm-storageimportexport': file:./projects/arm-storageimportexport.tgz + '@rush-temp/arm-storagemover': file:./projects/arm-storagemover.tgz '@rush-temp/arm-storagesync': file:./projects/arm-storagesync.tgz '@rush-temp/arm-storsimple1200series': file:./projects/arm-storsimple1200series.tgz '@rush-temp/arm-storsimple8000series': file:./projects/arm-storsimple8000series.tgz @@ -521,6 +522,7 @@ dependencies: '@rush-temp/arm-storage-profile-2020-09-01-hybrid': file:projects/arm-storage-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-storagecache': file:projects/arm-storagecache.tgz '@rush-temp/arm-storageimportexport': file:projects/arm-storageimportexport.tgz + '@rush-temp/arm-storagemover': file:projects/arm-storagemover.tgz '@rush-temp/arm-storagesync': file:projects/arm-storagesync.tgz '@rush-temp/arm-storsimple1200series': file:projects/arm-storsimple1200series.tgz '@rush-temp/arm-storsimple8000series': file:projects/arm-storsimple8000series.tgz @@ -3894,7 +3896,7 @@ packages: dependencies: semver: 7.3.8 shelljs: 0.8.5 - typescript: 5.0.0-dev.20230208 + typescript: 5.0.0-dev.20230209 dev: false /downlevel-dts/0.7.0: @@ -8779,8 +8781,8 @@ packages: hasBin: true dev: false - /typescript/5.0.0-dev.20230208: - resolution: {integrity: sha512-FkUy5kJ7XmLYxej9g9Lq4FMw3P6YjKuesa+1YoLvz2lHZuRuf91VxLsj9DWtknGCmjOVvyu+eefaeVknGTiI/Q==} + /typescript/5.0.0-dev.20230209: + resolution: {integrity: sha512-EKEs7zC40JV4BTgxULx8oDWSya4r2FeqSVpwuK7ZRu4OBErBo8n59wBAR6r+NBbkxG8JzxMOE2+fazbu/nLi9A==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -9540,7 +9542,7 @@ packages: dev: false file:projects/ai-language-conversations.tgz: - resolution: {integrity: sha512-yY5M/gHRLivJs1GxX0ON4tUQ4cHf5jopKrZXfcYjbpPYH4dAIStK1QeWFiG3S79MQ7fTNJMCQb/7RhIL3Gtnrw==, tarball: file:projects/ai-language-conversations.tgz} + resolution: {integrity: sha512-BC/j++g/PniHxRt71g8JwkBoi/8VY4QtE6jGA9H4DXcQkptS8F425OsM1rxIzEvFkLnlXPn0voeCHsEKgt9teg==, tarball: file:projects/ai-language-conversations.tgz} name: '@rush-temp/ai-language-conversations' version: 0.0.0 dependencies: @@ -14963,6 +14965,34 @@ packages: - supports-color dev: false + file:projects/arm-storagemover.tgz: + resolution: {integrity: sha512-cXP6J+f3Ey4/lzoizhS4youf3EUBb2Arxa6OEoW32NLr1qTdGVFxsvj570zcr6woAb/fZVNV+RQdyQ3i1pwr5w==, tarball: file:projects/arm-storagemover.tgz} + name: '@rush-temp/arm-storagemover' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.34.3_@types+node@14.18.36 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.79.1 + '@rollup/plugin-json': 4.1.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.4 + '@types/node': 14.18.36 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 8.6.0 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_p2gydaekoyjvl5wd3ixslt7iq4 + tslib: 2.5.0 + typescript: 4.8.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-storagesync.tgz: resolution: {integrity: sha512-EOW3XvhcXM+eWvE7NRSc/CBMAGhsIOD7/df7ZrFyH/xNTXINkiAzZFOeTKyRHexM/4PeNyRq3U22pIR0wirETw==, tarball: file:projects/arm-storagesync.tgz} name: '@rush-temp/arm-storagesync' @@ -15755,7 +15785,7 @@ packages: dev: false file:projects/communication-network-traversal.tgz: - resolution: {integrity: sha512-EvMiSy2kO8Rqsti4PvmNyb9ftsF47yNGKh857/IbNscxHRSBi73Dbu84ayET/UvRCqTKLwyA2rBLMBs3hM4zaw==, tarball: file:projects/communication-network-traversal.tgz} + resolution: {integrity: sha512-j/4HA05kscsrZahh1azdeLjO8ATvGcDxr45jHC30HmwGAkMXjc5ukuNq6yI8TPvwrAPqgKry5uY65kfhISTIUQ==, tarball: file:projects/communication-network-traversal.tgz} name: '@rush-temp/communication-network-traversal' version: 0.0.0 dependencies: diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 0646b0cbc1f5..f414b1ec7c79 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -43,3 +43,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-servicenetworking?view=azur https://docs.microsoft.com/javascript/api/@azure/arm-dataprotection?view=azure-node-preview https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/testproxy/transition-scripts/generate-assets-json.ps1 https://docs.microsoft.com/javascript/api/@azure/arm-liftrqumulo?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-storagemover?view=azure-node-preview diff --git a/rush.json b/rush.json index a1d7e3512b0f..0f78d8319b6f 100644 --- a/rush.json +++ b/rush.json @@ -1917,6 +1917,11 @@ "packageName": "@azure/arm-liftrqumulo", "projectFolder": "sdk/liftrqumulo/arm-liftrqumulo", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-storagemover", + "projectFolder": "sdk/storagemover/arm-storagemover", + "versionPolicyName": "management" } ] } diff --git a/sdk/storagemover/arm-storagemover/CHANGELOG.md b/sdk/storagemover/arm-storagemover/CHANGELOG.md new file mode 100644 index 000000000000..9cb2fd4564a7 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-02-07) + +The package of @azure/arm-storagemover is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/storagemover/arm-storagemover/LICENSE b/sdk/storagemover/arm-storagemover/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 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/storagemover/arm-storagemover/README.md b/sdk/storagemover/arm-storagemover/README.md new file mode 100644 index 000000000000..8f64927a90ed --- /dev/null +++ b/sdk/storagemover/arm-storagemover/README.md @@ -0,0 +1,109 @@ +# Azure StorageMover client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure StorageMover client. + +The Azure Storage Mover REST API. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-storagemover) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-storagemover?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-storagemover` package + +Install the Azure StorageMover client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-storagemover +``` + +### Create and authenticate a `StorageMoverClient` + +To create a client object to access the Azure StorageMover API, you will need the `endpoint` of your Azure StorageMover resource and a `credential`. The Azure StorageMover client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure StorageMover 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 StorageMover** 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +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 StorageMoverClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new StorageMoverClient(credential, 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 + +### StorageMoverClient + +`StorageMoverClient` is the primary interface for developers using the Azure StorageMover client library. Explore the methods on this client object to understand the different features of the Azure StorageMover 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%2Fstoragemover%2Farm-storagemover%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/storagemover/arm-storagemover/_meta.json b/sdk/storagemover/arm-storagemover/_meta.json new file mode 100644 index 000000000000..6d49f82b8d93 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "41645a4769694a7d63a2514b45146ec369eeb273", + "readme": "specification/storagemover/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --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\\storagemover\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.7 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.1", + "use": "@autorest/typescript@6.0.0-rc.7" +} \ No newline at end of file diff --git a/sdk/storagemover/arm-storagemover/api-extractor.json b/sdk/storagemover/arm-storagemover/api-extractor.json new file mode 100644 index 000000000000..2370e17385a6 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$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-storagemover.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/storagemover/arm-storagemover/package.json b/sdk/storagemover/arm-storagemover/package.json new file mode 100644 index 000000000000..7b0fb60fb0c5 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/package.json @@ -0,0 +1,123 @@ +{ + "name": "@azure/arm-storagemover", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for StorageMoverClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.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.6.1", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.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-storagemover.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.8.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^8.2.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "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": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/storageMoverClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storagemover?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_create_test.json b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_create_test.json new file mode 100644 index 000000000000..08eb9d2c5373 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_create_test.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName?api-version=2022-07-01-preview", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Content-Length": "127", + "Content-Type": "application/json", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "42170bdd-9ad9-4be2-ab24-fbf8b94c8078" + }, + "RequestBody": { + "tags": { + "key1": "value1", + "key2": "value2" + }, + "location": "eastus", + "properties": { + "description": "Example Storage Mover Description" + } + }, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:48 GMT", + "ETag": "\u0022f606ef7d-0000-0100-0000-63e218de0000\u0022", + "Expires": "-1", + "mise-correlation-id": "90c2ad53-d048-4f1a-867c-e777990e26de", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "092c1c33-ec75-4824-b800-fed51c869fa9", + "x-ms-providerhub-traffic": "True", + "x-ms-ratelimit-remaining-subscription-writes": "1199", + "x-ms-request-id": "2a84ac90-bf76-42fa-8878-b43961fb54b4", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092449Z:092c1c33-ec75-4824-b800-fed51c869fa9" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "name": "storageMoverName", + "type": "microsoft.storagemover/storagemovers", + "location": "eastus", + "tags": { + "key1": "value1", + "key2": "value2" + }, + "systemData": { + "createdBy": "azure_client_id", + "createdByType": "Application", + "createdAt": "2023-02-07T09:24:45.695118Z", + "lastModifiedBy": "azure_client_id", + "lastModifiedByType": "Application", + "lastModifiedAt": "2023-02-07T09:24:45.695118Z" + }, + "properties": { + "description": "Example Storage Mover Description", + "provisioningState": "Succeeded" + } + } + } + ], + "Variables": {} +} diff --git a/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_delete_test.json b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_delete_test.json new file mode 100644 index 000000000000..1c2a3f93cecc --- /dev/null +++ b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_delete_test.json @@ -0,0 +1,511 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName?api-version=2022-07-01-preview", + "RequestMethod": "DELETE", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "81e771a6-a0c7-4ee8-9136-db738a0add51" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Azure-AsyncOperation": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "Cache-Control": "no-cache", + "Content-Length": "4", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:54 GMT", + "ETag": "\u0022f606967e-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Location": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "c282c59b-bf85-40f8-a8c2-684630ce6be7", + "x-ms-providerhub-traffic": "True", + "x-ms-ratelimit-remaining-subscription-deletes": "14999", + "x-ms-request-id": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092454Z:c282c59b-bf85-40f8-a8c2-684630ce6be7" + }, + "ResponseBody": "null" + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "5d2f908a-5068-485a-8b8e-72f12f8f30cd" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:54 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "d237d134-4832-4618-a902-0599ab062fdf", + "x-ms-ratelimit-remaining-subscription-reads": "11997", + "x-ms-request-id": "036a5cca-8661-4815-b073-636ac2763db2", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092455Z:d237d134-4832-4618-a902-0599ab062fdf" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "64b5e26d-a5f2-4b91-abab-522ae5a711c4" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:54 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6c5c3839-9403-4349-b46f-8f8a557d6ef8", + "x-ms-ratelimit-remaining-subscription-reads": "11996", + "x-ms-request-id": "9da2417c-2161-4ff3-9e80-e756febfb8e7", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092455Z:6c5c3839-9403-4349-b46f-8f8a557d6ef8" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "0deeab14-ba7e-411e-be13-f1167f28deb4" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:57 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "978d9152-ddbe-4fbc-9e17-ee60eacb6212", + "x-ms-ratelimit-remaining-subscription-reads": "11995", + "x-ms-request-id": "5f245902-e11b-4824-8b0d-a0f23c2c6b63", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092457Z:978d9152-ddbe-4fbc-9e17-ee60eacb6212" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "10ef44a6-5793-4a9d-add4-d0ce3d1cfa96" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:59 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "74f31afa-7a4a-4231-90f2-7bcf97488cea", + "x-ms-ratelimit-remaining-subscription-reads": "11994", + "x-ms-request-id": "726ef8ec-2756-4d86-9833-0adaf2ed7d1d", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092500Z:74f31afa-7a4a-4231-90f2-7bcf97488cea" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "f2d64bcf-f681-46a3-8c49-913d1be63e7b" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:01 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a4659662-ddd0-430c-9b84-ef998f254f2e", + "x-ms-ratelimit-remaining-subscription-reads": "11993", + "x-ms-request-id": "32b36b8d-d141-4c2e-9295-0f55aae91bdc", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092502Z:a4659662-ddd0-430c-9b84-ef998f254f2e" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "b2099e8b-4803-47ee-a65b-4287e3b359e6" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:03 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "6cb4f223-e1c6-4589-a687-d2428d37257c", + "x-ms-ratelimit-remaining-subscription-reads": "11992", + "x-ms-request-id": "128a38ec-f49f-4330-a559-98c2376e28c0", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092504Z:6cb4f223-e1c6-4589-a687-d2428d37257c" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "6a404380-bd8f-43ad-927d-f5560e113011" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:06 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "20682e2d-feb4-4cb5-a06d-bee2079ffd7f", + "x-ms-ratelimit-remaining-subscription-reads": "11991", + "x-ms-request-id": "e07a7aa0-1ace-4345-b273-60f356773343", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092507Z:20682e2d-feb4-4cb5-a06d-bee2079ffd7f" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "5b16c414-aaff-467d-abea-3a7b4962a221" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:08 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "ba9fdb46-2386-4f13-aa44-b9bbb0417212", + "x-ms-ratelimit-remaining-subscription-reads": "11990", + "x-ms-request-id": "103f3a61-af61-4d94-a53d-7824e3ce771c", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092509Z:ba9fdb46-2386-4f13-aa44-b9bbb0417212" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "6d1bccf5-bfce-4ef2-aafa-5c545bf98c35" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:10 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "eea9f5d1-1f62-4684-a30e-21f4351fa0cd", + "x-ms-ratelimit-remaining-subscription-reads": "11989", + "x-ms-request-id": "8a8f3dd8-62b4-48d1-8cf8-1617250b65bc", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092511Z:eea9f5d1-1f62-4684-a30e-21f4351fa0cd" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "6dc4dfc2-e9fc-4453-8b60-6b2b7f570a5d" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:13 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "82a319af-d466-4cd5-8bf5-cdbcb75c180b", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-request-id": "2db05f9a-b365-421b-ae68-74c838219922", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092514Z:82a319af-d466-4cd5-8bf5-cdbcb75c180b" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "a52cdb37-ee87-4976-9f39-551fe5efb2b2" + }, + "RequestBody": null, + "StatusCode": 202, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Length": "529", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:15 GMT", + "ETag": "\u0022a900e08c-0000-0100-0000-63e218e60000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "a45c74a5-fac8-4e23-a86e-6eaff6dacaac", + "x-ms-ratelimit-remaining-subscription-reads": "11987", + "x-ms-request-id": "efb42d4d-cd5f-44f9-ad4e-fa52ee3be5e7", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092516Z:a45c74a5-fac8-4e23-a86e-6eaff6dacaac" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Deleting", + "startTime": "2023-02-07T09:24:54.2421223Z" + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "a65c12d4-2efe-4bf0-b5a8-0f062c775473" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:17 GMT", + "ETag": "\u002203004210-0000-4d00-0000-63e218fc0000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "28bbe59d-93aa-480e-b251-557ae8750e8c", + "x-ms-ratelimit-remaining-subscription-reads": "11986", + "x-ms-request-id": "1a12d7f3-b77a-41e4-8e49-114f3dc9be57", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092518Z:28bbe59d-93aa-480e-b251-557ae8750e8c" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/locations/EASTUS/operationStatuses/b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "name": "b5f3bad3-8bd8-46f4-a485-b22bb4f28dd4*E4A59B66E3F2AAE5CB21C86F57570C18B4BE02191B638630F2AB2D9C0BFCA62D", + "resourceId": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "status": "Succeeded", + "startTime": "2023-02-07T09:24:54.2421223Z", + "properties": null + } + }, + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/storageMovers?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "aebf3e81-ca14-439a-bef5-d468fcf862ae" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "12", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:25:18 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "faf43998-caca-49cd-950f-a85628961ef1", + "x-ms-original-request-ids": [ + "cf36a792-57b9-41cd-b429-262c5d8f5bdd", + "aa71d8f1-4186-49d9-bb7d-a9088c93c203", + "fae3d68d-5181-4c0f-a853-0face625f24a" + ], + "x-ms-ratelimit-remaining-subscription-reads": "11985", + "x-ms-request-id": "faf43998-caca-49cd-950f-a85628961ef1", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092519Z:faf43998-caca-49cd-950f-a85628961ef1" + }, + "ResponseBody": { + "value": [] + } + } + ], + "Variables": {} +} diff --git a/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_get_test.json b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_get_test.json new file mode 100644 index 000000000000..868ee397d85d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_get_test.json @@ -0,0 +1,59 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "dc3b12a0-c603-4e55-825d-37b059e6be5b" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:49 GMT", + "ETag": "\u0022f606ef7d-0000-0100-0000-63e218de0000\u0022", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Transfer-Encoding": "chunked", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "222d8a2e-445f-4e29-9c24-e72325918f25", + "x-ms-providerhub-traffic": "True", + "x-ms-ratelimit-remaining-subscription-reads": "11999", + "x-ms-request-id": "d70b18c5-0939-43db-8e29-78c26bd418e0", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092450Z:222d8a2e-445f-4e29-9c24-e72325918f25" + }, + "ResponseBody": { + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "name": "storageMoverName", + "type": "microsoft.storagemover/storagemovers", + "location": "eastus", + "tags": { + "key1": "value1", + "key2": "value2" + }, + "systemData": { + "createdBy": "azure_client_id", + "createdByType": "Application", + "createdAt": "2023-02-07T09:24:45.695118Z", + "lastModifiedBy": "azure_client_id", + "lastModifiedByType": "Application", + "lastModifiedAt": "2023-02-07T09:24:45.695118Z" + }, + "properties": { + "description": "Example Storage Mover Description", + "provisioningState": "Succeeded" + } + } + } + ], + "Variables": {} +} diff --git a/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_list_test.json b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_list_test.json new file mode 100644 index 000000000000..8c6ead1077ca --- /dev/null +++ b/sdk/storagemover/arm-storagemover/recordings/node/storagemover_test/recording_storagemovers_list_test.json @@ -0,0 +1,66 @@ +{ + "Entries": [ + { + "RequestUri": "https://management.azure.com/subscriptions/azure_subscription_id/providers/Microsoft.StorageMover/storageMovers?api-version=2022-07-01-preview", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-arm-storagemover/1.0.0-beta.1 core-rest-pipeline/1.10.2 Node/v16.17.0 OS/(x64-Windows_NT-10.0.22621)", + "x-ms-client-request-id": "27e2b590-3b65-4239-b73e-e057120ba9a9" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Cache-Control": "no-cache", + "Content-Encoding": "gzip", + "Content-Length": "609", + "Content-Type": "application/json; charset=utf-8", + "Date": "Tue, 07 Feb 2023 09:24:51 GMT", + "Expires": "-1", + "Pragma": "no-cache", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains", + "Vary": "Accept-Encoding", + "X-Content-Type-Options": "nosniff", + "x-ms-correlation-request-id": "0b66baa0-ac5d-4f22-ba35-277bbe1eb152", + "x-ms-original-request-ids": [ + "8afaa9ba-2483-431a-8922-975fb1849745", + "2411ecf1-302c-4371-8f70-bb051ecaf90d", + "a53aa2eb-5498-4e93-a8c0-a09b0ce9d1cc" + ], + "x-ms-ratelimit-remaining-subscription-reads": "11998", + "x-ms-request-id": "0b66baa0-ac5d-4f22-ba35-277bbe1eb152", + "x-ms-routing-request-id": "SOUTHEASTASIA:20230207T092452Z:0b66baa0-ac5d-4f22-ba35-277bbe1eb152" + }, + "ResponseBody": { + "value": [ + { + "id": "/subscriptions/azure_subscription_id/resourceGroups/myjstest/providers/Microsoft.StorageMover/storageMovers/storageMoverName", + "name": "storageMoverName", + "type": "microsoft.storagemover/storagemovers", + "location": "eastus", + "tags": { + "key1": "value1", + "key2": "value2" + }, + "systemData": { + "createdBy": "azure_client_id", + "createdByType": "Application", + "createdAt": "2023-02-07T09:24:45.695118Z", + "lastModifiedBy": "azure_client_id", + "lastModifiedByType": "Application", + "lastModifiedAt": "2023-02-07T09:24:45.695118Z" + }, + "properties": { + "description": "Example Storage Mover Description", + "provisioningState": "Succeeded" + } + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/storagemover/arm-storagemover/review/arm-storagemover.api.md b/sdk/storagemover/arm-storagemover/review/arm-storagemover.api.md new file mode 100644 index 000000000000..e36c7bd94a09 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/review/arm-storagemover.api.md @@ -0,0 +1,768 @@ +## API Report File for "@azure/arm-storagemover" + +> 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 interface Agent extends ProxyResource { + readonly agentStatus?: AgentStatus; + readonly agentVersion?: string; + arcResourceId: string; + arcVmUuid: string; + description?: string; + readonly errorDetails?: AgentPropertiesErrorDetails; + readonly lastStatusUpdate?: Date; + readonly localIPAddress?: string; + readonly memoryInMB?: number; + readonly numberOfCores?: number; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; + readonly uptimeInSeconds?: number; +} + +// @public +export interface AgentList { + readonly nextLink?: string; + readonly value?: Agent[]; +} + +// @public (undocumented) +export interface AgentPropertiesErrorDetails { + code?: string; + message?: string; +} + +// @public +export interface Agents { + beginDelete(resourceGroupName: string, storageMoverName: string, agentName: string, options?: AgentsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageMoverName: string, agentName: string, options?: AgentsDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, storageMoverName: string, agentName: string, agent: Agent, options?: AgentsCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageMoverName: string, agentName: string, options?: AgentsGetOptionalParams): Promise; + list(resourceGroupName: string, storageMoverName: string, options?: AgentsListOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, storageMoverName: string, agentName: string, agent: AgentUpdateParameters, options?: AgentsUpdateOptionalParams): Promise; +} + +// @public +export interface AgentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AgentsCreateOrUpdateResponse = Agent; + +// @public +export interface AgentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AgentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AgentsGetResponse = Agent; + +// @public +export interface AgentsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AgentsListNextResponse = AgentList; + +// @public +export interface AgentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AgentsListResponse = AgentList; + +// @public +export type AgentStatus = string; + +// @public +export interface AgentsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AgentsUpdateResponse = Agent; + +// @public +export interface AgentUpdateParameters { + description?: string; +} + +// @public (undocumented) +export interface AzureStorageBlobContainerEndpointProperties extends EndpointBaseProperties { + blobContainerName: string; + endpointType: "AzureStorageBlobContainer"; + storageAccountResourceId: string; +} + +// @public (undocumented) +export interface AzureStorageBlobContainerEndpointUpdateProperties extends EndpointBaseUpdateProperties { +} + +// @public +export type CopyMode = string; + +// @public +export type CreatedByType = string; + +// @public +export interface Endpoint extends ProxyResource { + properties: EndpointBasePropertiesUnion; + readonly systemData?: SystemData; +} + +// @public +export interface EndpointBaseProperties { + description?: string; + endpointType: "AzureStorageBlobContainer" | "NfsMount"; + readonly provisioningState?: ProvisioningState; +} + +// @public (undocumented) +export type EndpointBasePropertiesUnion = EndpointBaseProperties | AzureStorageBlobContainerEndpointProperties | NfsMountEndpointProperties; + +// @public +export interface EndpointBaseUpdateParameters { + properties?: EndpointBaseUpdateProperties; +} + +// @public +export interface EndpointBaseUpdateProperties { + description?: string; +} + +// @public +export interface EndpointList { + readonly nextLink?: string; + readonly value?: Endpoint[]; +} + +// @public +export interface Endpoints { + beginDelete(resourceGroupName: string, storageMoverName: string, endpointName: string, options?: EndpointsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageMoverName: string, endpointName: string, options?: EndpointsDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, storageMoverName: string, endpointName: string, endpoint: Endpoint, options?: EndpointsCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageMoverName: string, endpointName: string, options?: EndpointsGetOptionalParams): Promise; + list(resourceGroupName: string, storageMoverName: string, options?: EndpointsListOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, storageMoverName: string, endpointName: string, endpoint: EndpointBaseUpdateParameters, options?: EndpointsUpdateOptionalParams): Promise; +} + +// @public +export interface EndpointsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsCreateOrUpdateResponse = Endpoint; + +// @public +export interface EndpointsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface EndpointsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsGetResponse = Endpoint; + +// @public +export interface EndpointsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsListNextResponse = EndpointList; + +// @public +export interface EndpointsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsListResponse = EndpointList; + +// @public +export interface EndpointsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EndpointsUpdateResponse = Endpoint; + +// @public +export type EndpointType = 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 function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface JobDefinition extends ProxyResource { + agentName?: string; + readonly agentResourceId?: string; + copyMode: CopyMode; + description?: string; + readonly latestJobRunName?: string; + readonly latestJobRunResourceId?: string; + readonly latestJobRunStatus?: JobRunStatus; + readonly provisioningState?: ProvisioningState; + sourceName: string; + readonly sourceResourceId?: string; + sourceSubpath?: string; + readonly systemData?: SystemData; + targetName: string; + readonly targetResourceId?: string; + targetSubpath?: string; +} + +// @public +export interface JobDefinitionList { + readonly nextLink?: string; + readonly value?: JobDefinition[]; +} + +// @public +export interface JobDefinitions { + beginDelete(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobDefinitionsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobDefinitionsDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, jobDefinition: JobDefinition, options?: JobDefinitionsCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobDefinitionsGetOptionalParams): Promise; + list(resourceGroupName: string, storageMoverName: string, projectName: string, options?: JobDefinitionsListOptionalParams): PagedAsyncIterableIterator; + startJob(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobDefinitionsStartJobOptionalParams): Promise; + stopJob(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobDefinitionsStopJobOptionalParams): Promise; + update(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, jobDefinition: JobDefinitionUpdateParameters, options?: JobDefinitionsUpdateOptionalParams): Promise; +} + +// @public +export interface JobDefinitionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsCreateOrUpdateResponse = JobDefinition; + +// @public +export interface JobDefinitionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface JobDefinitionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsGetResponse = JobDefinition; + +// @public +export interface JobDefinitionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsListNextResponse = JobDefinitionList; + +// @public +export interface JobDefinitionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsListResponse = JobDefinitionList; + +// @public +export interface JobDefinitionsStartJobOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsStartJobResponse = JobRunResourceId; + +// @public +export interface JobDefinitionsStopJobOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsStopJobResponse = JobRunResourceId; + +// @public +export interface JobDefinitionsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobDefinitionsUpdateResponse = JobDefinition; + +// @public +export interface JobDefinitionUpdateParameters { + agentName?: string; + copyMode?: CopyMode; + description?: string; +} + +// @public +export interface JobRun extends ProxyResource { + readonly agentName?: string; + readonly agentResourceId?: string; + readonly bytesExcluded?: number; + readonly bytesFailed?: number; + readonly bytesNoTransferNeeded?: number; + readonly bytesScanned?: number; + readonly bytesTransferred?: number; + readonly bytesUnsupported?: number; + readonly error?: JobRunError; + readonly executionEndTime?: Date; + readonly executionStartTime?: Date; + readonly itemsExcluded?: number; + readonly itemsFailed?: number; + readonly itemsNoTransferNeeded?: number; + readonly itemsScanned?: number; + readonly itemsTransferred?: number; + readonly itemsUnsupported?: number; + readonly jobDefinitionProperties?: Record; + readonly lastStatusUpdate?: Date; + readonly provisioningState?: ProvisioningState; + readonly scanStatus?: JobRunScanStatus; + readonly sourceName?: string; + readonly sourceProperties?: Record; + readonly sourceResourceId?: string; + readonly status?: JobRunStatus; + readonly systemData?: SystemData; + readonly targetName?: string; + readonly targetProperties?: Record; + readonly targetResourceId?: string; +} + +// @public +export interface JobRunError { + code?: string; + message?: string; + target?: string; +} + +// @public +export interface JobRunList { + readonly nextLink?: string; + readonly value?: JobRun[]; +} + +// @public +export interface JobRunResourceId { + readonly jobRunResourceId?: string; +} + +// @public +export interface JobRuns { + get(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, jobRunName: string, options?: JobRunsGetOptionalParams): Promise; + list(resourceGroupName: string, storageMoverName: string, projectName: string, jobDefinitionName: string, options?: JobRunsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export type JobRunScanStatus = string; + +// @public +export interface JobRunsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobRunsGetResponse = JobRun; + +// @public +export interface JobRunsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobRunsListNextResponse = JobRunList; + +// @public +export interface JobRunsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type JobRunsListResponse = JobRunList; + +// @public +export type JobRunStatus = string; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAgentStatus { + Executing = "Executing", + Offline = "Offline", + Online = "Online", + Registering = "Registering", + RequiresAttention = "RequiresAttention", + Unregistering = "Unregistering" +} + +// @public +export enum KnownCopyMode { + Additive = "Additive", + Mirror = "Mirror" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownEndpointType { + AzureStorageBlobContainer = "AzureStorageBlobContainer", + NfsMount = "NfsMount" +} + +// @public +export enum KnownJobRunScanStatus { + Completed = "Completed", + NotStarted = "NotStarted", + Scanning = "Scanning" +} + +// @public +export enum KnownJobRunStatus { + Canceled = "Canceled", + Canceling = "Canceling", + CancelRequested = "CancelRequested", + Failed = "Failed", + Queued = "Queued", + Running = "Running", + Started = "Started", + Succeeded = "Succeeded" +} + +// @public +export enum KnownNfsVersion { + NFSauto = "NFSauto", + NFSv3 = "NFSv3", + NFSv4 = "NFSv4" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Succeeded = "Succeeded" +} + +// @public (undocumented) +export interface NfsMountEndpointProperties extends EndpointBaseProperties { + endpointType: "NfsMount"; + export: string; + host: string; + nfsVersion?: NfsVersion; +} + +// @public (undocumented) +export interface NfsMountEndpointUpdateProperties extends EndpointBaseUpdateProperties { +} + +// @public +export type NfsVersion = string; + +// @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 Project extends ProxyResource { + description?: string; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} + +// @public +export interface ProjectList { + readonly nextLink?: string; + readonly value?: Project[]; +} + +// @public +export interface Projects { + beginDelete(resourceGroupName: string, storageMoverName: string, projectName: string, options?: ProjectsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageMoverName: string, projectName: string, options?: ProjectsDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, storageMoverName: string, projectName: string, project: Project, options?: ProjectsCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageMoverName: string, projectName: string, options?: ProjectsGetOptionalParams): Promise; + list(resourceGroupName: string, storageMoverName: string, options?: ProjectsListOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, storageMoverName: string, projectName: string, project: ProjectUpdateParameters, options?: ProjectsUpdateOptionalParams): Promise; +} + +// @public +export interface ProjectsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProjectsCreateOrUpdateResponse = Project; + +// @public +export interface ProjectsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ProjectsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProjectsGetResponse = Project; + +// @public +export interface ProjectsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProjectsListNextResponse = ProjectList; + +// @public +export interface ProjectsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProjectsListResponse = ProjectList; + +// @public +export interface ProjectsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProjectsUpdateResponse = Project; + +// @public +export interface ProjectUpdateParameters { + description?: string; +} + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface StorageMover extends TrackedResource { + description?: string; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} + +// @public (undocumented) +export class StorageMoverClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: StorageMoverClientOptionalParams); + // (undocumented) + agents: Agents; + // (undocumented) + apiVersion: string; + // (undocumented) + endpoints: Endpoints; + // (undocumented) + jobDefinitions: JobDefinitions; + // (undocumented) + jobRuns: JobRuns; + // (undocumented) + operations: Operations; + // (undocumented) + projects: Projects; + // (undocumented) + storageMovers: StorageMovers; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface StorageMoverClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface StorageMoverList { + readonly nextLink?: string; + readonly value?: StorageMover[]; +} + +// @public +export interface StorageMovers { + beginDelete(resourceGroupName: string, storageMoverName: string, options?: StorageMoversDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageMoverName: string, options?: StorageMoversDeleteOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, storageMoverName: string, storageMover: StorageMover, options?: StorageMoversCreateOrUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageMoverName: string, options?: StorageMoversGetOptionalParams): Promise; + list(resourceGroupName: string, options?: StorageMoversListOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: StorageMoversListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, storageMoverName: string, storageMover: StorageMoverUpdateParameters, options?: StorageMoversUpdateOptionalParams): Promise; +} + +// @public +export interface StorageMoversCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversCreateOrUpdateResponse = StorageMover; + +// @public +export interface StorageMoversDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageMoversGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversGetResponse = StorageMover; + +// @public +export interface StorageMoversListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversListBySubscriptionNextResponse = StorageMoverList; + +// @public +export interface StorageMoversListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversListBySubscriptionResponse = StorageMoverList; + +// @public +export interface StorageMoversListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversListNextResponse = StorageMoverList; + +// @public +export interface StorageMoversListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversListResponse = StorageMoverList; + +// @public +export interface StorageMoversUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageMoversUpdateResponse = StorageMover; + +// @public +export interface StorageMoverUpdateParameters { + description?: string; + tags?: { + [propertyName: string]: 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?: { + [propertyName: string]: string; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/storagemover/arm-storagemover/rollup.config.js b/sdk/storagemover/arm-storagemover/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/rollup.config.js @@ -0,0 +1,122 @@ +/* + * 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"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * 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(), + 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()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/storagemover/arm-storagemover/sample.env b/sdk/storagemover/arm-storagemover/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/sample.env @@ -0,0 +1,4 @@ +# 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/storagemover/arm-storagemover/samples-dev/agentsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/agentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3890cc96e09b --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/agentsCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { Agent, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * + * @summary Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json + */ +async function agentsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent: Agent = { + description: "Example Agent Description", + arcResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.HybridCompute/machines/examples-hybridComputeName", + arcVmUuid: "3bb2c024-eba9-4d18-9e7a-1d772fcc5fe9" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.createOrUpdate( + resourceGroupName, + storageMoverName, + agentName, + agent + ); + console.log(result); +} + +async function main() { + agentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/agentsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/agentsDeleteSample.ts new file mode 100644 index 000000000000..0cfe0d45e981 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/agentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes an Agent resource. + * + * @summary Deletes an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json + */ +async function agentsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + agentName + ); + console.log(result); +} + +async function main() { + agentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/agentsGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/agentsGetSample.ts new file mode 100644 index 000000000000..7ae478642074 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/agentsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an Agent resource. + * + * @summary Gets an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json + */ +async function agentsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.get( + resourceGroupName, + storageMoverName, + agentName + ); + console.log(result); +} + +async function main() { + agentsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/agentsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/agentsListSample.ts new file mode 100644 index 000000000000..99ab25fd02ed --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/agentsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Agents in a Storage Mover. + * + * @summary Lists all Agents in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json + */ +async function agentsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agents.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + agentsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/agentsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/agentsUpdateSample.ts new file mode 100644 index 000000000000..8b8160b1343f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/agentsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + AgentUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource. + * + * @summary Creates or updates an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json + */ +async function agentsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent: AgentUpdateParameters = { + description: "Updated Agent Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.update( + resourceGroupName, + storageMoverName, + agentName, + agent + ); + console.log(result); +} + +async function main() { + agentsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/endpointsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/endpointsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9d0970a9466f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/endpointsCreateOrUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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 { Endpoint, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * + * @summary Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json + */ +async function endpointsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint: Endpoint = { + properties: { + description: "Example Storage Container Endpoint Description", + blobContainerName: "examples-blobContainerName", + endpointType: "AzureStorageBlobContainer", + storageAccountResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.Storage/storageAccounts/examples-storageAccountName/" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.createOrUpdate( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/endpointsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/endpointsDeleteSample.ts new file mode 100644 index 000000000000..b32fbb45a22d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/endpointsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes an Endpoint resource. + * + * @summary Deletes an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json + */ +async function endpointsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + endpointName + ); + console.log(result); +} + +async function main() { + endpointsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/endpointsGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/endpointsGetSample.ts new file mode 100644 index 000000000000..3b77d4198401 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/endpointsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an Endpoint resource. + * + * @summary Gets an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json + */ +async function endpointsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.get( + resourceGroupName, + storageMoverName, + endpointName + ); + console.log(result); +} + +async function main() { + endpointsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/endpointsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/endpointsListSample.ts new file mode 100644 index 000000000000..1bb10c95c706 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/endpointsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Endpoints in a Storage Mover. + * + * @summary Lists all Endpoints in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json + */ +async function endpointsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.endpoints.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + endpointsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/endpointsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/endpointsUpdateSample.ts new file mode 100644 index 000000000000..88b2d6deb623 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/endpointsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + EndpointBaseUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json + */ +async function endpointsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint: EndpointBaseUpdateParameters = { + properties: { description: "Updated Endpoint Description" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.update( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1062f478cbbf --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * 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 { JobDefinition, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * + * @summary Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json + */ +async function jobDefinitionsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition: JobDefinition = { + description: "Example Job Definition Description", + agentName: "migration-agent", + copyMode: "Additive", + sourceName: "examples-sourceEndpointName", + sourceSubpath: "/", + targetName: "examples-targetEndpointName", + targetSubpath: "/" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsDeleteSample.ts new file mode 100644 index 000000000000..7c2be1b9a0c6 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsDeleteSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Job Definition resource. + * + * @summary Deletes a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsGetSample.ts new file mode 100644 index 000000000000..e30902b418e3 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsGetSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Job Definition resource. + * + * @summary Gets a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json + */ +async function jobDefinitionsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsListSample.ts new file mode 100644 index 000000000000..39935179c028 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Job Definitions in a Project. + * + * @summary Lists all Job Definitions in a Project. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json + */ +async function jobDefinitionsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobDefinitions.list( + resourceGroupName, + storageMoverName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobDefinitionsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStartJobSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStartJobSample.ts new file mode 100644 index 000000000000..81a26b769985 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStartJobSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * + * @summary Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json + */ +async function jobDefinitionsStartJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.startJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStartJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStopJobSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStopJobSample.ts new file mode 100644 index 000000000000..2750806bab5e --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsStopJobSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Requests the Agent of any active instance of this Job Definition to stop. + * + * @summary Requests the Agent of any active instance of this Job Definition to stop. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json + */ +async function jobDefinitionsStopJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.stopJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStopJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsUpdateSample.ts new file mode 100644 index 000000000000..9d7abd304417 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobDefinitionsUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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 { + JobDefinitionUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json + */ +async function jobDefinitionsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition: JobDefinitionUpdateParameters = { + description: "Updated Job Definition Description", + agentName: "updatedAgentName" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.update( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobRunsGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobRunsGetSample.ts new file mode 100644 index 000000000000..7e9d158789c8 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobRunsGetSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Job Run resource. + * + * @summary Gets a Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json + */ +async function jobRunsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobRunName = "examples-jobRunName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobRuns.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName + ); + console.log(result); +} + +async function main() { + jobRunsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/jobRunsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/jobRunsListSample.ts new file mode 100644 index 000000000000..18be51f8a0fc --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/jobRunsListSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Job Runs in a Job Definition. + * + * @summary Lists all Job Runs in a Job Definition. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json + */ +async function jobRunsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobRuns.list( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobRunsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/operationsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..6a5d2653b0e3 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the supported operations for the Azure Storage Mover REST API. + * + * @summary Lists all the supported operations for the Azure Storage Mover REST API. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(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/storagemover/arm-storagemover/samples-dev/projectsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/projectsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ebdf21fdb2b1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/projectsCreateOrUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { Project, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Project resource, which is a logical grouping of related jobs. + * + * @summary Creates or updates a Project resource, which is a logical grouping of related jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project: Project = { description: "Example Project Description" }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/projectsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/projectsDeleteSample.ts new file mode 100644 index 000000000000..4092a696e51c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/projectsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Project resource. + * + * @summary Deletes a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/projectsGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/projectsGetSample.ts new file mode 100644 index 000000000000..3e93db18ecc4 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/projectsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Project resource. + * + * @summary Gets a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.get( + resourceGroupName, + storageMoverName, + projectName + ); + console.log(result); +} + +async function main() { + projectsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/projectsListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/projectsListSample.ts new file mode 100644 index 000000000000..dca170172455 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/projectsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Projects in a Storage Mover. + * + * @summary Lists all Projects in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + projectsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/projectsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/projectsUpdateSample.ts new file mode 100644 index 000000000000..40093d6ee18a --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/projectsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + ProjectUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project: ProjectUpdateParameters = { + description: "Example Project Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.update( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversCreateOrUpdateSample.ts new file mode 100644 index 000000000000..15de9a1f19ab --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversCreateOrUpdateSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { StorageMover, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a top-level Storage Mover resource. + * + * @summary Creates or updates a top-level Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json + */ +async function storageMoversCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover: StorageMover = { + description: "Example Storage Mover Description", + location: "eastus2", + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.createOrUpdate( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversDeleteSample.ts new file mode 100644 index 000000000000..2831a2dd8124 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Storage Mover resource. + * + * @summary Deletes a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json + */ +async function storageMoversDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.beginDeleteAndWait( + resourceGroupName, + storageMoverName + ); + console.log(result); +} + +async function main() { + storageMoversDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversGetSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversGetSample.ts new file mode 100644 index 000000000000..68c0e2476f6c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversGetSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Storage Mover resource. + * + * @summary Gets a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json + */ +async function storageMoversGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.get( + resourceGroupName, + storageMoverName + ); + console.log(result); +} + +async function main() { + storageMoversGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListBySubscriptionSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListBySubscriptionSample.ts new file mode 100644 index 000000000000..c7611ad5d7a1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a subscription. + * + * @summary Lists all Storage Movers in a subscription. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListSample.ts new file mode 100644 index 000000000000..d60380158ee9 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversListSample.ts @@ -0,0 +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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a resource group. + * + * @summary Lists all Storage Movers in a resource group. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.list(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples-dev/storageMoversUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversUpdateSample.ts new file mode 100644 index 000000000000..ba057caa7267 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples-dev/storageMoversUpdateSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + StorageMoverUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.json + */ +async function storageMoversUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover: StorageMoverUpdateParameters = { + description: "Updated Storage Mover Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.update( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/README.md b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..2bcaa15e886b --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/README.md @@ -0,0 +1,110 @@ +# 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** | +| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [agentsCreateOrUpdateSample.js][agentscreateorupdatesample] | Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json | +| [agentsDeleteSample.js][agentsdeletesample] | Deletes an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json | +| [agentsGetSample.js][agentsgetsample] | Gets an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json | +| [agentsListSample.js][agentslistsample] | Lists all Agents in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json | +| [agentsUpdateSample.js][agentsupdatesample] | Creates or updates an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json | +| [endpointsCreateOrUpdateSample.js][endpointscreateorupdatesample] | Creates or updates an Endpoint resource, which represents a data transfer source or destination. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json | +| [endpointsDeleteSample.js][endpointsdeletesample] | Deletes an Endpoint resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json | +| [endpointsGetSample.js][endpointsgetsample] | Gets an Endpoint resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json | +| [endpointsListSample.js][endpointslistsample] | Lists all Endpoints in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json | +| [endpointsUpdateSample.js][endpointsupdatesample] | Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json | +| [jobDefinitionsCreateOrUpdateSample.js][jobdefinitionscreateorupdatesample] | Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json | +| [jobDefinitionsDeleteSample.js][jobdefinitionsdeletesample] | Deletes a Job Definition resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json | +| [jobDefinitionsGetSample.js][jobdefinitionsgetsample] | Gets a Job Definition resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json | +| [jobDefinitionsListSample.js][jobdefinitionslistsample] | Lists all Job Definitions in a Project. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json | +| [jobDefinitionsStartJobSample.js][jobdefinitionsstartjobsample] | Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json | +| [jobDefinitionsStopJobSample.js][jobdefinitionsstopjobsample] | Requests the Agent of any active instance of this Job Definition to stop. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json | +| [jobDefinitionsUpdateSample.js][jobdefinitionsupdatesample] | Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json | +| [jobRunsGetSample.js][jobrunsgetsample] | Gets a Job Run resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json | +| [jobRunsListSample.js][jobrunslistsample] | Lists all Job Runs in a Job Definition. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json | +| [operationsListSample.js][operationslistsample] | Lists all the supported operations for the Azure Storage Mover REST API. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json | +| [projectsCreateOrUpdateSample.js][projectscreateorupdatesample] | Creates or updates a Project resource, which is a logical grouping of related jobs. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json | +| [projectsDeleteSample.js][projectsdeletesample] | Deletes a Project resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json | +| [projectsGetSample.js][projectsgetsample] | Gets a Project resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json | +| [projectsListSample.js][projectslistsample] | Lists all Projects in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json | +| [projectsUpdateSample.js][projectsupdatesample] | Updates properties for a Project resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json | +| [storageMoversCreateOrUpdateSample.js][storagemoverscreateorupdatesample] | Creates or updates a top-level Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json | +| [storageMoversDeleteSample.js][storagemoversdeletesample] | Deletes a Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json | +| [storageMoversGetSample.js][storagemoversgetsample] | Gets a Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json | +| [storageMoversListBySubscriptionSample.js][storagemoverslistbysubscriptionsample] | Lists all Storage Movers in a subscription. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json | +| [storageMoversListSample.js][storagemoverslistsample] | Lists all Storage Movers in a resource group. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json | +| [storageMoversUpdateSample.js][storagemoversupdatesample] | Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.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 agentsCreateOrUpdateSample.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 cross-env STORAGEMOVER_SUBSCRIPTION_ID="" STORAGEMOVER_RESOURCE_GROUP="" node agentsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[agentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsCreateOrUpdateSample.js +[agentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsDeleteSample.js +[agentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsGetSample.js +[agentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsListSample.js +[agentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsUpdateSample.js +[endpointscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsCreateOrUpdateSample.js +[endpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsDeleteSample.js +[endpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsGetSample.js +[endpointslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsListSample.js +[endpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsUpdateSample.js +[jobdefinitionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsCreateOrUpdateSample.js +[jobdefinitionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsDeleteSample.js +[jobdefinitionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsGetSample.js +[jobdefinitionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsListSample.js +[jobdefinitionsstartjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStartJobSample.js +[jobdefinitionsstopjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStopJobSample.js +[jobdefinitionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsUpdateSample.js +[jobrunsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsGetSample.js +[jobrunslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/operationsListSample.js +[projectscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsCreateOrUpdateSample.js +[projectsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsDeleteSample.js +[projectsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsGetSample.js +[projectslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsListSample.js +[projectsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsUpdateSample.js +[storagemoverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversCreateOrUpdateSample.js +[storagemoversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversDeleteSample.js +[storagemoversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversGetSample.js +[storagemoverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListBySubscriptionSample.js +[storagemoverslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListSample.js +[storagemoversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagemover?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover/README.md diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsCreateOrUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsCreateOrUpdateSample.js new file mode 100644 index 000000000000..233a2c6d2483 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsCreateOrUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * + * @summary Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json + */ +async function agentsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent = { + description: "Example Agent Description", + arcResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.HybridCompute/machines/examples-hybridComputeName", + arcVmUuid: "3bb2c024-eba9-4d18-9e7a-1d772fcc5fe9", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.createOrUpdate( + resourceGroupName, + storageMoverName, + agentName, + agent + ); + console.log(result); +} + +async function main() { + agentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsDeleteSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsDeleteSample.js new file mode 100644 index 000000000000..97c1c6e623b0 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes an Agent resource. + * + * @summary Deletes an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json + */ +async function agentsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + agentName + ); + console.log(result); +} + +async function main() { + agentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsGetSample.js new file mode 100644 index 000000000000..f7458799aceb --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsGetSample.js @@ -0,0 +1,37 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets an Agent resource. + * + * @summary Gets an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json + */ +async function agentsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.get(resourceGroupName, storageMoverName, agentName); + console.log(result); +} + +async function main() { + agentsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsListSample.js new file mode 100644 index 000000000000..1f96910213ae --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsListSample.js @@ -0,0 +1,39 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Agents in a Storage Mover. + * + * @summary Lists all Agents in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json + */ +async function agentsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agents.list(resourceGroupName, storageMoverName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + agentsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsUpdateSample.js new file mode 100644 index 000000000000..5cc2b9b1c0bf --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/agentsUpdateSample.js @@ -0,0 +1,40 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource. + * + * @summary Creates or updates an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json + */ +async function agentsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent = { + description: "Updated Agent Description", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.update(resourceGroupName, storageMoverName, agentName, agent); + console.log(result); +} + +async function main() { + agentsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsCreateOrUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsCreateOrUpdateSample.js new file mode 100644 index 000000000000..a684cdbcc819 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsCreateOrUpdateSample.js @@ -0,0 +1,51 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * + * @summary Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json + */ +async function endpointsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint = { + properties: { + description: "Example Storage Container Endpoint Description", + blobContainerName: "examples-blobContainerName", + endpointType: "AzureStorageBlobContainer", + storageAccountResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.Storage/storageAccounts/examples-storageAccountName/", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.createOrUpdate( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsDeleteSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsDeleteSample.js new file mode 100644 index 000000000000..1cd5cd57d4d7 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes an Endpoint resource. + * + * @summary Deletes an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json + */ +async function endpointsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + endpointName + ); + console.log(result); +} + +async function main() { + endpointsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsGetSample.js new file mode 100644 index 000000000000..5f7bccbb4b8a --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsGetSample.js @@ -0,0 +1,37 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets an Endpoint resource. + * + * @summary Gets an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json + */ +async function endpointsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.get(resourceGroupName, storageMoverName, endpointName); + console.log(result); +} + +async function main() { + endpointsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsListSample.js new file mode 100644 index 000000000000..7412ae83b36d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsListSample.js @@ -0,0 +1,39 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Endpoints in a Storage Mover. + * + * @summary Lists all Endpoints in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json + */ +async function endpointsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.endpoints.list(resourceGroupName, storageMoverName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + endpointsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsUpdateSample.js new file mode 100644 index 000000000000..bb761d90345d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/endpointsUpdateSample.js @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json + */ +async function endpointsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint = { + properties: { description: "Updated Endpoint Description" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.update( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsCreateOrUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsCreateOrUpdateSample.js new file mode 100644 index 000000000000..473b95fb15ae --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsCreateOrUpdateSample.js @@ -0,0 +1,53 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * + * @summary Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json + */ +async function jobDefinitionsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition = { + description: "Example Job Definition Description", + agentName: "migration-agent", + copyMode: "Additive", + sourceName: "examples-sourceEndpointName", + sourceSubpath: "/", + targetName: "examples-targetEndpointName", + targetSubpath: "/", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsDeleteSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsDeleteSample.js new file mode 100644 index 000000000000..937850e2d59c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsDeleteSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Job Definition resource. + * + * @summary Deletes a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsGetSample.js new file mode 100644 index 000000000000..7a426e1a33ac --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsGetSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Job Definition resource. + * + * @summary Gets a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json + */ +async function jobDefinitionsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsListSample.js new file mode 100644 index 000000000000..9f7b140f7991 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsListSample.js @@ -0,0 +1,44 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Job Definitions in a Project. + * + * @summary Lists all Job Definitions in a Project. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json + */ +async function jobDefinitionsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobDefinitions.list( + resourceGroupName, + storageMoverName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobDefinitionsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStartJobSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStartJobSample.js new file mode 100644 index 000000000000..f24812ad1e09 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStartJobSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * + * @summary Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json + */ +async function jobDefinitionsStartJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.startJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStartJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStopJobSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStopJobSample.js new file mode 100644 index 000000000000..4ffcdf614265 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsStopJobSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Requests the Agent of any active instance of this Job Definition to stop. + * + * @summary Requests the Agent of any active instance of this Job Definition to stop. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json + */ +async function jobDefinitionsStopJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.stopJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStopJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsUpdateSample.js new file mode 100644 index 000000000000..8b8136514c13 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobDefinitionsUpdateSample.js @@ -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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json + */ +async function jobDefinitionsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition = { + description: "Updated Job Definition Description", + agentName: "updatedAgentName", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.update( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsGetSample.js new file mode 100644 index 000000000000..2f384e28fb1c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsGetSample.js @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Job Run resource. + * + * @summary Gets a Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json + */ +async function jobRunsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobRunName = "examples-jobRunName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobRuns.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName + ); + console.log(result); +} + +async function main() { + jobRunsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsListSample.js new file mode 100644 index 000000000000..c8af03238458 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/jobRunsListSample.js @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Job Runs in a Job Definition. + * + * @summary Lists all Job Runs in a Job Definition. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json + */ +async function jobRunsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobRuns.list( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobRunsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/operationsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..c184e6b9e0b0 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all the supported operations for the Azure Storage Mover REST API. + * + * @summary Lists all the supported operations for the Azure Storage Mover REST API. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(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/storagemover/arm-storagemover/samples/v1-beta/javascript/package.json b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..a1dfd139f214 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-storagemover-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagemover/arm-storagemover" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover", + "dependencies": { + "@azure/arm-storagemover": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsCreateOrUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsCreateOrUpdateSample.js new file mode 100644 index 000000000000..485c6ec4aaae --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsCreateOrUpdateSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a Project resource, which is a logical grouping of related jobs. + * + * @summary Creates or updates a Project resource, which is a logical grouping of related jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project = { description: "Example Project Description" }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsDeleteSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsDeleteSample.js new file mode 100644 index 000000000000..93352da9d738 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsDeleteSample.js @@ -0,0 +1,41 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Project resource. + * + * @summary Deletes a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsGetSample.js new file mode 100644 index 000000000000..2b2d4c78f3d9 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsGetSample.js @@ -0,0 +1,37 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Project resource. + * + * @summary Gets a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.get(resourceGroupName, storageMoverName, projectName); + console.log(result); +} + +async function main() { + projectsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsListSample.js new file mode 100644 index 000000000000..d80b68e8216a --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsListSample.js @@ -0,0 +1,39 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Projects in a Storage Mover. + * + * @summary Lists all Projects in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list(resourceGroupName, storageMoverName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + projectsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsUpdateSample.js new file mode 100644 index 000000000000..09731a4e05bf --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/projectsUpdateSample.js @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project = { + description: "Example Project Description", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.update( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/sample.env b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# 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/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversCreateOrUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversCreateOrUpdateSample.js new file mode 100644 index 000000000000..0d6a508480ec --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversCreateOrUpdateSample.js @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates or updates a top-level Storage Mover resource. + * + * @summary Creates or updates a top-level Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json + */ +async function storageMoversCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover = { + description: "Example Storage Mover Description", + location: "eastus2", + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.createOrUpdate( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversDeleteSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversDeleteSample.js new file mode 100644 index 000000000000..a16efdd42a8f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversDeleteSample.js @@ -0,0 +1,36 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Storage Mover resource. + * + * @summary Deletes a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json + */ +async function storageMoversDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.beginDeleteAndWait(resourceGroupName, storageMoverName); + console.log(result); +} + +async function main() { + storageMoversDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversGetSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversGetSample.js new file mode 100644 index 000000000000..62f4c0c439e2 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversGetSample.js @@ -0,0 +1,36 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Storage Mover resource. + * + * @summary Gets a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json + */ +async function storageMoversGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.get(resourceGroupName, storageMoverName); + console.log(result); +} + +async function main() { + storageMoversGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListBySubscriptionSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListBySubscriptionSample.js new file mode 100644 index 000000000000..8971656bfb9c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListBySubscriptionSample.js @@ -0,0 +1,37 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a subscription. + * + * @summary Lists all Storage Movers in a subscription. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListSample.js new file mode 100644 index 000000000000..3424f4ad5b2c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversListSample.js @@ -0,0 +1,38 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a resource group. + * + * @summary Lists all Storage Movers in a resource group. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.list(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversUpdateSample.js b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversUpdateSample.js new file mode 100644 index 000000000000..6b752b44d1eb --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/javascript/storageMoversUpdateSample.js @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } = require("@azure/arm-storagemover"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.json + */ +async function storageMoversUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover = { + description: "Updated Storage Mover Description", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.update( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/README.md b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..2d593934ca51 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/README.md @@ -0,0 +1,123 @@ +# 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** | +| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [agentsCreateOrUpdateSample.ts][agentscreateorupdatesample] | Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json | +| [agentsDeleteSample.ts][agentsdeletesample] | Deletes an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json | +| [agentsGetSample.ts][agentsgetsample] | Gets an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json | +| [agentsListSample.ts][agentslistsample] | Lists all Agents in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json | +| [agentsUpdateSample.ts][agentsupdatesample] | Creates or updates an Agent resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json | +| [endpointsCreateOrUpdateSample.ts][endpointscreateorupdatesample] | Creates or updates an Endpoint resource, which represents a data transfer source or destination. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json | +| [endpointsDeleteSample.ts][endpointsdeletesample] | Deletes an Endpoint resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json | +| [endpointsGetSample.ts][endpointsgetsample] | Gets an Endpoint resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json | +| [endpointsListSample.ts][endpointslistsample] | Lists all Endpoints in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json | +| [endpointsUpdateSample.ts][endpointsupdatesample] | Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json | +| [jobDefinitionsCreateOrUpdateSample.ts][jobdefinitionscreateorupdatesample] | Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json | +| [jobDefinitionsDeleteSample.ts][jobdefinitionsdeletesample] | Deletes a Job Definition resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json | +| [jobDefinitionsGetSample.ts][jobdefinitionsgetsample] | Gets a Job Definition resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json | +| [jobDefinitionsListSample.ts][jobdefinitionslistsample] | Lists all Job Definitions in a Project. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json | +| [jobDefinitionsStartJobSample.ts][jobdefinitionsstartjobsample] | Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json | +| [jobDefinitionsStopJobSample.ts][jobdefinitionsstopjobsample] | Requests the Agent of any active instance of this Job Definition to stop. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json | +| [jobDefinitionsUpdateSample.ts][jobdefinitionsupdatesample] | Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json | +| [jobRunsGetSample.ts][jobrunsgetsample] | Gets a Job Run resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json | +| [jobRunsListSample.ts][jobrunslistsample] | Lists all Job Runs in a Job Definition. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json | +| [operationsListSample.ts][operationslistsample] | Lists all the supported operations for the Azure Storage Mover REST API. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json | +| [projectsCreateOrUpdateSample.ts][projectscreateorupdatesample] | Creates or updates a Project resource, which is a logical grouping of related jobs. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json | +| [projectsDeleteSample.ts][projectsdeletesample] | Deletes a Project resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json | +| [projectsGetSample.ts][projectsgetsample] | Gets a Project resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json | +| [projectsListSample.ts][projectslistsample] | Lists all Projects in a Storage Mover. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json | +| [projectsUpdateSample.ts][projectsupdatesample] | Updates properties for a Project resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json | +| [storageMoversCreateOrUpdateSample.ts][storagemoverscreateorupdatesample] | Creates or updates a top-level Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json | +| [storageMoversDeleteSample.ts][storagemoversdeletesample] | Deletes a Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json | +| [storageMoversGetSample.ts][storagemoversgetsample] | Gets a Storage Mover resource. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json | +| [storageMoversListBySubscriptionSample.ts][storagemoverslistbysubscriptionsample] | Lists all Storage Movers in a subscription. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json | +| [storageMoversListSample.ts][storagemoverslistsample] | Lists all Storage Movers in a resource group. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json | +| [storageMoversUpdateSample.ts][storagemoversupdatesample] | Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.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/agentsCreateOrUpdateSample.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 cross-env STORAGEMOVER_SUBSCRIPTION_ID="" STORAGEMOVER_RESOURCE_GROUP="" node dist/agentsCreateOrUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[agentscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsCreateOrUpdateSample.ts +[agentsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsDeleteSample.ts +[agentsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsGetSample.ts +[agentslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsListSample.ts +[agentsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsUpdateSample.ts +[endpointscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsCreateOrUpdateSample.ts +[endpointsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsDeleteSample.ts +[endpointsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsGetSample.ts +[endpointslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsListSample.ts +[endpointsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsUpdateSample.ts +[jobdefinitionscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsCreateOrUpdateSample.ts +[jobdefinitionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsDeleteSample.ts +[jobdefinitionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsGetSample.ts +[jobdefinitionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsListSample.ts +[jobdefinitionsstartjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStartJobSample.ts +[jobdefinitionsstopjobsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStopJobSample.ts +[jobdefinitionsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsUpdateSample.ts +[jobrunsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsGetSample.ts +[jobrunslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/operationsListSample.ts +[projectscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsCreateOrUpdateSample.ts +[projectsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsDeleteSample.ts +[projectsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsGetSample.ts +[projectslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsListSample.ts +[projectsupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsUpdateSample.ts +[storagemoverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversCreateOrUpdateSample.ts +[storagemoversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversDeleteSample.ts +[storagemoversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversGetSample.ts +[storagemoverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListBySubscriptionSample.ts +[storagemoverslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListSample.ts +[storagemoversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagemover?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/package.json b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..46e77e155480 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-storagemover-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagemover/arm-storagemover" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagemover/arm-storagemover", + "dependencies": { + "@azure/arm-storagemover": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~4.8.0", + "rimraf": "latest" + } +} diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/sample.env b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# 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/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..3890cc96e09b --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { Agent, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * + * @summary Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_CreateOrUpdate.json + */ +async function agentsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent: Agent = { + description: "Example Agent Description", + arcResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.HybridCompute/machines/examples-hybridComputeName", + arcVmUuid: "3bb2c024-eba9-4d18-9e7a-1d772fcc5fe9" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.createOrUpdate( + resourceGroupName, + storageMoverName, + agentName, + agent + ); + console.log(result); +} + +async function main() { + agentsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsDeleteSample.ts new file mode 100644 index 000000000000..0cfe0d45e981 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes an Agent resource. + * + * @summary Deletes an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Delete.json + */ +async function agentsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + agentName + ); + console.log(result); +} + +async function main() { + agentsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsGetSample.ts new file mode 100644 index 000000000000..7ae478642074 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an Agent resource. + * + * @summary Gets an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Get.json + */ +async function agentsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.get( + resourceGroupName, + storageMoverName, + agentName + ); + console.log(result); +} + +async function main() { + agentsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsListSample.ts new file mode 100644 index 000000000000..99ab25fd02ed --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Agents in a Storage Mover. + * + * @summary Lists all Agents in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_List.json + */ +async function agentsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.agents.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + agentsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsUpdateSample.ts new file mode 100644 index 000000000000..8b8160b1343f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/agentsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + AgentUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Agent resource. + * + * @summary Creates or updates an Agent resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Agents_Update.json + */ +async function agentsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const agentName = "examples-agentName"; + const agent: AgentUpdateParameters = { + description: "Updated Agent Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.agents.update( + resourceGroupName, + storageMoverName, + agentName, + agent + ); + console.log(result); +} + +async function main() { + agentsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..9d0970a9466f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsCreateOrUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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 { Endpoint, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * + * @summary Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_CreateOrUpdate.json + */ +async function endpointsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint: Endpoint = { + properties: { + description: "Example Storage Container Endpoint Description", + blobContainerName: "examples-blobContainerName", + endpointType: "AzureStorageBlobContainer", + storageAccountResourceId: + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/examples-rg/providers/Microsoft.Storage/storageAccounts/examples-storageAccountName/" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.createOrUpdate( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsDeleteSample.ts new file mode 100644 index 000000000000..b32fbb45a22d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes an Endpoint resource. + * + * @summary Deletes an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Delete.json + */ +async function endpointsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + endpointName + ); + console.log(result); +} + +async function main() { + endpointsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsGetSample.ts new file mode 100644 index 000000000000..3b77d4198401 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets an Endpoint resource. + * + * @summary Gets an Endpoint resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Get.json + */ +async function endpointsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.get( + resourceGroupName, + storageMoverName, + endpointName + ); + console.log(result); +} + +async function main() { + endpointsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsListSample.ts new file mode 100644 index 000000000000..1bb10c95c706 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Endpoints in a Storage Mover. + * + * @summary Lists all Endpoints in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_List.json + */ +async function endpointsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.endpoints.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + endpointsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsUpdateSample.ts new file mode 100644 index 000000000000..88b2d6deb623 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/endpointsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + EndpointBaseUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for an Endpoint resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Endpoints_Update.json + */ +async function endpointsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const endpointName = "examples-endpointName"; + const endpoint: EndpointBaseUpdateParameters = { + properties: { description: "Updated Endpoint Description" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.endpoints.update( + resourceGroupName, + storageMoverName, + endpointName, + endpoint + ); + console.log(result); +} + +async function main() { + endpointsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..1062f478cbbf --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsCreateOrUpdateSample.ts @@ -0,0 +1,57 @@ +/* + * 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 { JobDefinition, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * + * @summary Creates or updates a Job Definition resource, which contains configuration for a single unit of managed data transfer. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_CreateOrUpdate.json + */ +async function jobDefinitionsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition: JobDefinition = { + description: "Example Job Definition Description", + agentName: "migration-agent", + copyMode: "Additive", + sourceName: "examples-sourceEndpointName", + sourceSubpath: "/", + targetName: "examples-targetEndpointName", + targetSubpath: "/" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsDeleteSample.ts new file mode 100644 index 000000000000..7c2be1b9a0c6 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsDeleteSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Job Definition resource. + * + * @summary Deletes a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsGetSample.ts new file mode 100644 index 000000000000..e30902b418e3 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsGetSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Job Definition resource. + * + * @summary Gets a Job Definition resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Get.json + */ +async function jobDefinitionsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsListSample.ts new file mode 100644 index 000000000000..39935179c028 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsListSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Job Definitions in a Project. + * + * @summary Lists all Job Definitions in a Project. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_List.json + */ +async function jobDefinitionsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobDefinitions.list( + resourceGroupName, + storageMoverName, + projectName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobDefinitionsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStartJobSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStartJobSample.ts new file mode 100644 index 000000000000..81a26b769985 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStartJobSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * + * @summary Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StartJob.json + */ +async function jobDefinitionsStartJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.startJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStartJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStopJobSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStopJobSample.ts new file mode 100644 index 000000000000..2750806bab5e --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsStopJobSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Requests the Agent of any active instance of this Job Definition to stop. + * + * @summary Requests the Agent of any active instance of this Job Definition to stop. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_StopJob.json + */ +async function jobDefinitionsStopJob() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.stopJob( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + ); + console.log(result); +} + +async function main() { + jobDefinitionsStopJob(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsUpdateSample.ts new file mode 100644 index 000000000000..9d7abd304417 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobDefinitionsUpdateSample.ts @@ -0,0 +1,55 @@ +/* + * 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 { + JobDefinitionUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Job Definition resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobDefinitions_Update.json + */ +async function jobDefinitionsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobDefinition: JobDefinitionUpdateParameters = { + description: "Updated Job Definition Description", + agentName: "updatedAgentName" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobDefinitions.update( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition + ); + console.log(result); +} + +async function main() { + jobDefinitionsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsGetSample.ts new file mode 100644 index 000000000000..7e9d158789c8 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsGetSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Job Run resource. + * + * @summary Gets a Job Run resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_Get.json + */ +async function jobRunsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const jobRunName = "examples-jobRunName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.jobRuns.get( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName + ); + console.log(result); +} + +async function main() { + jobRunsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsListSample.ts new file mode 100644 index 000000000000..18be51f8a0fc --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/jobRunsListSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Job Runs in a Job Definition. + * + * @summary Lists all Job Runs in a Job Definition. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/JobRuns_List.json + */ +async function jobRunsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const jobDefinitionName = "examples-jobDefinitionName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.jobRuns.list( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + jobRunsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..6a5d2653b0e3 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all the supported operations for the Azure Storage Mover REST API. + * + * @summary Lists all the supported operations for the Azure Storage Mover REST API. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Operations_List.json + */ +async function operationsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(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/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ebdf21fdb2b1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsCreateOrUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * 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 { Project, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a Project resource, which is a logical grouping of related jobs. + * + * @summary Creates or updates a Project resource, which is a logical grouping of related jobs. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_CreateOrUpdate.json + */ +async function projectsCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project: Project = { description: "Example Project Description" }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.createOrUpdate( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsDeleteSample.ts new file mode 100644 index 000000000000..4092a696e51c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsDeleteSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Project resource. + * + * @summary Deletes a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Delete.json + */ +async function projectsDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.beginDeleteAndWait( + resourceGroupName, + storageMoverName, + projectName + ); + console.log(result); +} + +async function main() { + projectsDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsGetSample.ts new file mode 100644 index 000000000000..3e93db18ecc4 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsGetSample.ts @@ -0,0 +1,45 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Project resource. + * + * @summary Gets a Project resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Get.json + */ +async function projectsGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.get( + resourceGroupName, + storageMoverName, + projectName + ); + console.log(result); +} + +async function main() { + projectsGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsListSample.ts new file mode 100644 index 000000000000..dca170172455 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsListSample.ts @@ -0,0 +1,46 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Projects in a Storage Mover. + * + * @summary Lists all Projects in a Storage Mover. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_List.json + */ +async function projectsList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.projects.list( + resourceGroupName, + storageMoverName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + projectsList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsUpdateSample.ts new file mode 100644 index 000000000000..40093d6ee18a --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/projectsUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * 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 { + ProjectUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Project resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/Projects_Update.json + */ +async function projectsUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const projectName = "examples-projectName"; + const project: ProjectUpdateParameters = { + description: "Example Project Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.projects.update( + resourceGroupName, + storageMoverName, + projectName, + project + ); + console.log(result); +} + +async function main() { + projectsUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversCreateOrUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversCreateOrUpdateSample.ts new file mode 100644 index 000000000000..15de9a1f19ab --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversCreateOrUpdateSample.ts @@ -0,0 +1,49 @@ +/* + * 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 { StorageMover, StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates or updates a top-level Storage Mover resource. + * + * @summary Creates or updates a top-level Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_CreateOrUpdate.json + */ +async function storageMoversCreateOrUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover: StorageMover = { + description: "Example Storage Mover Description", + location: "eastus2", + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.createOrUpdate( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversDeleteSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversDeleteSample.ts new file mode 100644 index 000000000000..2831a2dd8124 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Storage Mover resource. + * + * @summary Deletes a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Delete.json + */ +async function storageMoversDelete() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.beginDeleteAndWait( + resourceGroupName, + storageMoverName + ); + console.log(result); +} + +async function main() { + storageMoversDelete(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversGetSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversGetSample.ts new file mode 100644 index 000000000000..68c0e2476f6c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversGetSample.ts @@ -0,0 +1,43 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Storage Mover resource. + * + * @summary Gets a Storage Mover resource. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Get.json + */ +async function storageMoversGet() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.get( + resourceGroupName, + storageMoverName + ); + console.log(result); +} + +async function main() { + storageMoversGet(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListBySubscriptionSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListBySubscriptionSample.ts new file mode 100644 index 000000000000..c7611ad5d7a1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListBySubscriptionSample.ts @@ -0,0 +1,40 @@ +/* + * 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 { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a subscription. + * + * @summary Lists all Storage Movers in a subscription. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_ListBySubscription.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListSample.ts new file mode 100644 index 000000000000..d60380158ee9 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversListSample.ts @@ -0,0 +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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { StorageMoverClient } from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Storage Movers in a resource group. + * + * @summary Lists all Storage Movers in a resource group. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_List.json + */ +async function storageMoversList() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageMovers.list(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageMoversList(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversUpdateSample.ts b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversUpdateSample.ts new file mode 100644 index 000000000000..ba057caa7267 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/src/storageMoversUpdateSample.ts @@ -0,0 +1,50 @@ +/* + * 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 { + StorageMoverUpdateParameters, + StorageMoverClient +} from "@azure/arm-storagemover"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * + * @summary Updates properties for a Storage Mover resource. Properties not specified in the request body will be unchanged. + * x-ms-original-file: specification/storagemover/resource-manager/Microsoft.StorageMover/preview/2022-07-01-preview/examples/StorageMovers_Update.json + */ +async function storageMoversUpdate() { + const subscriptionId = + process.env["STORAGEMOVER_SUBSCRIPTION_ID"] || + "11111111-2222-3333-4444-555555555555"; + const resourceGroupName = + process.env["STORAGEMOVER_RESOURCE_GROUP"] || "examples-rg"; + const storageMoverName = "examples-storageMoverName"; + const storageMover: StorageMoverUpdateParameters = { + description: "Updated Storage Mover Description" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageMoverClient(credential, subscriptionId); + const result = await client.storageMovers.update( + resourceGroupName, + storageMoverName, + storageMover + ); + console.log(result); +} + +async function main() { + storageMoversUpdate(); +} + +main().catch(console.error); diff --git a/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/tsconfig.json b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/storagemover/arm-storagemover/src/index.ts b/sdk/storagemover/arm-storagemover/src/index.ts new file mode 100644 index 000000000000..fc8fa2677ed3 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/index.ts @@ -0,0 +1,13 @@ +/* + * 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 { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { StorageMoverClient } from "./storageMoverClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/storagemover/arm-storagemover/src/lroImpl.ts b/sdk/storagemover/arm-storagemover/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/storagemover/arm-storagemover/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/storagemover/arm-storagemover/src/models/index.ts b/sdk/storagemover/arm-storagemover/src/models/index.ts new file mode 100644 index 000000000000..f45e1fbc3122 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/models/index.ts @@ -0,0 +1,1164 @@ +/* + * 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 type EndpointBasePropertiesUnion = + | EndpointBaseProperties + | AzureStorageBlobContainerEndpointProperties + | NfsMountEndpointProperties; + +/** 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 Storage Movers. */ +export interface StorageMoverList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: StorageMover[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** 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; +} + +/** 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; +} + +/** The Storage Mover resource. */ +export interface StorageMoverUpdateParameters { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** A description for the Storage Mover. */ + description?: string; +} + +/** List of Agents. */ +export interface AgentList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: Agent[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +export interface AgentPropertiesErrorDetails { + /** Error code reported by Agent */ + code?: string; + /** Expanded description of reported error code */ + message?: string; +} + +/** The Agent resource. */ +export interface AgentUpdateParameters { + /** A description for the Agent. */ + description?: string; +} + +/** List of Endpoints. */ +export interface EndpointList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: Endpoint[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The resource specific properties for the Storage Mover resource. */ +export interface EndpointBaseProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "AzureStorageBlobContainer" | "NfsMount"; + /** A description for the Endpoint. */ + description?: string; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The Endpoint resource. */ +export interface EndpointBaseUpdateParameters { + /** The Endpoint resource, which contains information about file sources and targets. */ + properties?: EndpointBaseUpdateProperties; +} + +/** The Endpoint resource, which contains information about file sources and targets. */ +export interface EndpointBaseUpdateProperties { + /** A description for the Endpoint. */ + description?: string; +} + +/** List of Project resources. */ +export interface ProjectList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: Project[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The Project resource. */ +export interface ProjectUpdateParameters { + /** A description for the Project. */ + description?: string; +} + +/** List of Job Definitions. */ +export interface JobDefinitionList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: JobDefinition[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The Job Definition resource. */ +export interface JobDefinitionUpdateParameters { + /** A description for the Job Definition. */ + description?: string; + /** Strategy to use for copy. */ + copyMode?: CopyMode; + /** Name of the Agent to assign for new Job Runs of this Job Definition. */ + agentName?: string; +} + +/** Response that identifies a Job Run. */ +export interface JobRunResourceId { + /** + * Fully qualified resource id of the Job Run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly jobRunResourceId?: string; +} + +/** List of Job Runs. */ +export interface JobRunList { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: JobRun[]; + /** + * Request URL that can be used to query next page of containers. Returned when total number of requested containers exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Error type */ +export interface JobRunError { + /** Error code of the given entry. */ + code?: string; + /** Error message of the given entry. */ + message?: string; + /** Target of the given error entry. */ + target?: 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?: { [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 {} + +export interface AzureStorageBlobContainerEndpointProperties + extends EndpointBaseProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "AzureStorageBlobContainer"; + /** The Azure Resource ID of the storage account that is the target destination. */ + storageAccountResourceId: string; + /** The name of the Storage blob container that is the target destination. */ + blobContainerName: string; +} + +export interface NfsMountEndpointProperties extends EndpointBaseProperties { + /** Polymorphic discriminator, which specifies the different types this object can be */ + endpointType: "NfsMount"; + /** The host name or IP address of the server exporting the file system. */ + host: string; + /** The NFS protocol version. */ + nfsVersion?: NfsVersion; + /** The directory being exported from the server. */ + export: string; +} + +export interface AzureStorageBlobContainerEndpointUpdateProperties + extends EndpointBaseUpdateProperties {} + +export interface NfsMountEndpointUpdateProperties + extends EndpointBaseUpdateProperties {} + +/** The Storage Mover resource, which is a container for a group of Agents, Projects, and Endpoints. */ +export interface StorageMover extends TrackedResource { + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** A description for the Storage Mover. */ + description?: string; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The Agent resource. */ +export interface Agent extends ProxyResource { + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** A description for the Agent. */ + description?: string; + /** + * The Agent version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentVersion?: string; + /** The fully qualified resource ID of the Hybrid Compute resource for the Agent. */ + arcResourceId: string; + /** The VM UUID of the Hybrid Compute resource for the Agent. */ + arcVmUuid: string; + /** + * The Agent status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentStatus?: AgentStatus; + /** + * The last updated time of the Agent status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastStatusUpdate?: Date; + /** + * Local IP address reported by the Agent. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly localIPAddress?: string; + /** + * Available memory reported by the Agent, in MB. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly memoryInMB?: number; + /** + * Available compute cores reported by the Agent. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly numberOfCores?: number; + /** + * Uptime of the Agent in seconds. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uptimeInSeconds?: number; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly errorDetails?: AgentPropertiesErrorDetails; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The Endpoint resource, which contains information about file sources and targets. */ +export interface Endpoint extends ProxyResource { + /** The resource specific properties for the Storage Mover resource. */ + properties: EndpointBasePropertiesUnion; + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** The Project resource. */ +export interface Project extends ProxyResource { + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** A description for the Project. */ + description?: string; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The Job Definition resource. */ +export interface JobDefinition extends ProxyResource { + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** A description for the Job Definition. */ + description?: string; + /** Strategy to use for copy. */ + copyMode: CopyMode; + /** The name of the source Endpoint. */ + sourceName: string; + /** + * Fully qualified resource ID of the source Endpoint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceResourceId?: string; + /** The subpath to use when reading from the source Endpoint. */ + sourceSubpath?: string; + /** The name of the target Endpoint. */ + targetName: string; + /** + * Fully qualified resource ID of the target Endpoint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetResourceId?: string; + /** The subpath to use when writing to the target Endpoint. */ + targetSubpath?: string; + /** + * The name of the Job Run in a non-terminal state, if exists. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestJobRunName?: string; + /** + * The fully qualified resource ID of the Job Run in a non-terminal state, if exists. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestJobRunResourceId?: string; + /** + * The current status of the Job Run in a non-terminal state, if exists. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestJobRunStatus?: JobRunStatus; + /** Name of the Agent to assign for new Job Runs of this Job Definition. */ + agentName?: string; + /** + * Fully qualified resource id of the Agent to assign for new Job Runs of this Job Definition. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentResourceId?: string; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The Job Run resource. */ +export interface JobRun extends ProxyResource { + /** + * Resource system metadata. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * The state of the job execution. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: JobRunStatus; + /** + * The status of Agent's scanning of source. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly scanStatus?: JobRunScanStatus; + /** + * Name of the Agent assigned to this run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentName?: string; + /** + * Fully qualified resource id of the Agent assigned to this run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentResourceId?: string; + /** + * Start time of the run. Null if no Agent reported that the job has started. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly executionStartTime?: Date; + /** + * End time of the run. Null if Agent has not reported that the job has ended. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly executionEndTime?: Date; + /** + * The last updated time of the Job Run. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastStatusUpdate?: Date; + /** + * Number of items scanned so far in source. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsScanned?: number; + /** + * Number of items that will not be transferred, as they are excluded by user configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsExcluded?: number; + /** + * Number of items that will not be transferred, as they are unsupported on target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsUnsupported?: number; + /** + * Number of items that will not be transferred, as they are already found on target (e.g. mirror mode). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsNoTransferNeeded?: number; + /** + * Number of items that were attempted to transfer and failed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsFailed?: number; + /** + * Number of items successfully transferred to target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly itemsTransferred?: number; + /** + * Bytes of data scanned so far in source. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesScanned?: number; + /** + * Bytes of data that will not be transferred, as they are excluded by user configuration. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesExcluded?: number; + /** + * Bytes of data that will not be transferred, as they are unsupported on target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesUnsupported?: number; + /** + * Bytes of data that will not be transferred, as they are already found on target (e.g. mirror mode). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesNoTransferNeeded?: number; + /** + * Bytes of data that were attempted to transfer and failed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesFailed?: number; + /** + * Bytes of data successfully transferred to target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly bytesTransferred?: number; + /** + * Name of source Endpoint resource. This resource may no longer exist. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceName?: string; + /** + * Fully qualified resource id of source Endpoint. This id may no longer exist. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceResourceId?: string; + /** + * Copy of source Endpoint resource's properties at time of Job Run creation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceProperties?: Record; + /** + * Name of target Endpoint resource. This resource may no longer exist. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetName?: string; + /** + * Fully qualified resource id of of Endpoint. This id may no longer exist. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetResourceId?: string; + /** + * Copy of Endpoint resource's properties at time of Job Run creation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetProperties?: Record; + /** + * Copy of parent Job Definition's properties at time of Job Run creation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly jobDefinitionProperties?: Record; + /** + * Error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly error?: JobRunError; + /** + * The provisioning state of this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** 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 ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded" +} + +/** + * 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** + */ +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 AgentStatus} that the service accepts. */ +export enum KnownAgentStatus { + /** Registering */ + Registering = "Registering", + /** Offline */ + Offline = "Offline", + /** Online */ + Online = "Online", + /** Executing */ + Executing = "Executing", + /** RequiresAttention */ + RequiresAttention = "RequiresAttention", + /** Unregistering */ + Unregistering = "Unregistering" +} + +/** + * Defines values for AgentStatus. \ + * {@link KnownAgentStatus} can be used interchangeably with AgentStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Registering** \ + * **Offline** \ + * **Online** \ + * **Executing** \ + * **RequiresAttention** \ + * **Unregistering** + */ +export type AgentStatus = string; + +/** Known values of {@link EndpointType} that the service accepts. */ +export enum KnownEndpointType { + /** AzureStorageBlobContainer */ + AzureStorageBlobContainer = "AzureStorageBlobContainer", + /** NfsMount */ + NfsMount = "NfsMount" +} + +/** + * Defines values for EndpointType. \ + * {@link KnownEndpointType} can be used interchangeably with EndpointType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureStorageBlobContainer** \ + * **NfsMount** + */ +export type EndpointType = string; + +/** Known values of {@link CopyMode} that the service accepts. */ +export enum KnownCopyMode { + /** Additive */ + Additive = "Additive", + /** Mirror */ + Mirror = "Mirror" +} + +/** + * Defines values for CopyMode. \ + * {@link KnownCopyMode} can be used interchangeably with CopyMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Additive** \ + * **Mirror** + */ +export type CopyMode = string; + +/** Known values of {@link JobRunStatus} that the service accepts. */ +export enum KnownJobRunStatus { + /** Queued */ + Queued = "Queued", + /** Started */ + Started = "Started", + /** Running */ + Running = "Running", + /** CancelRequested */ + CancelRequested = "CancelRequested", + /** Canceling */ + Canceling = "Canceling", + /** Canceled */ + Canceled = "Canceled", + /** Failed */ + Failed = "Failed", + /** Succeeded */ + Succeeded = "Succeeded" +} + +/** + * Defines values for JobRunStatus. \ + * {@link KnownJobRunStatus} can be used interchangeably with JobRunStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Queued** \ + * **Started** \ + * **Running** \ + * **CancelRequested** \ + * **Canceling** \ + * **Canceled** \ + * **Failed** \ + * **Succeeded** + */ +export type JobRunStatus = string; + +/** Known values of {@link JobRunScanStatus} that the service accepts. */ +export enum KnownJobRunScanStatus { + /** NotStarted */ + NotStarted = "NotStarted", + /** Scanning */ + Scanning = "Scanning", + /** Completed */ + Completed = "Completed" +} + +/** + * Defines values for JobRunScanStatus. \ + * {@link KnownJobRunScanStatus} can be used interchangeably with JobRunScanStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotStarted** \ + * **Scanning** \ + * **Completed** + */ +export type JobRunScanStatus = string; + +/** Known values of {@link NfsVersion} that the service accepts. */ +export enum KnownNfsVersion { + /** NFSauto */ + NFSauto = "NFSauto", + /** NFSv3 */ + NFSv3 = "NFSv3", + /** NFSv4 */ + NFSv4 = "NFSv4" +} + +/** + * Defines values for NfsVersion. \ + * {@link KnownNfsVersion} can be used interchangeably with NfsVersion, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NFSauto** \ + * **NFSv3** \ + * **NFSv4** + */ +export type NfsVersion = 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 StorageMoversListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type StorageMoversListBySubscriptionResponse = StorageMoverList; + +/** Optional parameters. */ +export interface StorageMoversListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type StorageMoversListResponse = StorageMoverList; + +/** Optional parameters. */ +export interface StorageMoversGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type StorageMoversGetResponse = StorageMover; + +/** Optional parameters. */ +export interface StorageMoversCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type StorageMoversCreateOrUpdateResponse = StorageMover; + +/** Optional parameters. */ +export interface StorageMoversUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type StorageMoversUpdateResponse = StorageMover; + +/** Optional parameters. */ +export interface StorageMoversDeleteOptionalParams + 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 StorageMoversListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type StorageMoversListBySubscriptionNextResponse = StorageMoverList; + +/** Optional parameters. */ +export interface StorageMoversListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type StorageMoversListNextResponse = StorageMoverList; + +/** Optional parameters. */ +export interface AgentsListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AgentsListResponse = AgentList; + +/** Optional parameters. */ +export interface AgentsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AgentsGetResponse = Agent; + +/** Optional parameters. */ +export interface AgentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type AgentsCreateOrUpdateResponse = Agent; + +/** Optional parameters. */ +export interface AgentsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type AgentsUpdateResponse = Agent; + +/** Optional parameters. */ +export interface AgentsDeleteOptionalParams + 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 AgentsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AgentsListNextResponse = AgentList; + +/** Optional parameters. */ +export interface EndpointsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type EndpointsListResponse = EndpointList; + +/** Optional parameters. */ +export interface EndpointsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type EndpointsGetResponse = Endpoint; + +/** Optional parameters. */ +export interface EndpointsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type EndpointsCreateOrUpdateResponse = Endpoint; + +/** Optional parameters. */ +export interface EndpointsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type EndpointsUpdateResponse = Endpoint; + +/** Optional parameters. */ +export interface EndpointsDeleteOptionalParams + 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 EndpointsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type EndpointsListNextResponse = EndpointList; + +/** Optional parameters. */ +export interface ProjectsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ProjectsListResponse = ProjectList; + +/** Optional parameters. */ +export interface ProjectsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ProjectsGetResponse = Project; + +/** Optional parameters. */ +export interface ProjectsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ProjectsCreateOrUpdateResponse = Project; + +/** Optional parameters. */ +export interface ProjectsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ProjectsUpdateResponse = Project; + +/** Optional parameters. */ +export interface ProjectsDeleteOptionalParams + 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 ProjectsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ProjectsListNextResponse = ProjectList; + +/** Optional parameters. */ +export interface JobDefinitionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type JobDefinitionsListResponse = JobDefinitionList; + +/** Optional parameters. */ +export interface JobDefinitionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type JobDefinitionsGetResponse = JobDefinition; + +/** Optional parameters. */ +export interface JobDefinitionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type JobDefinitionsCreateOrUpdateResponse = JobDefinition; + +/** Optional parameters. */ +export interface JobDefinitionsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type JobDefinitionsUpdateResponse = JobDefinition; + +/** Optional parameters. */ +export interface JobDefinitionsDeleteOptionalParams + 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 JobDefinitionsStartJobOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the startJob operation. */ +export type JobDefinitionsStartJobResponse = JobRunResourceId; + +/** Optional parameters. */ +export interface JobDefinitionsStopJobOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the stopJob operation. */ +export type JobDefinitionsStopJobResponse = JobRunResourceId; + +/** Optional parameters. */ +export interface JobDefinitionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type JobDefinitionsListNextResponse = JobDefinitionList; + +/** Optional parameters. */ +export interface JobRunsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type JobRunsListResponse = JobRunList; + +/** Optional parameters. */ +export interface JobRunsGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type JobRunsGetResponse = JobRun; + +/** Optional parameters. */ +export interface JobRunsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type JobRunsListNextResponse = JobRunList; + +/** Optional parameters. */ +export interface StorageMoverClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/storagemover/arm-storagemover/src/models/mappers.ts b/sdk/storagemover/arm-storagemover/src/models/mappers.ts new file mode 100644 index 000000000000..e290f0446688 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/models/mappers.ts @@ -0,0 +1,1305 @@ +/* + * 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 StorageMoverList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageMoverList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageMover" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +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 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" + } + } + } + } +}; + +export const StorageMoverUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageMoverUpdateParameters", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + } + } + } +}; + +export const AgentList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AgentList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Agent" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AgentPropertiesErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AgentPropertiesErrorDetails", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const AgentUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AgentUpdateParameters", + modelProperties: { + description: { + serializedName: "properties.description", + type: { + name: "String" + } + } + } + } +}; + +export const EndpointList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EndpointList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Endpoint" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const EndpointBaseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EndpointBaseProperties", + uberParent: "EndpointBaseProperties", + polymorphicDiscriminator: { + serializedName: "endpointType", + clientName: "endpointType" + }, + modelProperties: { + endpointType: { + serializedName: "endpointType", + required: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const EndpointBaseUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EndpointBaseUpdateParameters", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "EndpointBaseUpdateProperties" + } + } + } + } +}; + +export const EndpointBaseUpdateProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EndpointBaseUpdateProperties", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const ProjectList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProjectList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Project" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProjectUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProjectUpdateParameters", + modelProperties: { + description: { + serializedName: "properties.description", + type: { + name: "String" + } + } + } + } +}; + +export const JobDefinitionList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobDefinitionList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "JobDefinition" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const JobDefinitionUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobDefinitionUpdateParameters", + modelProperties: { + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + copyMode: { + serializedName: "properties.copyMode", + type: { + name: "String" + } + }, + agentName: { + serializedName: "properties.agentName", + type: { + name: "String" + } + } + } + } +}; + +export const JobRunResourceId: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobRunResourceId", + modelProperties: { + jobRunResourceId: { + serializedName: "jobRunResourceId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const JobRunList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobRunList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "JobRun" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const JobRunError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobRunError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + 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 AzureStorageBlobContainerEndpointProperties: coreClient.CompositeMapper = { + serializedName: "AzureStorageBlobContainer", + type: { + name: "Composite", + className: "AzureStorageBlobContainerEndpointProperties", + uberParent: "EndpointBaseProperties", + polymorphicDiscriminator: + EndpointBaseProperties.type.polymorphicDiscriminator, + modelProperties: { + ...EndpointBaseProperties.type.modelProperties, + storageAccountResourceId: { + serializedName: "storageAccountResourceId", + required: true, + type: { + name: "String" + } + }, + blobContainerName: { + serializedName: "blobContainerName", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const NfsMountEndpointProperties: coreClient.CompositeMapper = { + serializedName: "NfsMount", + type: { + name: "Composite", + className: "NfsMountEndpointProperties", + uberParent: "EndpointBaseProperties", + polymorphicDiscriminator: + EndpointBaseProperties.type.polymorphicDiscriminator, + modelProperties: { + ...EndpointBaseProperties.type.modelProperties, + host: { + serializedName: "host", + required: true, + type: { + name: "String" + } + }, + nfsVersion: { + serializedName: "nfsVersion", + type: { + name: "String" + } + }, + export: { + serializedName: "export", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureStorageBlobContainerEndpointUpdateProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureStorageBlobContainerEndpointUpdateProperties", + modelProperties: { + ...EndpointBaseUpdateProperties.type.modelProperties + } + } +}; + +export const NfsMountEndpointUpdateProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NfsMountEndpointUpdateProperties", + modelProperties: { + ...EndpointBaseUpdateProperties.type.modelProperties + } + } +}; + +export const StorageMover: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageMover", + modelProperties: { + ...TrackedResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Agent: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Agent", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + agentVersion: { + serializedName: "properties.agentVersion", + readOnly: true, + type: { + name: "String" + } + }, + arcResourceId: { + serializedName: "properties.arcResourceId", + required: true, + type: { + name: "String" + } + }, + arcVmUuid: { + serializedName: "properties.arcVmUuid", + required: true, + type: { + name: "String" + } + }, + agentStatus: { + serializedName: "properties.agentStatus", + readOnly: true, + type: { + name: "String" + } + }, + lastStatusUpdate: { + serializedName: "properties.lastStatusUpdate", + readOnly: true, + type: { + name: "DateTime" + } + }, + localIPAddress: { + serializedName: "properties.localIPAddress", + readOnly: true, + type: { + name: "String" + } + }, + memoryInMB: { + serializedName: "properties.memoryInMB", + readOnly: true, + type: { + name: "Number" + } + }, + numberOfCores: { + serializedName: "properties.numberOfCores", + readOnly: true, + type: { + name: "Number" + } + }, + uptimeInSeconds: { + serializedName: "properties.uptimeInSeconds", + readOnly: true, + type: { + name: "Number" + } + }, + errorDetails: { + serializedName: "properties.errorDetails", + type: { + name: "Composite", + className: "AgentPropertiesErrorDetails" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Endpoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Endpoint", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "EndpointBaseProperties" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const Project: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Project", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const JobDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobDefinition", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + copyMode: { + serializedName: "properties.copyMode", + required: true, + type: { + name: "String" + } + }, + sourceName: { + serializedName: "properties.sourceName", + required: true, + type: { + name: "String" + } + }, + sourceResourceId: { + serializedName: "properties.sourceResourceId", + readOnly: true, + type: { + name: "String" + } + }, + sourceSubpath: { + serializedName: "properties.sourceSubpath", + type: { + name: "String" + } + }, + targetName: { + serializedName: "properties.targetName", + required: true, + type: { + name: "String" + } + }, + targetResourceId: { + serializedName: "properties.targetResourceId", + readOnly: true, + type: { + name: "String" + } + }, + targetSubpath: { + serializedName: "properties.targetSubpath", + type: { + name: "String" + } + }, + latestJobRunName: { + serializedName: "properties.latestJobRunName", + readOnly: true, + type: { + name: "String" + } + }, + latestJobRunResourceId: { + serializedName: "properties.latestJobRunResourceId", + readOnly: true, + type: { + name: "String" + } + }, + latestJobRunStatus: { + serializedName: "properties.latestJobRunStatus", + readOnly: true, + type: { + name: "String" + } + }, + agentName: { + serializedName: "properties.agentName", + type: { + name: "String" + } + }, + agentResourceId: { + serializedName: "properties.agentResourceId", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const JobRun: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "JobRun", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + status: { + serializedName: "properties.status", + readOnly: true, + type: { + name: "String" + } + }, + scanStatus: { + serializedName: "properties.scanStatus", + readOnly: true, + type: { + name: "String" + } + }, + agentName: { + serializedName: "properties.agentName", + readOnly: true, + type: { + name: "String" + } + }, + agentResourceId: { + serializedName: "properties.agentResourceId", + readOnly: true, + type: { + name: "String" + } + }, + executionStartTime: { + serializedName: "properties.executionStartTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + executionEndTime: { + serializedName: "properties.executionEndTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastStatusUpdate: { + serializedName: "properties.lastStatusUpdate", + readOnly: true, + type: { + name: "DateTime" + } + }, + itemsScanned: { + serializedName: "properties.itemsScanned", + readOnly: true, + type: { + name: "Number" + } + }, + itemsExcluded: { + serializedName: "properties.itemsExcluded", + readOnly: true, + type: { + name: "Number" + } + }, + itemsUnsupported: { + serializedName: "properties.itemsUnsupported", + readOnly: true, + type: { + name: "Number" + } + }, + itemsNoTransferNeeded: { + serializedName: "properties.itemsNoTransferNeeded", + readOnly: true, + type: { + name: "Number" + } + }, + itemsFailed: { + serializedName: "properties.itemsFailed", + readOnly: true, + type: { + name: "Number" + } + }, + itemsTransferred: { + serializedName: "properties.itemsTransferred", + readOnly: true, + type: { + name: "Number" + } + }, + bytesScanned: { + serializedName: "properties.bytesScanned", + readOnly: true, + type: { + name: "Number" + } + }, + bytesExcluded: { + serializedName: "properties.bytesExcluded", + readOnly: true, + type: { + name: "Number" + } + }, + bytesUnsupported: { + serializedName: "properties.bytesUnsupported", + readOnly: true, + type: { + name: "Number" + } + }, + bytesNoTransferNeeded: { + serializedName: "properties.bytesNoTransferNeeded", + readOnly: true, + type: { + name: "Number" + } + }, + bytesFailed: { + serializedName: "properties.bytesFailed", + readOnly: true, + type: { + name: "Number" + } + }, + bytesTransferred: { + serializedName: "properties.bytesTransferred", + readOnly: true, + type: { + name: "Number" + } + }, + sourceName: { + serializedName: "properties.sourceName", + readOnly: true, + type: { + name: "String" + } + }, + sourceResourceId: { + serializedName: "properties.sourceResourceId", + readOnly: true, + type: { + name: "String" + } + }, + sourceProperties: { + serializedName: "properties.sourceProperties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + targetName: { + serializedName: "properties.targetName", + readOnly: true, + type: { + name: "String" + } + }, + targetResourceId: { + serializedName: "properties.targetResourceId", + readOnly: true, + type: { + name: "String" + } + }, + targetProperties: { + serializedName: "properties.targetProperties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + jobDefinitionProperties: { + serializedName: "properties.jobDefinitionProperties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + error: { + serializedName: "properties.error", + type: { + name: "Composite", + className: "JobRunError" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export let discriminators = { + EndpointBaseProperties: EndpointBaseProperties, + "EndpointBaseProperties.AzureStorageBlobContainer": AzureStorageBlobContainerEndpointProperties, + "EndpointBaseProperties.NfsMount": NfsMountEndpointProperties +}; diff --git a/sdk/storagemover/arm-storagemover/src/models/parameters.ts b/sdk/storagemover/arm-storagemover/src/models/parameters.ts new file mode 100644 index 000000000000..a43470597d0f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/models/parameters.ts @@ -0,0 +1,230 @@ +/* + * 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 { + StorageMover as StorageMoverMapper, + StorageMoverUpdateParameters as StorageMoverUpdateParametersMapper, + Agent as AgentMapper, + AgentUpdateParameters as AgentUpdateParametersMapper, + Endpoint as EndpointMapper, + EndpointBaseUpdateParameters as EndpointBaseUpdateParametersMapper, + Project as ProjectMapper, + ProjectUpdateParameters as ProjectUpdateParametersMapper, + JobDefinition as JobDefinitionMapper, + JobDefinitionUpdateParameters as JobDefinitionUpdateParametersMapper +} 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: "2022-07-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 storageMoverName: OperationURLParameter = { + parameterPath: "storageMoverName", + mapper: { + serializedName: "storageMoverName", + 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 storageMover: OperationParameter = { + parameterPath: "storageMover", + mapper: StorageMoverMapper +}; + +export const storageMover1: OperationParameter = { + parameterPath: "storageMover", + mapper: StorageMoverUpdateParametersMapper +}; + +export const agentName: OperationURLParameter = { + parameterPath: "agentName", + mapper: { + serializedName: "agentName", + required: true, + type: { + name: "String" + } + } +}; + +export const agent: OperationParameter = { + parameterPath: "agent", + mapper: AgentMapper +}; + +export const agent1: OperationParameter = { + parameterPath: "agent", + mapper: AgentUpdateParametersMapper +}; + +export const endpointName: OperationURLParameter = { + parameterPath: "endpointName", + mapper: { + serializedName: "endpointName", + required: true, + type: { + name: "String" + } + } +}; + +export const endpoint: OperationParameter = { + parameterPath: "endpoint", + mapper: EndpointMapper +}; + +export const endpoint1: OperationParameter = { + parameterPath: "endpoint", + mapper: EndpointBaseUpdateParametersMapper +}; + +export const projectName: OperationURLParameter = { + parameterPath: "projectName", + mapper: { + serializedName: "projectName", + required: true, + type: { + name: "String" + } + } +}; + +export const project: OperationParameter = { + parameterPath: "project", + mapper: ProjectMapper +}; + +export const project1: OperationParameter = { + parameterPath: "project", + mapper: ProjectUpdateParametersMapper +}; + +export const jobDefinitionName: OperationURLParameter = { + parameterPath: "jobDefinitionName", + mapper: { + serializedName: "jobDefinitionName", + required: true, + type: { + name: "String" + } + } +}; + +export const jobDefinition: OperationParameter = { + parameterPath: "jobDefinition", + mapper: JobDefinitionMapper +}; + +export const jobDefinition1: OperationParameter = { + parameterPath: "jobDefinition", + mapper: JobDefinitionUpdateParametersMapper +}; + +export const jobRunName: OperationURLParameter = { + parameterPath: "jobRunName", + mapper: { + serializedName: "jobRunName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/agents.ts b/sdk/storagemover/arm-storagemover/src/operations/agents.ts new file mode 100644 index 000000000000..9ba3dd3efcc9 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/agents.ts @@ -0,0 +1,454 @@ +/* + * 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 { Agents } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Agent, + AgentsListNextOptionalParams, + AgentsListOptionalParams, + AgentsListResponse, + AgentsGetOptionalParams, + AgentsGetResponse, + AgentsCreateOrUpdateOptionalParams, + AgentsCreateOrUpdateResponse, + AgentUpdateParameters, + AgentsUpdateOptionalParams, + AgentsUpdateResponse, + AgentsDeleteOptionalParams, + AgentsListNextResponse +} from "../models"; + +/// +/** Class containing Agents operations. */ +export class AgentsImpl implements Agents { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class Agents class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Agents in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageMoverName: string, + options?: AgentsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageMoverName, + 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( + resourceGroupName, + storageMoverName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageMoverName: string, + options?: AgentsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: AgentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, storageMoverName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageMoverName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageMoverName: string, + options?: AgentsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageMoverName, + options + )) { + yield* page; + } + } + + /** + * Lists all Agents in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageMoverName: string, + options?: AgentsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, options }, + listOperationSpec + ); + } + + /** + * Gets an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, agentName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param agent The Agent resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + agent: Agent, + options?: AgentsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, agentName, agent, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Creates or updates an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param agent The Agent resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + agent: AgentUpdateParameters, + options?: AgentsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, agentName, agent, options }, + updateOperationSpec + ); + } + + /** + * Deletes an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsDeleteOptionalParams + ): 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, storageMoverName, agentName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageMoverName, + agentName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageMoverName: string, + nextLink: string, + options?: AgentsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AgentList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Agent + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.agentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Agent + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.agent, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.agentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Agent + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.agent1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.agentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/agents/{agentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.agentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AgentList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/endpoints.ts b/sdk/storagemover/arm-storagemover/src/operations/endpoints.ts new file mode 100644 index 000000000000..c3a40fed682d --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/endpoints.ts @@ -0,0 +1,455 @@ +/* + * 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 { Endpoints } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Endpoint, + EndpointsListNextOptionalParams, + EndpointsListOptionalParams, + EndpointsListResponse, + EndpointsGetOptionalParams, + EndpointsGetResponse, + EndpointsCreateOrUpdateOptionalParams, + EndpointsCreateOrUpdateResponse, + EndpointBaseUpdateParameters, + EndpointsUpdateOptionalParams, + EndpointsUpdateResponse, + EndpointsDeleteOptionalParams, + EndpointsListNextResponse +} from "../models"; + +/// +/** Class containing Endpoints operations. */ +export class EndpointsImpl implements Endpoints { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class Endpoints class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Endpoints in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageMoverName: string, + options?: EndpointsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageMoverName, + 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( + resourceGroupName, + storageMoverName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageMoverName: string, + options?: EndpointsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: EndpointsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, storageMoverName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageMoverName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageMoverName: string, + options?: EndpointsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageMoverName, + options + )) { + yield* page; + } + } + + /** + * Lists all Endpoints in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageMoverName: string, + options?: EndpointsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, options }, + listOperationSpec + ); + } + + /** + * Gets an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, endpointName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param endpoint The Endpoint resource, which contains information about file sources and targets. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + endpoint: Endpoint, + options?: EndpointsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, endpointName, endpoint, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Updates properties for an Endpoint resource. Properties not specified in the request body will be + * unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param endpoint The Endpoint resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + endpoint: EndpointBaseUpdateParameters, + options?: EndpointsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, endpointName, endpoint, options }, + updateOperationSpec + ); + } + + /** + * Deletes an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): 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, storageMoverName, endpointName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageMoverName, + endpointName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageMoverName: string, + nextLink: string, + options?: EndpointsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EndpointList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Endpoint + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.endpointName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Endpoint + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.endpoint, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.endpointName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Endpoint + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.endpoint1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.endpointName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/endpoints/{endpointName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.endpointName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EndpointList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/index.ts b/sdk/storagemover/arm-storagemover/src/operations/index.ts new file mode 100644 index 000000000000..4f81d04663d2 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/index.ts @@ -0,0 +1,15 @@ +/* + * 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 "./storageMovers"; +export * from "./agents"; +export * from "./endpoints"; +export * from "./projects"; +export * from "./jobDefinitions"; +export * from "./jobRuns"; diff --git a/sdk/storagemover/arm-storagemover/src/operations/jobDefinitions.ts b/sdk/storagemover/arm-storagemover/src/operations/jobDefinitions.ts new file mode 100644 index 000000000000..a8a79593d4eb --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/jobDefinitions.ts @@ -0,0 +1,622 @@ +/* + * 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 { JobDefinitions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + JobDefinition, + JobDefinitionsListNextOptionalParams, + JobDefinitionsListOptionalParams, + JobDefinitionsListResponse, + JobDefinitionsGetOptionalParams, + JobDefinitionsGetResponse, + JobDefinitionsCreateOrUpdateOptionalParams, + JobDefinitionsCreateOrUpdateResponse, + JobDefinitionUpdateParameters, + JobDefinitionsUpdateOptionalParams, + JobDefinitionsUpdateResponse, + JobDefinitionsDeleteOptionalParams, + JobDefinitionsStartJobOptionalParams, + JobDefinitionsStartJobResponse, + JobDefinitionsStopJobOptionalParams, + JobDefinitionsStopJobResponse, + JobDefinitionsListNextResponse +} from "../models"; + +/// +/** Class containing JobDefinitions operations. */ +export class JobDefinitionsImpl implements JobDefinitions { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class JobDefinitions class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Job Definitions in a Project. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: JobDefinitionsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageMoverName, + projectName, + 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( + resourceGroupName, + storageMoverName, + projectName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: JobDefinitionsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: JobDefinitionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + storageMoverName, + projectName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageMoverName, + projectName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: JobDefinitionsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageMoverName, + projectName, + options + )) { + yield* page; + } + } + + /** + * Lists all Job Definitions in a Project. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: JobDefinitionsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, projectName, options }, + listOperationSpec + ); + } + + /** + * Gets a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + }, + getOperationSpec + ); + } + + /** + * Creates or updates a Job Definition resource, which contains configuration for a single unit of + * managed data transfer. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobDefinition The Job Definition resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobDefinition: JobDefinition, + options?: JobDefinitionsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition, + options + }, + createOrUpdateOperationSpec + ); + } + + /** + * Updates properties for a Job Definition resource. Properties not specified in the request body will + * be unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobDefinition The Job Definition resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobDefinition: JobDefinitionUpdateParameters, + options?: JobDefinitionsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobDefinition, + options + }, + updateOperationSpec + ); + } + + /** + * Deletes a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsDeleteOptionalParams + ): 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, + storageMoverName, + projectName, + jobDefinitionName, + options + }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + startJob( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsStartJobOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + }, + startJobOperationSpec + ); + } + + /** + * Requests the Agent of any active instance of this Job Definition to stop. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + stopJob( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsStopJobOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + }, + stopJobOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + nextLink: string, + options?: JobDefinitionsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, projectName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobDefinitionList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobDefinition + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.JobDefinition + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.jobDefinition, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.JobDefinition + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.jobDefinition1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const startJobOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/startJob", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.JobRunResourceId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const stopJobOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/stopJob", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.JobRunResourceId + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobDefinitionList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/jobRuns.ts b/sdk/storagemover/arm-storagemover/src/operations/jobRuns.ts new file mode 100644 index 000000000000..4aef7d380585 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/jobRuns.ts @@ -0,0 +1,302 @@ +/* + * 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 { JobRuns } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { + JobRun, + JobRunsListNextOptionalParams, + JobRunsListOptionalParams, + JobRunsListResponse, + JobRunsGetOptionalParams, + JobRunsGetResponse, + JobRunsListNextResponse +} from "../models"; + +/// +/** Class containing JobRuns operations. */ +export class JobRunsImpl implements JobRuns { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class JobRuns class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Job Runs in a Job Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobRunsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + 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( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobRunsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: JobRunsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobRunsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + )) { + yield* page; + } + } + + /** + * Lists all Job Runs in a Job Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobRunsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + options + }, + listOperationSpec + ); + } + + /** + * Gets a Job Run resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobRunName The name of the Job Run resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobRunName: string, + options?: JobRunsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + jobRunName, + options + }, + getOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + nextLink: string, + options?: JobRunsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageMoverName, + projectName, + jobDefinitionName, + nextLink, + options + }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobRunList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}/jobDefinitions/{jobDefinitionName}/jobRuns/{jobRunName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobRun + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName, + Parameters.jobRunName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.JobRunList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName, + Parameters.jobDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/operations.ts b/sdk/storagemover/arm-storagemover/src/operations/operations.ts new file mode 100644 index 000000000000..e3e7c4cbed7e --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * 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 { StorageMoverClient } from "../storageMoverClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * @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; + } + } + + /** + * Lists all the supported operations for the Azure Storage Mover REST API. + * @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.StorageMover/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/storagemover/arm-storagemover/src/operations/projects.ts b/sdk/storagemover/arm-storagemover/src/operations/projects.ts new file mode 100644 index 000000000000..e39f72f159a5 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/projects.ts @@ -0,0 +1,455 @@ +/* + * 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 { Projects } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Project, + ProjectsListNextOptionalParams, + ProjectsListOptionalParams, + ProjectsListResponse, + ProjectsGetOptionalParams, + ProjectsGetResponse, + ProjectsCreateOrUpdateOptionalParams, + ProjectsCreateOrUpdateResponse, + ProjectUpdateParameters, + ProjectsUpdateOptionalParams, + ProjectsUpdateResponse, + ProjectsDeleteOptionalParams, + ProjectsListNextResponse +} from "../models"; + +/// +/** Class containing Projects operations. */ +export class ProjectsImpl implements Projects { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class Projects class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Projects in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageMoverName: string, + options?: ProjectsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageMoverName, + 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( + resourceGroupName, + storageMoverName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageMoverName: string, + options?: ProjectsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ProjectsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, storageMoverName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageMoverName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageMoverName: string, + options?: ProjectsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageMoverName, + options + )) { + yield* page; + } + } + + /** + * Lists all Projects in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageMoverName: string, + options?: ProjectsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, options }, + listOperationSpec + ); + } + + /** + * Gets a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, projectName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a Project resource, which is a logical grouping of related jobs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param project The Project resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + project: Project, + options?: ProjectsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, projectName, project, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Updates properties for a Project resource. Properties not specified in the request body will be + * unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param project The Project resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + project: ProjectUpdateParameters, + options?: ProjectsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, projectName, project, options }, + updateOperationSpec + ); + } + + /** + * Deletes a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsDeleteOptionalParams + ): 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, storageMoverName, projectName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageMoverName, + projectName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageMoverName: string, + nextLink: string, + options?: ProjectsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProjectList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Project + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Project + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.project, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Project + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.project1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}/projects/{projectName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName, + Parameters.projectName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProjectList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operations/storageMovers.ts b/sdk/storagemover/arm-storagemover/src/operations/storageMovers.ts new file mode 100644 index 000000000000..22e7c7d252ee --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operations/storageMovers.ts @@ -0,0 +1,539 @@ +/* + * 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 { StorageMovers } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageMoverClient } from "../storageMoverClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageMover, + StorageMoversListBySubscriptionNextOptionalParams, + StorageMoversListBySubscriptionOptionalParams, + StorageMoversListBySubscriptionResponse, + StorageMoversListNextOptionalParams, + StorageMoversListOptionalParams, + StorageMoversListResponse, + StorageMoversGetOptionalParams, + StorageMoversGetResponse, + StorageMoversCreateOrUpdateOptionalParams, + StorageMoversCreateOrUpdateResponse, + StorageMoverUpdateParameters, + StorageMoversUpdateOptionalParams, + StorageMoversUpdateResponse, + StorageMoversDeleteOptionalParams, + StorageMoversListBySubscriptionNextResponse, + StorageMoversListNextResponse +} from "../models"; + +/// +/** Class containing StorageMovers operations. */ +export class StorageMoversImpl implements StorageMovers { + private readonly client: StorageMoverClient; + + /** + * Initialize a new instance of the class StorageMovers class. + * @param client Reference to the service client + */ + constructor(client: StorageMoverClient) { + this.client = client; + } + + /** + * Lists all Storage Movers in a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: StorageMoversListBySubscriptionOptionalParams + ): 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?: StorageMoversListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageMoversListBySubscriptionResponse; + 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?: StorageMoversListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all Storage Movers in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + options?: StorageMoversListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(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.listPagingPage(resourceGroupName, options, settings); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + options?: StorageMoversListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageMoversListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + options?: StorageMoversListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceGroupName, options)) { + yield* page; + } + } + + /** + * Lists all Storage Movers in a subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: StorageMoversListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Lists all Storage Movers in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + options?: StorageMoversListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listOperationSpec + ); + } + + /** + * Gets a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a top-level Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Agents, + * Projects, and Endpoints. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + storageMover: StorageMover, + options?: StorageMoversCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, storageMover, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will + * be unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + storageMover: StorageMoverUpdateParameters, + options?: StorageMoversUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageMoverName, storageMover, options }, + updateOperationSpec + ); + } + + /** + * Deletes a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversDeleteOptionalParams + ): 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, storageMoverName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageMoverName, + 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?: StorageMoversListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + nextLink: string, + options?: StorageMoversListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageMover/storageMovers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageMoverList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageMoverList + }, + 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.StorageMover/storageMovers/{storageMoverName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageMover + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.StorageMover + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.storageMover, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.StorageMover + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.storageMover1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageMover/storageMovers/{storageMoverName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageMoverName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageMoverList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageMoverList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/agents.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/agents.ts new file mode 100644 index 000000000000..1d7cb488859f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/agents.ts @@ -0,0 +1,107 @@ +/* + * 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 { + Agent, + AgentsListOptionalParams, + AgentsGetOptionalParams, + AgentsGetResponse, + AgentsCreateOrUpdateOptionalParams, + AgentsCreateOrUpdateResponse, + AgentUpdateParameters, + AgentsUpdateOptionalParams, + AgentsUpdateResponse, + AgentsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Agents. */ +export interface Agents { + /** + * Lists all Agents in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageMoverName: string, + options?: AgentsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsGetOptionalParams + ): Promise; + /** + * Creates or updates an Agent resource, which references a hybrid compute machine that can run jobs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param agent The Agent resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + agent: Agent, + options?: AgentsCreateOrUpdateOptionalParams + ): Promise; + /** + * Creates or updates an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param agent The Agent resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + agent: AgentUpdateParameters, + options?: AgentsUpdateOptionalParams + ): Promise; + /** + * Deletes an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes an Agent resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param agentName The name of the Agent resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + agentName: string, + options?: AgentsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/endpoints.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/endpoints.ts new file mode 100644 index 000000000000..40cd5cbb690c --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/endpoints.ts @@ -0,0 +1,108 @@ +/* + * 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 { + Endpoint, + EndpointsListOptionalParams, + EndpointsGetOptionalParams, + EndpointsGetResponse, + EndpointsCreateOrUpdateOptionalParams, + EndpointsCreateOrUpdateResponse, + EndpointBaseUpdateParameters, + EndpointsUpdateOptionalParams, + EndpointsUpdateResponse, + EndpointsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Endpoints. */ +export interface Endpoints { + /** + * Lists all Endpoints in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageMoverName: string, + options?: EndpointsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsGetOptionalParams + ): Promise; + /** + * Creates or updates an Endpoint resource, which represents a data transfer source or destination. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param endpoint The Endpoint resource, which contains information about file sources and targets. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + endpoint: Endpoint, + options?: EndpointsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates properties for an Endpoint resource. Properties not specified in the request body will be + * unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param endpoint The Endpoint resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + endpoint: EndpointBaseUpdateParameters, + options?: EndpointsUpdateOptionalParams + ): Promise; + /** + * Deletes an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes an Endpoint resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param endpointName The name of the Endpoint resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + endpointName: string, + options?: EndpointsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/index.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..4f81d04663d2 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/index.ts @@ -0,0 +1,15 @@ +/* + * 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 "./storageMovers"; +export * from "./agents"; +export * from "./endpoints"; +export * from "./projects"; +export * from "./jobDefinitions"; +export * from "./jobRuns"; diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobDefinitions.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobDefinitions.ts new file mode 100644 index 000000000000..7b31e7cb57e7 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobDefinitions.ts @@ -0,0 +1,155 @@ +/* + * 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 { + JobDefinition, + JobDefinitionsListOptionalParams, + JobDefinitionsGetOptionalParams, + JobDefinitionsGetResponse, + JobDefinitionsCreateOrUpdateOptionalParams, + JobDefinitionsCreateOrUpdateResponse, + JobDefinitionUpdateParameters, + JobDefinitionsUpdateOptionalParams, + JobDefinitionsUpdateResponse, + JobDefinitionsDeleteOptionalParams, + JobDefinitionsStartJobOptionalParams, + JobDefinitionsStartJobResponse, + JobDefinitionsStopJobOptionalParams, + JobDefinitionsStopJobResponse +} from "../models"; + +/// +/** Interface representing a JobDefinitions. */ +export interface JobDefinitions { + /** + * Lists all Job Definitions in a Project. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: JobDefinitionsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsGetOptionalParams + ): Promise; + /** + * Creates or updates a Job Definition resource, which contains configuration for a single unit of + * managed data transfer. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobDefinition The Job Definition resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobDefinition: JobDefinition, + options?: JobDefinitionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates properties for a Job Definition resource. Properties not specified in the request body will + * be unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobDefinition The Job Definition resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobDefinition: JobDefinitionUpdateParameters, + options?: JobDefinitionsUpdateOptionalParams + ): Promise; + /** + * Deletes a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a Job Definition resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsDeleteOptionalParams + ): Promise; + /** + * Requests an Agent to start a new instance of this Job Definition, generating a new Job Run resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + startJob( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsStartJobOptionalParams + ): Promise; + /** + * Requests the Agent of any active instance of this Job Definition to stop. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + stopJob( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobDefinitionsStopJobOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobRuns.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobRuns.ts new file mode 100644 index 000000000000..b697ac0d38e1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/jobRuns.ts @@ -0,0 +1,52 @@ +/* + * 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 { + JobRun, + JobRunsListOptionalParams, + JobRunsGetOptionalParams, + JobRunsGetResponse +} from "../models"; + +/// +/** Interface representing a JobRuns. */ +export interface JobRuns { + /** + * Lists all Job Runs in a Job Definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + options?: JobRunsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a Job Run resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param jobDefinitionName The name of the Job Definition resource. + * @param jobRunName The name of the Job Run resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + jobDefinitionName: string, + jobRunName: string, + options?: JobRunsGetOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/operations.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..48ead2b0fd00 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/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 supported operations for the Azure Storage Mover REST API. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/projects.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/projects.ts new file mode 100644 index 000000000000..b0bb0f7c53c1 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/projects.ts @@ -0,0 +1,108 @@ +/* + * 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 { + Project, + ProjectsListOptionalParams, + ProjectsGetOptionalParams, + ProjectsGetResponse, + ProjectsCreateOrUpdateOptionalParams, + ProjectsCreateOrUpdateResponse, + ProjectUpdateParameters, + ProjectsUpdateOptionalParams, + ProjectsUpdateResponse, + ProjectsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Projects. */ +export interface Projects { + /** + * Lists all Projects in a Storage Mover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageMoverName: string, + options?: ProjectsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsGetOptionalParams + ): Promise; + /** + * Creates or updates a Project resource, which is a logical grouping of related jobs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param project The Project resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + project: Project, + options?: ProjectsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates properties for a Project resource. Properties not specified in the request body will be + * unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param project The Project resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + project: ProjectUpdateParameters, + options?: ProjectsUpdateOptionalParams + ): Promise; + /** + * Deletes a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a Project resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param projectName The name of the Project resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + projectName: string, + options?: ProjectsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/operationsInterfaces/storageMovers.ts b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/storageMovers.ts new file mode 100644 index 000000000000..7e0d880457af --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/operationsInterfaces/storageMovers.ts @@ -0,0 +1,105 @@ +/* + * 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 { + StorageMover, + StorageMoversListBySubscriptionOptionalParams, + StorageMoversListOptionalParams, + StorageMoversGetOptionalParams, + StorageMoversGetResponse, + StorageMoversCreateOrUpdateOptionalParams, + StorageMoversCreateOrUpdateResponse, + StorageMoverUpdateParameters, + StorageMoversUpdateOptionalParams, + StorageMoversUpdateResponse, + StorageMoversDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a StorageMovers. */ +export interface StorageMovers { + /** + * Lists all Storage Movers in a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: StorageMoversListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all Storage Movers in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + options?: StorageMoversListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversGetOptionalParams + ): Promise; + /** + * Creates or updates a top-level Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource, which is a container for a group of Agents, + * Projects, and Endpoints. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + storageMoverName: string, + storageMover: StorageMover, + options?: StorageMoversCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates properties for a Storage Mover resource. Properties not specified in the request body will + * be unchanged. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param storageMover The Storage Mover resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + storageMoverName: string, + storageMover: StorageMoverUpdateParameters, + options?: StorageMoversUpdateOptionalParams + ): Promise; + /** + * Deletes a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a Storage Mover resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageMoverName The name of the Storage Mover resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageMoverName: string, + options?: StorageMoversDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagemover/arm-storagemover/src/pagingHelper.ts b/sdk/storagemover/arm-storagemover/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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/storagemover/arm-storagemover/src/storageMoverClient.ts b/sdk/storagemover/arm-storagemover/src/storageMoverClient.ts new file mode 100644 index 000000000000..6d603702021f --- /dev/null +++ b/sdk/storagemover/arm-storagemover/src/storageMoverClient.ts @@ -0,0 +1,168 @@ +/* + * 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, + StorageMoversImpl, + AgentsImpl, + EndpointsImpl, + ProjectsImpl, + JobDefinitionsImpl, + JobRunsImpl +} from "./operations"; +import { + Operations, + StorageMovers, + Agents, + Endpoints, + Projects, + JobDefinitions, + JobRuns +} from "./operationsInterfaces"; +import { StorageMoverClientOptionalParams } from "./models"; + +export class StorageMoverClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the StorageMoverClient 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?: StorageMoverClientOptionalParams + ) { + 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: StorageMoverClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-storagemover/1.0.0-beta.1`; + 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 || "2022-07-01-preview"; + this.operations = new OperationsImpl(this); + this.storageMovers = new StorageMoversImpl(this); + this.agents = new AgentsImpl(this); + this.endpoints = new EndpointsImpl(this); + this.projects = new ProjectsImpl(this); + this.jobDefinitions = new JobDefinitionsImpl(this); + this.jobRuns = new JobRunsImpl(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; + storageMovers: StorageMovers; + agents: Agents; + endpoints: Endpoints; + projects: Projects; + jobDefinitions: JobDefinitions; + jobRuns: JobRuns; +} diff --git a/sdk/storagemover/arm-storagemover/test/storagemover_operations_test.spec.ts b/sdk/storagemover/arm-storagemover/test/storagemover_operations_test.spec.ts new file mode 100644 index 000000000000..40ee6cb034ae --- /dev/null +++ b/sdk/storagemover/arm-storagemover/test/storagemover_operations_test.spec.ts @@ -0,0 +1,93 @@ +/* + * 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 { StorageMoverClient } from "../src/storageMoverClient"; + +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 +}; + +export const testPollingOptions = { + updateIntervalInMs: isPlaybackMode() ? 0 : undefined, +}; + +describe("storageMover test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: StorageMoverClient; + let location: string; + let resourceGroup: string; + let storageMoverName: 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 StorageMoverClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + storageMoverName = "storageMoverName"; + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("storageMovers create test", async function () { + const res = await client.storageMovers.createOrUpdate( + resourceGroup, + storageMoverName, + { + description: "Example Storage Mover Description", + location, + tags: { key1: "value1", key2: "value2" } + }); + assert.equal(res.name, storageMoverName); + }); + + it("storageMovers get test", async function () { + const res = await client.storageMovers.get(resourceGroup, storageMoverName); + assert.equal(res.name, storageMoverName); + }); + + it("storageMovers list test", async function () { + const resArray = new Array(); + for await (let item of client.storageMovers.listBySubscription()) { + resArray.push(item); + } + assert.equal(resArray.length, 1); + }); + + it("storageMovers delete test", async function () { + const resArray = new Array(); + const res = await client.storageMovers.beginDeleteAndWait(resourceGroup, storageMoverName) + for await (let item of client.storageMovers.listBySubscription()) { + resArray.push(item); + } + assert.equal(resArray.length, 0); + }); +}) diff --git a/sdk/storagemover/arm-storagemover/tsconfig.json b/sdk/storagemover/arm-storagemover/tsconfig.json new file mode 100644 index 000000000000..aff39d40c9b4 --- /dev/null +++ b/sdk/storagemover/arm-storagemover/tsconfig.json @@ -0,0 +1,33 @@ +{ + "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-storagemover": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/storagemover/ci.mgmt.yml b/sdk/storagemover/ci.mgmt.yml new file mode 100644 index 000000000000..adbe072d30e3 --- /dev/null +++ b/sdk/storagemover/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/storagemover/arm-storagemover + - sdk/storagemover/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/storagemover/arm-storagemover + - sdk/storagemover/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagemover + Artifacts: + - name: azure-arm-storagemover + safeName: azurearmstoragemover + \ No newline at end of file