diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d8f187f6ec69..44557c9e42b5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -585,6 +585,9 @@ # PRLabel: %Mgmt /sdk/machinelearningcompute/arm-machinelearningcompute/ @qiaozha @MaryGao +# PRLabel: %Mgmt +/sdk/migrationdiscovery/arm-migrationdiscoverysap/ @qiaozha @MaryGao + # PRLabel: %Mgmt /sdk/machinelearningexperimentation/arm-machinelearningexperimentation/ @qiaozha @MaryGao diff --git a/.github/CODEOWNERS_baseline_errors.txt b/.github/CODEOWNERS_baseline_errors.txt index 1b49818b4e1e..cfb79836458d 100644 --- a/.github/CODEOWNERS_baseline_errors.txt +++ b/.github/CODEOWNERS_baseline_errors.txt @@ -18,6 +18,7 @@ KarishmaGhiya is not a public member of Azure. schaabs is not a public member of Azure. EmmaZhu is not a public member of Azure. RamonArguelles is not a public member of Azure. +sagivf is not a public member of Azure. MaryGao is not a public member of Azure. JacksonWeber is not a public member of Azure. Aviv-Yaniv is not a public member of Azure. diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 9770bb508575..d66dd64b8a7a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -449,6 +449,9 @@ dependencies: '@rush-temp/arm-migrate': specifier: file:./projects/arm-migrate.tgz version: file:projects/arm-migrate.tgz + '@rush-temp/arm-migrationdiscoverysap': + specifier: file:./projects/arm-migrationdiscoverysap.tgz + version: file:projects/arm-migrationdiscoverysap.tgz '@rush-temp/arm-mixedreality': specifier: file:./projects/arm-mixedreality.tgz version: file:projects/arm-mixedreality.tgz @@ -3411,13 +3414,13 @@ packages: resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==} dependencies: '@types/connect': 3.4.38 - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/bunyan@1.8.9: resolution: {integrity: sha512-ZqS9JGpBxVOvsawzmVt30sP++gSQMTejCkIAQ3VdadOcRE8izTyW66hufvwLeH+YEGP6Js2AW7Gz+RMyvrEbmw==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/chai-as-promised@7.1.8: @@ -3439,7 +3442,7 @@ packages: /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/cookie@0.4.1: @@ -3449,7 +3452,7 @@ packages: /@types/cors@2.8.17: resolution: {integrity: sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/debug@4.1.12: @@ -3497,7 +3500,7 @@ packages: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/fs-extra@8.1.5: @@ -3544,7 +3547,7 @@ packages: /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/jsonwebtoken@9.0.6: @@ -3607,13 +3610,13 @@ packages: /@types/mysql@2.15.22: resolution: {integrity: sha512-wK1pzsJVVAjYCSZWQoWHziQZbNggXFDUEIGf54g4ZM/ERuP86uGdWeKZWMYlqTPMZfHJJvLPyogXGvCOg87yLQ==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/node-fetch@2.6.11: resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 form-data: 4.0.0 dev: false @@ -3642,7 +3645,7 @@ packages: /@types/pg@8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: false @@ -3662,7 +3665,7 @@ packages: /@types/readdir-glob@1.1.5: resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/resolve@1.20.2: @@ -3681,7 +3684,7 @@ packages: resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} dependencies: '@types/mime': 1.3.5 - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/serve-static@1.15.5: @@ -3689,7 +3692,7 @@ packages: dependencies: '@types/http-errors': 2.0.4 '@types/mime': 3.0.4 - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/shimmer@1.0.5: @@ -3715,7 +3718,7 @@ packages: /@types/through@0.0.33: resolution: {integrity: sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/trusted-types@2.0.7: @@ -3725,7 +3728,7 @@ packages: /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false /@types/underscore@1.11.15: @@ -3766,7 +3769,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 18.19.26 + '@types/node': 20.10.8 dev: false optional: true @@ -5381,7 +5384,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 18.19.26 + '@types/node': 20.10.8 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -15075,6 +15078,34 @@ packages: - supports-color dev: false + file:projects/arm-migrationdiscoverysap.tgz: + resolution: {integrity: sha512-cmsd0WbUUKDuYJUHMLMXFiPiuAFO1pJ8CySu0T6FmCBARUE6vWz7tNNT+d6PfGET1WEGRO56OeB72F5MfuWXwg==, tarball: file:projects/arm-migrationdiscoverysap.tgz} + name: '@rush-temp/arm-migrationdiscoverysap' + version: 0.0.0 + dependencies: + '@azure/abort-controller': 1.1.0 + '@azure/identity': 4.0.1 + '@microsoft/api-extractor': 7.43.0(@types/node@18.19.26) + '@types/chai': 4.3.14 + '@types/mocha': 10.0.6 + '@types/node': 18.19.26 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + esm: 3.2.25 + mkdirp: 2.1.6 + mocha: 10.3.0 + rimraf: 5.0.5 + ts-node: 10.9.2(@types/node@18.19.26)(typescript@5.3.3) + tslib: 2.6.2 + typescript: 5.3.3 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-mixedreality.tgz: resolution: {integrity: sha512-Q+psd8EPbLB0M9BQ0/FhxytuM9rslkjHw0NXLagRgQ0wIIsdOAKtupBgnkaXN/dqu7hRxTMkvkaUqQCFXnakzw==, tarball: file:projects/arm-mixedreality.tgz} name: '@rush-temp/arm-mixedreality' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 34ca07a5588c..0927a53cc0ed 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -17,4 +17,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-largeinstance?view=azure-no https://docs.microsoft.com/javascript/api/@azure/arm-springappdiscovery?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure-rest/purview-datamap?view=azure-node-preview https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-datamap-rest/samples +https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview diff --git a/rush.json b/rush.json index 2342306770fc..c36877bc6213 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */{ + */ { "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -2208,10 +2208,15 @@ "projectFolder": "sdk/springappdiscovery/arm-springappdiscovery", "versionPolicyName": "management" }, + { + "packageName": "@azure/arm-migrationdiscoverysap", + "projectFolder": "sdk/migrationdiscovery/arm-migrationdiscoverysap", + "versionPolicyName": "management" + }, { "packageName": "@azure/arm-storageactions", "projectFolder": "sdk/storageactions/arm-storageactions", "versionPolicyName": "management" } ] -} \ No newline at end of file +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/CHANGELOG.md b/sdk/migrationdiscovery/arm-migrationdiscoverysap/CHANGELOG.md new file mode 100644 index 000000000000..e52b7a5b97af --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2024-03-12) + +The package of @azure/arm-migrationdiscoverysap is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/LICENSE b/sdk/migrationdiscovery/arm-migrationdiscoverysap/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 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/migrationdiscovery/arm-migrationdiscoverysap/README.md b/sdk/migrationdiscovery/arm-migrationdiscoverysap/README.md new file mode 100644 index 000000000000..429cab50e07d --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/README.md @@ -0,0 +1,109 @@ +# Azure Workloads client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Workloads client. + +SAP Migration client provides access to various operations for SAP Migration. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/migrationdiscovery/arm-migrationdiscoverysap) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-migrationdiscoverysap) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?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-migrationdiscoverysap` package + +Install the Azure Workloads client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-migrationdiscoverysap +``` + +### Create and authenticate a `WorkloadsClient` + +To create a client object to access the Azure Workloads API, you will need the `endpoint` of your Azure Workloads resource and a `credential`. The Azure Workloads client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Workloads 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 Workloads** 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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +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 WorkloadsClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new WorkloadsClient(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 + +### WorkloadsClient + +`WorkloadsClient` is the primary interface for developers using the Azure Workloads client library. Explore the methods on this client object to understand the different features of the Azure Workloads 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%2Fmigrationdiscovery%2Farm-migrationdiscoverysap%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/migrationdiscovery/arm-migrationdiscoverysap/_meta.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/_meta.json new file mode 100644 index 000000000000..feacc40daf99 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "3004d02873a4b583ba6a3966a370f1ba19b5da1d", + "readme": "specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\workloads\\resource-manager\\Microsoft.Workloads\\SAPDiscoverySites\\readme.md --use=@autorest/typescript@6.0.17 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", + "use": "@autorest/typescript@6.0.17" +} \ No newline at end of file diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/api-extractor.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/api-extractor.json new file mode 100644 index 000000000000..a75c649b9f5e --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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-migrationdiscoverysap.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/migrationdiscovery/arm-migrationdiscoverysap/assets.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/assets.json new file mode 100644 index 000000000000..db7d08ba1725 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "js", + "TagPrefix": "js/migrationdiscovery/arm-migrationdiscoverysap", + "Tag": "js/migrationdiscovery/arm-migrationdiscoverysap_47e920dbc4" +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/package.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/package.json new file mode 100644 index 000000000000..4cf2154a6a5f --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/package.json @@ -0,0 +1,118 @@ +{ + "name": "@azure/arm-migrationdiscoverysap", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for WorkloadsClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.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-migrationdiscoverysap.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^2.1.2", + "typescript": "~5.3.3", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.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", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && 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", + "clean": "rimraf --glob 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/workloadsClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/migrationdiscovery/arm-migrationdiscoverysap", + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/review/arm-migrationdiscoverysap.api.md b/sdk/migrationdiscovery/arm-migrationdiscoverysap/review/arm-migrationdiscoverysap.api.md new file mode 100644 index 000000000000..a4d9fac9b92a --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/review/arm-migrationdiscoverysap.api.md @@ -0,0 +1,631 @@ +## API Report File for "@azure/arm-migrationdiscoverysap" + +> 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 { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export interface ConfigurationData { + readonly cpu?: number; + readonly cpuInMhz?: number; + readonly cpuType?: string; + readonly databaseType?: DatabaseType; + readonly hardwareManufacturer?: string; + readonly model?: string; + readonly ram?: number; + readonly saps?: number; + readonly targetHanaRamSizeGB?: number; + readonly totalDiskIops?: number; + readonly totalDiskSizeGB?: number; +} + +// @public +export type CreatedByType = string; + +// @public +export type DatabaseType = string; + +// @public +export type DataSource = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDefinition { + readonly code?: string; + readonly details?: ErrorDefinition[]; + readonly message?: string; + readonly recommendation?: 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 interface ExcelPerformanceData extends PerformanceData { + dataSource: "Excel"; + readonly maxCpuLoad?: number; + readonly totalSourceDbSizeGB?: number; +} + +// @public +export interface ExtendedLocation { + name: string; + type: string; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownDatabaseType { + Adabas = "Adabas", + Db2 = "Db2", + Hana = "HANA", + Informix = "Informix", + Oracle = "Oracle", + Sapase = "SAPASE", + Sapdb = "SAPDB", + SAPMaxDB = "SAPMaxDB", + SQLServer = "SQLServer" +} + +// @public +export enum KnownDataSource { + Excel = "Excel", + Native = "Native" +} + +// @public +export enum KnownOperatingSystem { + Ibmaix = "IBMAIX", + RedHat = "RedHat", + Solaris = "Solaris", + Suse = "SUSE", + Unix = "Unix", + WindowsServer = "WindowsServer" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Unknown = "Unknown", + Updating = "Updating" +} + +// @public +export enum KnownSapInstanceEnvironment { + Development = "Development", + DisasterRecovery = "DisasterRecovery", + PreProduction = "PreProduction", + Production = "Production", + QualityAssurance = "QualityAssurance", + Sandbox = "Sandbox", + Test = "Test", + Training = "Training" +} + +// @public +export enum KnownSapInstanceType { + APP = "APP", + Ascs = "ASCS", + DB = "DB", + SCS = "SCS", + Webdisp = "WEBDISP" +} + +// @public +export enum KnownVersions { + V20231001Preview = "2023-10-01-preview" +} + +// @public +export interface NativePerformanceData extends PerformanceData { + dataSource: "Native"; +} + +// @public +export type OperatingSystem = 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 interface OperationStatusResult { + endTime?: Date; + error?: ErrorDetail; + id?: string; + name?: string; + operations?: OperationStatusResult[]; + percentComplete?: number; + startTime?: Date; + status: string; +} + +// @public +export type Origin = string; + +// @public +export interface PerformanceData { + dataSource: "Excel" | "Native"; +} + +// @public (undocumented) +export type PerformanceDataUnion = PerformanceData | ExcelPerformanceData | NativePerformanceData; + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SAPDiscoverySite extends TrackedResource { + extendedLocation?: ExtendedLocation; + properties?: SAPDiscoverySiteProperties; +} + +// @public +export interface SAPDiscoverySiteListResult { + readonly nextLink?: string; + value: SAPDiscoverySite[]; +} + +// @public +export interface SAPDiscoverySiteProperties { + readonly errors?: SAPMigrateError; + masterSiteId?: string; + migrateProjectId?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface SapDiscoverySites { + beginCreate(resourceGroupName: string, sapDiscoverySiteName: string, resource: SAPDiscoverySite, options?: SapDiscoverySitesCreateOptionalParams): Promise, SapDiscoverySitesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, sapDiscoverySiteName: string, resource: SAPDiscoverySite, options?: SapDiscoverySitesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapDiscoverySitesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapDiscoverySitesDeleteOptionalParams): Promise; + beginImportEntities(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapDiscoverySitesImportEntitiesOptionalParams): Promise, SapDiscoverySitesImportEntitiesResponse>>; + beginImportEntitiesAndWait(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapDiscoverySitesImportEntitiesOptionalParams): Promise; + get(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapDiscoverySitesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: SapDiscoverySitesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: SapDiscoverySitesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, sapDiscoverySiteName: string, properties: SAPDiscoverySiteTagsUpdate, options?: SapDiscoverySitesUpdateOptionalParams): Promise; +} + +// @public +export interface SapDiscoverySitesCreateHeaders { + retryAfter?: number; +} + +// @public +export interface SapDiscoverySitesCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SapDiscoverySitesCreateResponse = SAPDiscoverySite; + +// @public +export interface SapDiscoverySitesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface SapDiscoverySitesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SapDiscoverySitesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesGetResponse = SAPDiscoverySite; + +// @public +export interface SapDiscoverySitesImportEntitiesHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface SapDiscoverySitesImportEntitiesOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SapDiscoverySitesImportEntitiesResponse = OperationStatusResult; + +// @public +export interface SapDiscoverySitesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesListByResourceGroupNextResponse = SAPDiscoverySiteListResult; + +// @public +export interface SapDiscoverySitesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesListByResourceGroupResponse = SAPDiscoverySiteListResult; + +// @public +export interface SapDiscoverySitesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesListBySubscriptionNextResponse = SAPDiscoverySiteListResult; + +// @public +export interface SapDiscoverySitesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesListBySubscriptionResponse = SAPDiscoverySiteListResult; + +// @public +export interface SapDiscoverySitesUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapDiscoverySitesUpdateResponse = SAPDiscoverySite; + +// @public +export interface SAPDiscoverySiteTagsUpdate { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface SAPInstance extends TrackedResource { + properties?: SAPInstanceProperties; +} + +// @public +export type SapInstanceEnvironment = string; + +// @public +export interface SAPInstanceListResult { + readonly nextLink?: string; + value: SAPInstance[]; +} + +// @public +export interface SAPInstanceProperties { + readonly application?: string; + readonly environment?: SapInstanceEnvironment; + readonly errors?: SAPMigrateError; + readonly landscapeSid?: string; + readonly provisioningState?: ProvisioningState; + readonly systemSid?: string; +} + +// @public +export interface SapInstances { + beginCreate(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, resource: SAPInstance, options?: SapInstancesCreateOptionalParams): Promise, SapInstancesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, resource: SAPInstance, options?: SapInstancesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, options?: SapInstancesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, options?: SapInstancesDeleteOptionalParams): Promise; + get(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, options?: SapInstancesGetOptionalParams): Promise; + listBySapDiscoverySite(resourceGroupName: string, sapDiscoverySiteName: string, options?: SapInstancesListBySapDiscoverySiteOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, properties: SAPInstanceTagsUpdate, options?: SapInstancesUpdateOptionalParams): Promise; +} + +// @public +export interface SapInstancesCreateHeaders { + retryAfter?: number; +} + +// @public +export interface SapInstancesCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SapInstancesCreateResponse = SAPInstance; + +// @public +export interface SapInstancesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface SapInstancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SapInstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapInstancesGetResponse = SAPInstance; + +// @public +export interface SapInstancesListBySapDiscoverySiteNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapInstancesListBySapDiscoverySiteNextResponse = SAPInstanceListResult; + +// @public +export interface SapInstancesListBySapDiscoverySiteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapInstancesListBySapDiscoverySiteResponse = SAPInstanceListResult; + +// @public +export interface SapInstancesUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SapInstancesUpdateResponse = SAPInstance; + +// @public +export interface SAPInstanceTagsUpdate { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type SapInstanceType = string; + +// @public +export interface SAPMigrateError { + properties?: ErrorDefinition; +} + +// @public +export interface ServerInstance extends ProxyResource { + properties?: ServerInstanceProperties; +} + +// @public +export interface ServerInstanceListResult { + readonly nextLink?: string; + value: ServerInstance[]; +} + +// @public +export interface ServerInstanceProperties { + readonly configurationData?: ConfigurationData; + readonly errors?: SAPMigrateError; + readonly instanceSid?: string; + readonly operatingSystem?: OperatingSystem; + readonly performanceData?: PerformanceDataUnion; + readonly provisioningState?: ProvisioningState; + readonly sapInstanceType?: SapInstanceType; + readonly sapProduct?: string; + readonly sapProductVersion?: string; + readonly serverName?: string; +} + +// @public +export interface ServerInstances { + beginCreate(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, resource: ServerInstance, options?: ServerInstancesCreateOptionalParams): Promise, ServerInstancesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, resource: ServerInstance, options?: ServerInstancesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, options?: ServerInstancesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, options?: ServerInstancesDeleteOptionalParams): Promise; + get(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, options?: ServerInstancesGetOptionalParams): Promise; + listBySapInstance(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, options?: ServerInstancesListBySapInstanceOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, sapDiscoverySiteName: string, sapInstanceName: string, serverInstanceName: string, properties: UpdateServerInstanceRequest, options?: ServerInstancesUpdateOptionalParams): Promise; +} + +// @public +export interface ServerInstancesCreateHeaders { + retryAfter?: number; +} + +// @public +export interface ServerInstancesCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ServerInstancesCreateResponse = ServerInstance; + +// @public +export interface ServerInstancesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ServerInstancesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ServerInstancesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerInstancesGetResponse = ServerInstance; + +// @public +export interface ServerInstancesListBySapInstanceNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerInstancesListBySapInstanceNextResponse = ServerInstanceListResult; + +// @public +export interface ServerInstancesListBySapInstanceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerInstancesListBySapInstanceResponse = ServerInstanceListResult; + +// @public +export interface ServerInstancesUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerInstancesUpdateResponse = ServerInstance; + +// @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; + }; +} + +// @public +export interface UpdateServerInstanceRequest { + properties?: ServerInstanceProperties; +} + +// @public +export type Versions = string; + +// @public (undocumented) +export class WorkloadsClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: WorkloadsClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + operations: Operations; + // (undocumented) + sapDiscoverySites: SapDiscoverySites; + // (undocumented) + sapInstances: SapInstances; + // (undocumented) + serverInstances: ServerInstances; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface WorkloadsClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/sample.env b/sdk/migrationdiscovery/arm-migrationdiscoverysap/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/operationsListSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/operationsListSample.ts new file mode 100644 index 000000000000..5d1b6c131d96 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json + */ +async function listTheOperationsForTheProvider() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listTheOperationsForTheProvider(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesCreateSample.ts new file mode 100644 index 000000000000..8aca755392b6 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesCreateSample.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 { + SAPDiscoverySite, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * + * @summary Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json + */ +async function createResourceForImportBasedInput() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const resource: SAPDiscoverySite = { + location: "eastus", + properties: { + masterSiteId: "MasterSiteIdResourceId", + migrateProjectId: "MigrateProjectId", + }, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + resource, + ); + console.log(result); +} + +async function main() { + createResourceForImportBasedInput(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesDeleteSample.ts new file mode 100644 index 000000000000..2c17159b0933 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * + * @summary Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json + */ +async function deletesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + deletesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesGetSample.ts new file mode 100644 index 000000000000..622a10c833c7 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a SAP Migration discovery site resource. + * + * @summary Gets a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json + */ +async function getASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.get( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + getASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesImportEntitiesSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesImportEntitiesSample.ts new file mode 100644 index 000000000000..052a7aeb8883 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesImportEntitiesSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * + * @summary Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json + */ +async function importASapMigrationDiscoverySiteResourceAndItChildResources() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginImportEntitiesAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + importASapMigrationDiscoverySiteResourceAndItChildResources(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListByResourceGroupSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListByResourceGroupSample.ts new file mode 100644 index 000000000000..17d88816b6c3 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListByResourceGroupSample.ts @@ -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. +import { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Resource Group. + * + * @summary Gets all SAP Migration discovery site resources in a Resource Group. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json + */ +async function listSapMigrationDiscoverySiteResourcesByResourceGroup() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listByResourceGroup( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListBySubscriptionSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListBySubscriptionSample.ts new file mode 100644 index 000000000000..ff7a62606645 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesListBySubscriptionSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Subscription. + * + * @summary Gets all SAP Migration discovery site resources in a Subscription. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json + */ +async function listSapMigrationDiscoverySiteResourcesInASubscription() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesUpdateSample.ts new file mode 100644 index 000000000000..4285683cc811 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapDiscoverySitesUpdateSample.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 { + SAPDiscoverySiteTagsUpdate, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a SAP Migration discovery site resource. + * + * @summary Updates a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json + */ +async function updatesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const properties: SAPDiscoverySiteTagsUpdate = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.update( + resourceGroupName, + sapDiscoverySiteName, + properties, + ); + console.log(result); +} + +async function main() { + updatesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesCreateSample.ts new file mode 100644 index 000000000000..58d62b21b95e --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesCreateSample.ts @@ -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. +import { SAPInstance, WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json + */ +async function createsTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const resource: SAPInstance = { + location: "eastus", + properties: {}, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesDeleteSample.ts new file mode 100644 index 000000000000..01e0af3cd9c7 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json + */ +async function deletesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesGetSample.ts new file mode 100644 index 000000000000..5dc9d367f7cb --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the SAP Instance resource. + * + * @summary Gets the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json + */ +async function getASapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + getASapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesListBySapDiscoverySiteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesListBySapDiscoverySiteSample.ts new file mode 100644 index 000000000000..b97aba0c6f24 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesListBySapDiscoverySiteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * + * @summary Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json + */ +async function listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapInstances.listBySapDiscoverySite( + resourceGroupName, + sapDiscoverySiteName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesUpdateSample.ts new file mode 100644 index 000000000000..b35468a4b828 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/sapInstancesUpdateSample.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 { + SAPInstanceTagsUpdate, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates the SAP Instance resource. + * + * @summary Updates the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json + */ +async function updatesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const properties: SAPInstanceTagsUpdate = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesCreateSample.ts new file mode 100644 index 000000000000..01d7859652b1 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesCreateSample.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 { + ServerInstance, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json + */ +async function createsTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const resource: ServerInstance = {}; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesDeleteSample.ts new file mode 100644 index 000000000000..8f748bd0c09b --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json + */ +async function deletesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesGetSample.ts new file mode 100644 index 000000000000..7fd253e47768 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the Server Instance resource. + * + * @summary Gets the Server Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json + */ +async function getAServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + getAServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesListBySapInstanceSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesListBySapInstanceSample.ts new file mode 100644 index 000000000000..4fc06986da3c --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesListBySapInstanceSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the Server Instance resources for the given SAP Instance resource. + * + * @summary Lists the Server Instance resources for the given SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json + */ +async function listsTheServerInstanceResourcesForTheGivenSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverInstances.listBySapInstance( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheServerInstanceResourcesForTheGivenSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesUpdateSample.ts new file mode 100644 index 000000000000..32df72a684d2 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples-dev/serverInstancesUpdateSample.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 { + UpdateServerInstanceRequest, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * + * @summary Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Update.json + */ +async function updatesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const properties: UpdateServerInstanceRequest = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/README.md b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..0347a28381a6 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/README.md @@ -0,0 +1,84 @@ +# 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** | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json | +| [sapDiscoverySitesCreateSample.js][sapdiscoverysitescreatesample] | Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json | +| [sapDiscoverySitesDeleteSample.js][sapdiscoverysitesdeletesample] | Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json | +| [sapDiscoverySitesGetSample.js][sapdiscoverysitesgetsample] | Gets a SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json | +| [sapDiscoverySitesImportEntitiesSample.js][sapdiscoverysitesimportentitiessample] | Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json | +| [sapDiscoverySitesListByResourceGroupSample.js][sapdiscoverysiteslistbyresourcegroupsample] | Gets all SAP Migration discovery site resources in a Resource Group. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json | +| [sapDiscoverySitesListBySubscriptionSample.js][sapdiscoverysiteslistbysubscriptionsample] | Gets all SAP Migration discovery site resources in a Subscription. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json | +| [sapDiscoverySitesUpdateSample.js][sapdiscoverysitesupdatesample] | Updates a SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json | +| [sapInstancesCreateSample.js][sapinstancescreatesample] | Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json | +| [sapInstancesDeleteSample.js][sapinstancesdeletesample] | Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json | +| [sapInstancesGetSample.js][sapinstancesgetsample] | Gets the SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json | +| [sapInstancesListBySapDiscoverySiteSample.js][sapinstanceslistbysapdiscoverysitesample] | Lists the SAP Instance resources for the given SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json | +| [sapInstancesUpdateSample.js][sapinstancesupdatesample] | Updates the SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json | +| [serverInstancesCreateSample.js][serverinstancescreatesample] | Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json | +| [serverInstancesDeleteSample.js][serverinstancesdeletesample] | Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json | +| [serverInstancesGetSample.js][serverinstancesgetsample] | Gets the Server Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json | +| [serverInstancesListBySapInstanceSample.js][serverinstanceslistbysapinstancesample] | Lists the Server Instance resources for the given SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json | +| [serverInstancesUpdateSample.js][serverinstancesupdatesample] | Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_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 operationsListSample.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 MIGRATIONDISCOVERY_SUBSCRIPTION_ID="" node operationsListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/operationsListSample.js +[sapdiscoverysitescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesCreateSample.js +[sapdiscoverysitesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesDeleteSample.js +[sapdiscoverysitesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesGetSample.js +[sapdiscoverysitesimportentitiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesImportEntitiesSample.js +[sapdiscoverysiteslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListByResourceGroupSample.js +[sapdiscoverysiteslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListBySubscriptionSample.js +[sapdiscoverysitesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesUpdateSample.js +[sapinstancescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesCreateSample.js +[sapinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesDeleteSample.js +[sapinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesGetSample.js +[sapinstanceslistbysapdiscoverysitesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesListBySapDiscoverySiteSample.js +[sapinstancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesUpdateSample.js +[serverinstancescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesCreateSample.js +[serverinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesDeleteSample.js +[serverinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesGetSample.js +[serverinstanceslistbysapinstancesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesListBySapInstanceSample.js +[serverinstancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/README.md diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/operationsListSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/operationsListSample.js new file mode 100644 index 000000000000..f887c86c4569 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json + */ +async function listTheOperationsForTheProvider() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listTheOperationsForTheProvider(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/package.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..de9ab2dd0450 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-migrationdiscoverysap-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=18.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/migrationdiscovery/arm-migrationdiscoverysap" + }, + "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/migrationdiscovery/arm-migrationdiscoverysap", + "dependencies": { + "@azure/arm-migrationdiscoverysap": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + } +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sample.env b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesCreateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesCreateSample.js new file mode 100644 index 000000000000..f8ae31e3d16e --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesCreateSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * + * @summary Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json + */ +async function createResourceForImportBasedInput() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const resource = { + location: "eastus", + properties: { + masterSiteId: "MasterSiteIdResourceId", + migrateProjectId: "MigrateProjectId", + }, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + resource, + ); + console.log(result); +} + +async function main() { + createResourceForImportBasedInput(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesDeleteSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesDeleteSample.js new file mode 100644 index 000000000000..af1f06014b5b --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesDeleteSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * + * @summary Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json + */ +async function deletesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + deletesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesGetSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesGetSample.js new file mode 100644 index 000000000000..f6bb8047dcde --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesGetSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a SAP Migration discovery site resource. + * + * @summary Gets a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json + */ +async function getASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.get(resourceGroupName, sapDiscoverySiteName); + console.log(result); +} + +async function main() { + getASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesImportEntitiesSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesImportEntitiesSample.js new file mode 100644 index 000000000000..5382d7f049b4 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesImportEntitiesSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * + * @summary Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json + */ +async function importASapMigrationDiscoverySiteResourceAndItChildResources() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginImportEntitiesAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + importASapMigrationDiscoverySiteResourceAndItChildResources(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListByResourceGroupSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListByResourceGroupSample.js new file mode 100644 index 000000000000..a0deece41b30 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListByResourceGroupSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Resource Group. + * + * @summary Gets all SAP Migration discovery site resources in a Resource Group. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json + */ +async function listSapMigrationDiscoverySiteResourcesByResourceGroup() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListBySubscriptionSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListBySubscriptionSample.js new file mode 100644 index 000000000000..086d3af95a93 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesListBySubscriptionSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Subscription. + * + * @summary Gets all SAP Migration discovery site resources in a Subscription. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json + */ +async function listSapMigrationDiscoverySiteResourcesInASubscription() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesUpdateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesUpdateSample.js new file mode 100644 index 000000000000..8ed8293d8200 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapDiscoverySitesUpdateSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates a SAP Migration discovery site resource. + * + * @summary Updates a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json + */ +async function updatesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const properties = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.update( + resourceGroupName, + sapDiscoverySiteName, + properties, + ); + console.log(result); +} + +async function main() { + updatesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesCreateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesCreateSample.js new file mode 100644 index 000000000000..97e6e85dc5a5 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesCreateSample.js @@ -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. +const { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json + */ +async function createsTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const resource = { + location: "eastus", + properties: {}, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesDeleteSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesDeleteSample.js new file mode 100644 index 000000000000..b97641581681 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesDeleteSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json + */ +async function deletesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesGetSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesGetSample.js new file mode 100644 index 000000000000..58b7e03325e0 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesGetSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the SAP Instance resource. + * + * @summary Gets the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json + */ +async function getASapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + getASapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesListBySapDiscoverySiteSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesListBySapDiscoverySiteSample.js new file mode 100644 index 000000000000..aa678c0bcc92 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesListBySapDiscoverySiteSample.js @@ -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. +const { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * + * @summary Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json + */ +async function listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapInstances.listBySapDiscoverySite( + resourceGroupName, + sapDiscoverySiteName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesUpdateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesUpdateSample.js new file mode 100644 index 000000000000..a176cbbab2a3 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/sapInstancesUpdateSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates the SAP Instance resource. + * + * @summary Updates the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json + */ +async function updatesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const properties = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesCreateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesCreateSample.js new file mode 100644 index 000000000000..e064bfff182b --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesCreateSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json + */ +async function createsTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const resource = {}; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesDeleteSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesDeleteSample.js new file mode 100644 index 000000000000..1d63c78f06fa --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesDeleteSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json + */ +async function deletesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesGetSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesGetSample.js new file mode 100644 index 000000000000..d7bc4c974975 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesGetSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the Server Instance resource. + * + * @summary Gets the Server Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json + */ +async function getAServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + getAServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesListBySapInstanceSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesListBySapInstanceSample.js new file mode 100644 index 000000000000..0e503c15d199 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesListBySapInstanceSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists the Server Instance resources for the given SAP Instance resource. + * + * @summary Lists the Server Instance resources for the given SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json + */ +async function listsTheServerInstanceResourcesForTheGivenSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverInstances.listBySapInstance( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheServerInstanceResourcesForTheGivenSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesUpdateSample.js b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesUpdateSample.js new file mode 100644 index 000000000000..5ec72081d1a1 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/javascript/serverInstancesUpdateSample.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 { WorkloadsClient } = require("@azure/arm-migrationdiscoverysap"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * + * @summary Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Update.json + */ +async function updatesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const properties = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/README.md b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..8ea0ee1b85a5 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/README.md @@ -0,0 +1,97 @@ +# 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** | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json | +| [sapDiscoverySitesCreateSample.ts][sapdiscoverysitescreatesample] | Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json | +| [sapDiscoverySitesDeleteSample.ts][sapdiscoverysitesdeletesample] | Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json | +| [sapDiscoverySitesGetSample.ts][sapdiscoverysitesgetsample] | Gets a SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json | +| [sapDiscoverySitesImportEntitiesSample.ts][sapdiscoverysitesimportentitiessample] | Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json | +| [sapDiscoverySitesListByResourceGroupSample.ts][sapdiscoverysiteslistbyresourcegroupsample] | Gets all SAP Migration discovery site resources in a Resource Group. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json | +| [sapDiscoverySitesListBySubscriptionSample.ts][sapdiscoverysiteslistbysubscriptionsample] | Gets all SAP Migration discovery site resources in a Subscription. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json | +| [sapDiscoverySitesUpdateSample.ts][sapdiscoverysitesupdatesample] | Updates a SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json | +| [sapInstancesCreateSample.ts][sapinstancescreatesample] | Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json | +| [sapInstancesDeleteSample.ts][sapinstancesdeletesample] | Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json | +| [sapInstancesGetSample.ts][sapinstancesgetsample] | Gets the SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json | +| [sapInstancesListBySapDiscoverySiteSample.ts][sapinstanceslistbysapdiscoverysitesample] | Lists the SAP Instance resources for the given SAP Migration discovery site resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json | +| [sapInstancesUpdateSample.ts][sapinstancesupdatesample] | Updates the SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json | +| [serverInstancesCreateSample.ts][serverinstancescreatesample] | Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json | +| [serverInstancesDeleteSample.ts][serverinstancesdeletesample] | Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json | +| [serverInstancesGetSample.ts][serverinstancesgetsample] | Gets the Server Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json | +| [serverInstancesListBySapInstanceSample.ts][serverinstanceslistbysapinstancesample] | Lists the Server Instance resources for the given SAP Instance resource. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json | +| [serverInstancesUpdateSample.ts][serverinstancesupdatesample] | Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_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/operationsListSample.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 MIGRATIONDISCOVERY_SUBSCRIPTION_ID="" node dist/operationsListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/operationsListSample.ts +[sapdiscoverysitescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesCreateSample.ts +[sapdiscoverysitesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesDeleteSample.ts +[sapdiscoverysitesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesGetSample.ts +[sapdiscoverysitesimportentitiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesImportEntitiesSample.ts +[sapdiscoverysiteslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListByResourceGroupSample.ts +[sapdiscoverysiteslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListBySubscriptionSample.ts +[sapdiscoverysitesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesUpdateSample.ts +[sapinstancescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesCreateSample.ts +[sapinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesDeleteSample.ts +[sapinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesGetSample.ts +[sapinstanceslistbysapdiscoverysitesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesListBySapDiscoverySiteSample.ts +[sapinstancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesUpdateSample.ts +[serverinstancescreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesCreateSample.ts +[serverinstancesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesDeleteSample.ts +[serverinstancesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesGetSample.ts +[serverinstanceslistbysapinstancesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesListBySapInstanceSample.ts +[serverinstancesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-migrationdiscoverysap?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/migrationdiscovery/arm-migrationdiscoverysap/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/package.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..084fc237109d --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-migrationdiscoverysap-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=18.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/migrationdiscovery/arm-migrationdiscoverysap" + }, + "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/migrationdiscovery/arm-migrationdiscoverysap", + "dependencies": { + "@azure/arm-migrationdiscoverysap": "next", + "dotenv": "latest", + "@azure/identity": "^4.0.1" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "typescript": "~5.3.3", + "rimraf": "latest" + } +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/sample.env b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..5d1b6c131d96 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List the operations for the provider + * + * @summary List the operations for the provider + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/operations/preview/2023-10-01-preview/examples/Operations_List.json + */ +async function listTheOperationsForTheProvider() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listTheOperationsForTheProvider(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesCreateSample.ts new file mode 100644 index 000000000000..8aca755392b6 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesCreateSample.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 { + SAPDiscoverySite, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * + * @summary Creates a discovery site resource for SAP Migration. This resource will be used to run system discovery and assessment with Azure Migrate. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Create.json + */ +async function createResourceForImportBasedInput() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const resource: SAPDiscoverySite = { + location: "eastus", + properties: { + masterSiteId: "MasterSiteIdResourceId", + migrateProjectId: "MigrateProjectId", + }, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + resource, + ); + console.log(result); +} + +async function main() { + createResourceForImportBasedInput(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesDeleteSample.ts new file mode 100644 index 000000000000..2c17159b0933 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * + * @summary Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Delete.json + */ +async function deletesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + deletesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesGetSample.ts new file mode 100644 index 000000000000..622a10c833c7 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a SAP Migration discovery site resource. + * + * @summary Gets a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Get.json + */ +async function getASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.get( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + getASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesImportEntitiesSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesImportEntitiesSample.ts new file mode 100644 index 000000000000..052a7aeb8883 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesImportEntitiesSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * + * @summary Import your SAP systems' inventory using the [Discovery template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site resource and it's child resources, the SAP instances and Server instances. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ImportEntities.json + */ +async function importASapMigrationDiscoverySiteResourceAndItChildResources() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.beginImportEntitiesAndWait( + resourceGroupName, + sapDiscoverySiteName, + ); + console.log(result); +} + +async function main() { + importASapMigrationDiscoverySiteResourceAndItChildResources(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListByResourceGroupSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListByResourceGroupSample.ts new file mode 100644 index 000000000000..17d88816b6c3 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListByResourceGroupSample.ts @@ -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. +import { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Resource Group. + * + * @summary Gets all SAP Migration discovery site resources in a Resource Group. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListByResourceGroup.json + */ +async function listSapMigrationDiscoverySiteResourcesByResourceGroup() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listByResourceGroup( + resourceGroupName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListBySubscriptionSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListBySubscriptionSample.ts new file mode 100644 index 000000000000..ff7a62606645 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesListBySubscriptionSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all SAP Migration discovery site resources in a Subscription. + * + * @summary Gets all SAP Migration discovery site resources in a Subscription. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_ListBySubscription.json + */ +async function listSapMigrationDiscoverySiteResourcesInASubscription() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapDiscoverySites.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listSapMigrationDiscoverySiteResourcesInASubscription(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesUpdateSample.ts new file mode 100644 index 000000000000..4285683cc811 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapDiscoverySitesUpdateSample.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 { + SAPDiscoverySiteTagsUpdate, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates a SAP Migration discovery site resource. + * + * @summary Updates a SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPDiscoverySites_Update.json + */ +async function updatesASapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const properties: SAPDiscoverySiteTagsUpdate = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapDiscoverySites.update( + resourceGroupName, + sapDiscoverySiteName, + properties, + ); + console.log(result); +} + +async function main() { + updatesASapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesCreateSample.ts new file mode 100644 index 000000000000..58d62b21b95e --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesCreateSample.ts @@ -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. +import { SAPInstance, WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Create.json + */ +async function createsTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const resource: SAPInstance = { + location: "eastus", + properties: {}, + tags: { property1: "value1", property2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesDeleteSample.ts new file mode 100644 index 000000000000..01e0af3cd9c7 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the SAP Instance resource.

This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Delete.json + */ +async function deletesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesGetSample.ts new file mode 100644 index 000000000000..5dc9d367f7cb --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the SAP Instance resource. + * + * @summary Gets the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Get.json + */ +async function getASapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + ); + console.log(result); +} + +async function main() { + getASapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesListBySapDiscoverySiteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesListBySapDiscoverySiteSample.ts new file mode 100644 index 000000000000..b97aba0c6f24 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesListBySapDiscoverySiteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * + * @summary Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_List.json + */ +async function listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.sapInstances.listBySapDiscoverySite( + resourceGroupName, + sapDiscoverySiteName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheSapInstanceResourcesForTheGivenSapMigrationDiscoverySiteResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesUpdateSample.ts new file mode 100644 index 000000000000..b35468a4b828 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/sapInstancesUpdateSample.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 { + SAPInstanceTagsUpdate, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates the SAP Instance resource. + * + * @summary Updates the SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/SAPInstances_Update.json + */ +async function updatesTheSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const properties: SAPInstanceTagsUpdate = { tags: { tag1: "value1" } }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.sapInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesCreateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesCreateSample.ts new file mode 100644 index 000000000000..01d7859652b1 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesCreateSample.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 { + ServerInstance, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * + * @summary Creates the Server Instance resource.

;This will be used by service only. PUT operation on this resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Create.json + */ +async function createsTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const resource: ServerInstance = {}; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginCreateAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + resource, + ); + console.log(result); +} + +async function main() { + createsTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesDeleteSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesDeleteSample.ts new file mode 100644 index 000000000000..8f748bd0c09b --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesDeleteSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * + * @summary Deletes the Server Instance resource.

;This will be used by service only. Delete operation on this resource by end user will return a Bad Request error. You can delete the parent resource, which is the SAP Migration discovery site resource, using the delete operation on it. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Delete.json + */ +async function deletesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.beginDeleteAndWait( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + deletesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesGetSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesGetSample.ts new file mode 100644 index 000000000000..7fd253e47768 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesGetSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the Server Instance resource. + * + * @summary Gets the Server Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Get.json + */ +async function getAServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.get( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + ); + console.log(result); +} + +async function main() { + getAServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesListBySapInstanceSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesListBySapInstanceSample.ts new file mode 100644 index 000000000000..4fc06986da3c --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesListBySapInstanceSample.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 { WorkloadsClient } from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists the Server Instance resources for the given SAP Instance resource. + * + * @summary Lists the Server Instance resources for the given SAP Instance resource. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_List.json + */ +async function listsTheServerInstanceResourcesForTheGivenSapInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverInstances.listBySapInstance( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + listsTheServerInstanceResourcesForTheGivenSapInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesUpdateSample.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesUpdateSample.ts new file mode 100644 index 000000000000..32df72a684d2 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/src/serverInstancesUpdateSample.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 { + UpdateServerInstanceRequest, + WorkloadsClient, +} from "@azure/arm-migrationdiscoverysap"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * + * @summary Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error. + * x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/SAPDiscoverySites/preview/2023-10-01-preview/examples/ServerInstances_Update.json + */ +async function updatesTheServerInstanceResource() { + const subscriptionId = + process.env["MIGRATIONDISCOVERY_SUBSCRIPTION_ID"] || + "6d875e77-e412-4d7d-9af4-8895278b4443"; + const resourceGroupName = + process.env["MIGRATIONDISCOVERY_RESOURCE_GROUP"] || "test-rg"; + const sapDiscoverySiteName = "SampleSite"; + const sapInstanceName = "MPP_MPP"; + const serverInstanceName = "APP_SapServer1"; + const properties: UpdateServerInstanceRequest = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new WorkloadsClient(credential, subscriptionId); + const result = await client.serverInstances.update( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + properties, + ); + console.log(result); +} + +async function main() { + updatesTheServerInstanceResource(); +} + +main().catch(console.error); diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/tsconfig.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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/migrationdiscovery/arm-migrationdiscoverysap/src/index.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/index.ts new file mode 100644 index 000000000000..f33285f16cda --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { WorkloadsClient } from "./workloadsClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/lroImpl.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/lroImpl.ts new file mode 100644 index 000000000000..b27f5ac7209b --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/lroImpl.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 { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike }, + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal, + }); + }, + }; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/index.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/index.ts new file mode 100644 index 000000000000..996dcc4d3640 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/index.ts @@ -0,0 +1,1015 @@ +/* + * 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 PerformanceDataUnion = + | PerformanceData + | ExcelPerformanceData + | NativePerformanceData; + +/** The response of a SAPDiscoverySite list operation. */ +export interface SAPDiscoverySiteListResult { + /** The SAPDiscoverySite items on this page */ + value: SAPDiscoverySite[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Defines the SAP Migration discovery site resource properties. */ +export interface SAPDiscoverySiteProperties { + /** The master site ID from Azure Migrate. */ + masterSiteId?: string; + /** The migrate project ID from Azure Migrate. */ + migrateProjectId?: string; + /** + * Defines the provisioning states. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Indicates any errors on the SAP Migration discovery site resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: SAPMigrateError; +} + +/** An error response from the SAP migrate resources. */ +export interface SAPMigrateError { + /** The SAP Discovery site resource error body. */ + properties?: ErrorDefinition; +} + +/** Error definition. */ +export interface ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Description of the error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * Description of the recommendation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recommendation?: string; + /** + * Internal error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDefinition[]; +} + +/** The extended location definition. */ +export interface ExtendedLocation { + /** The extended location type. */ + type: string; + /** The extended location name. */ + name: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The type used for updating tags in SAPDiscoverySite resources. */ +export interface SAPDiscoverySiteTagsUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The current status of an async operation. */ +export interface OperationStatusResult { + /** Fully qualified ID for the async operation. */ + id?: string; + /** Name of the async operation. */ + name?: string; + /** Operation status. */ + status: string; + /** Percent of the operation that is complete. */ + percentComplete?: number; + /** The start time of the operation. */ + startTime?: Date; + /** The end time of the operation. */ + endTime?: Date; + /** The operations list. */ + operations?: OperationStatusResult[]; + /** If present, details of the operation error. */ + error?: ErrorDetail; +} + +/** The response of a SAPInstance list operation. */ +export interface SAPInstanceListResult { + /** The SAPInstance items on this page */ + value: SAPInstance[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Defines the SAP Instance properties. */ +export interface SAPInstanceProperties { + /** + * This is the SID of SAP System. Keeping this not equal to ID as different landscapes can have repeated System SID IDs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemSid?: string; + /** + * The Environment; PRD, QA, DEV, etc to which SAP system belongs to. Select from the list of available dropdown values. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly environment?: SapInstanceEnvironment; + /** + * This is the SID of the production system in a landscape. An SAP system could itself be a production SID or a part of a landscape with a different Production SID. This field can be used to relate non-prod SIDs, other components, SID (WEBDISP) to the prod SID. Enter the value of Production SID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly landscapeSid?: string; + /** + * Enter a business function/department identifier to group multiple SIDs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly application?: string; + /** + * Defines the provisioning states. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Defines the errors related to SAP Instance resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: SAPMigrateError; +} + +/** The type used for updating tags in SAPInstance resources. */ +export interface SAPInstanceTagsUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The response of a ServerInstance list operation. */ +export interface ServerInstanceListResult { + /** The ServerInstance items on this page */ + value: ServerInstance[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Defines the SAP Instance properties. */ +export interface ServerInstanceProperties { + /** + * This is the Virtual Machine Name of the SAP system. Add all the virtual machines attached to an SAP system which you wish to migrate to Azure. Keeping this not equal to ID as for single tier all InstanceTypes would be on same server, leading to multiple resources with same servername. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serverName?: string; + /** + * Defines the type SAP instance on this server instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sapInstanceType?: SapInstanceType; + /** + * This is the Instance SID for ASCS/AP/DB instance. An SAP system with HANA database for example could have a different SID for database Instance than that of ASCS instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly instanceSid?: string; + /** + * This is the SAP Application Component; e.g. SAP S/4HANA 2022, SAP ERP ENHANCE PACKAGE. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sapProduct?: string; + /** + * Provide the product version of the SAP product. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sapProductVersion?: string; + /** + * This is Operating System on which the host server is running. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operatingSystem?: OperatingSystem; + /** + * Configuration data for this server instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly configurationData?: ConfigurationData; + /** + * Configuration data for this server instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly performanceData?: PerformanceDataUnion; + /** + * Defines the provisioning states. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * Defines the errors related to SAP Instance resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: SAPMigrateError; +} + +/** The SAP instance specific configuration data. */ +export interface ConfigurationData { + /** + * Provide the SAPS for each server of the SAP system. This should be a non-zero value. For example, 1000. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly saps?: number; + /** + * Provide the CPU value of the server. For example, 16, 32 etc. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cpu?: number; + /** + * Provide the CPU architecture type of the server. For example, Xeon Platinum 8171M, Xeon E5-2673 v3. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cpuType?: string; + /** + * Provide the CPU clock speed of the server in MHz. This should be a non-zero value. For example, 2100. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cpuInMhz?: number; + /** + * Provide the RAM of the server. This should be a non-zero value. For example, 256. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ram?: number; + /** + * Provide the HW manufacturer company of the server. For example, Microsoft Corporation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly hardwareManufacturer?: string; + /** + * Specify if the Hardware is a physical server or virtual machine. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly model?: string; + /** + * Provide the total disk volume capacity in GB. Add the disk volume for each individual disks and provide the total sum in this field. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalDiskSizeGB?: number; + /** + * Provide the total disk IOPS capacity. Add the disk volume for each individual disk and provide the sum total in this field. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalDiskIops?: number; + /** + * The database of this is a server instance. Applicable only if SAP instance type for this server instance is 'DB'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly databaseType?: DatabaseType; + /** + * Provide the target HANA database size you need. Applicable only if SAP instance type for this server instance is 'DB' and you are migrating an AnyDb database to SAP S/4HANA. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetHanaRamSizeGB?: number; +} + +/** The SAP instance specific performance data. */ +export interface PerformanceData { + /** Polymorphic discriminator, which specifies the different types this object can be */ + dataSource: "Excel" | "Native"; +} + +/** Defines the request body for updating Server Instances resource. */ +export interface UpdateServerInstanceRequest { + /** Server instances properties. */ + properties?: ServerInstanceProperties; +} + +/** 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; +} + +/** 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 {} + +/** The SAP instance specific performance data for Excel import. */ +export interface ExcelPerformanceData extends PerformanceData { + /** Polymorphic discriminator, which specifies the different types this object can be */ + dataSource: "Excel"; + /** + * Provide the max CPU percentage load on the server. Omit the percentage symbol while filling this value. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly maxCpuLoad?: number; + /** + * Provide the source Database size in GB. Applicable only if SAP instance type for this server instance is 'DB'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalSourceDbSizeGB?: number; +} + +/** The SAP instance specific performance data for native discovery. */ +export interface NativePerformanceData extends PerformanceData { + /** Polymorphic discriminator, which specifies the different types this object can be */ + dataSource: "Native"; +} + +/** Define the SAP Migration discovery site resource. */ +export interface SAPDiscoverySite extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: SAPDiscoverySiteProperties; + /** The extended location definition. */ + extendedLocation?: ExtendedLocation; +} + +/** Define the SAP Instance resource. */ +export interface SAPInstance extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: SAPInstanceProperties; +} + +/** Define the Server Instance resource. */ +export interface ServerInstance extends ProxyResource { + /** The resource-specific properties for this resource. */ + properties?: ServerInstanceProperties; +} + +/** Defines headers for SapDiscoverySites_create operation. */ +export interface SapDiscoverySitesCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for SapDiscoverySites_delete operation. */ +export interface SapDiscoverySitesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for SapDiscoverySites_importEntities operation. */ +export interface SapDiscoverySitesImportEntitiesHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for SapInstances_create operation. */ +export interface SapInstancesCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for SapInstances_delete operation. */ +export interface SapInstancesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for ServerInstances_create operation. */ +export interface ServerInstancesCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for ServerInstances_delete operation. */ +export interface ServerInstancesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** The provisioning state Succeeded. */ + Succeeded = "Succeeded", + /** The provisioning state Updating. */ + Updating = "Updating", + /** The provisioning state Failed. */ + Failed = "Failed", + /** The provisioning state Creating. */ + Creating = "Creating", + /** The provisioning state Cancelled. */ + Canceled = "Canceled", + /** The provisioning state Accepted. */ + Accepted = "Accepted", + /** The provisioning state Deleting. */ + Deleting = "Deleting", + /** The provisioning state Unknown. */ + Unknown = "Unknown", +} + +/** + * 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**: The provisioning state Succeeded. \ + * **Updating**: The provisioning state Updating. \ + * **Failed**: The provisioning state Failed. \ + * **Creating**: The provisioning state Creating. \ + * **Canceled**: The provisioning state Cancelled. \ + * **Accepted**: The provisioning state Accepted. \ + * **Deleting**: The provisioning state Deleting. \ + * **Unknown**: The provisioning state Unknown. + */ +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 SapInstanceEnvironment} that the service accepts. */ +export enum KnownSapInstanceEnvironment { + /** The type of Sap Instance Environment- Production. */ + Production = "Production", + /** The type of Sap Instance Environment- PreProduction. */ + PreProduction = "PreProduction", + /** The type of Sap Instance Environment- Test. */ + Test = "Test", + /** The type of Sap Instance Environment- QualityAssurance. */ + QualityAssurance = "QualityAssurance", + /** The type of Sap Instance Environment- Development. */ + Development = "Development", + /** The type of Sap Instance Environment- Sandbox. */ + Sandbox = "Sandbox", + /** The type of Sap Instance Environment- DisasterRecovery. */ + DisasterRecovery = "DisasterRecovery", + /** The type of Sap Instance Environment- Training. */ + Training = "Training", +} + +/** + * Defines values for SapInstanceEnvironment. \ + * {@link KnownSapInstanceEnvironment} can be used interchangeably with SapInstanceEnvironment, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Production**: The type of Sap Instance Environment- Production. \ + * **PreProduction**: The type of Sap Instance Environment- PreProduction. \ + * **Test**: The type of Sap Instance Environment- Test. \ + * **QualityAssurance**: The type of Sap Instance Environment- QualityAssurance. \ + * **Development**: The type of Sap Instance Environment- Development. \ + * **Sandbox**: The type of Sap Instance Environment- Sandbox. \ + * **DisasterRecovery**: The type of Sap Instance Environment- DisasterRecovery. \ + * **Training**: The type of Sap Instance Environment- Training. + */ +export type SapInstanceEnvironment = string; + +/** Known values of {@link SapInstanceType} that the service accepts. */ +export enum KnownSapInstanceType { + /** The type of Sap Instance- ASCS. */ + Ascs = "ASCS", + /** The type of Sap Instance- DB. */ + DB = "DB", + /** The type of Sap Instance- APP. */ + APP = "APP", + /** The type of Sap Instance- SCS. */ + SCS = "SCS", + /** The type of Sap Instance- WEBDISP. */ + Webdisp = "WEBDISP", +} + +/** + * Defines values for SapInstanceType. \ + * {@link KnownSapInstanceType} can be used interchangeably with SapInstanceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ASCS**: The type of Sap Instance- ASCS. \ + * **DB**: The type of Sap Instance- DB. \ + * **APP**: The type of Sap Instance- APP. \ + * **SCS**: The type of Sap Instance- SCS. \ + * **WEBDISP**: The type of Sap Instance- WEBDISP. + */ +export type SapInstanceType = string; + +/** Known values of {@link OperatingSystem} that the service accepts. */ +export enum KnownOperatingSystem { + /** The type of Operating system- IBMAIX. */ + Ibmaix = "IBMAIX", + /** The type of Operating system- RedHat. */ + RedHat = "RedHat", + /** The type of Operating system- SUSE. */ + Suse = "SUSE", + /** The type of Operating system- Solaris. */ + Solaris = "Solaris", + /** The type of Operating system- Unix. */ + Unix = "Unix", + /** The type of Operating system- WindowsServer. */ + WindowsServer = "WindowsServer", +} + +/** + * Defines values for OperatingSystem. \ + * {@link KnownOperatingSystem} can be used interchangeably with OperatingSystem, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IBMAIX**: The type of Operating system- IBMAIX. \ + * **RedHat**: The type of Operating system- RedHat. \ + * **SUSE**: The type of Operating system- SUSE. \ + * **Solaris**: The type of Operating system- Solaris. \ + * **Unix**: The type of Operating system- Unix. \ + * **WindowsServer**: The type of Operating system- WindowsServer. + */ +export type OperatingSystem = string; + +/** Known values of {@link DatabaseType} that the service accepts. */ +export enum KnownDatabaseType { + /** The type of Database- Adabas. */ + Adabas = "Adabas", + /** The type of Database- Oracle. */ + Oracle = "Oracle", + /** The type of Database- SAPMaxDB. */ + SAPMaxDB = "SAPMaxDB", + /** The type of Database- Db2. */ + Db2 = "Db2", + /** The type of Database- SAPASE. */ + Sapase = "SAPASE", + /** The type of Database- SQLServer. */ + SQLServer = "SQLServer", + /** The type of Database- Informix. */ + Informix = "Informix", + /** The type of Database- SAPDB. */ + Sapdb = "SAPDB", + /** The type of Database- HANA. */ + Hana = "HANA", +} + +/** + * Defines values for DatabaseType. \ + * {@link KnownDatabaseType} can be used interchangeably with DatabaseType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Adabas**: The type of Database- Adabas. \ + * **Oracle**: The type of Database- Oracle. \ + * **SAPMaxDB**: The type of Database- SAPMaxDB. \ + * **Db2**: The type of Database- Db2. \ + * **SAPASE**: The type of Database- SAPASE. \ + * **SQLServer**: The type of Database- SQLServer. \ + * **Informix**: The type of Database- Informix. \ + * **SAPDB**: The type of Database- SAPDB. \ + * **HANA**: The type of Database- HANA. + */ +export type DatabaseType = string; + +/** Known values of {@link DataSource} that the service accepts. */ +export enum KnownDataSource { + /** The type of DataSource- Excel. */ + Excel = "Excel", + /** The type of DataSource- Native. */ + Native = "Native", +} + +/** + * Defines values for DataSource. \ + * {@link KnownDataSource} can be used interchangeably with DataSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Excel**: The type of DataSource- Excel. \ + * **Native**: The type of DataSource- Native. + */ +export type DataSource = string; + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system", +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal", +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link Versions} that the service accepts. */ +export enum KnownVersions { + /** The 2023-10-01-preview API version. */ + V20231001Preview = "2023-10-01-preview", +} + +/** + * Defines values for Versions. \ + * {@link KnownVersions} can be used interchangeably with Versions, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **2023-10-01-preview**: The 2023-10-01-preview API version. + */ +export type Versions = string; + +/** Optional parameters. */ +export interface SapDiscoverySitesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type SapDiscoverySitesListBySubscriptionResponse = + SAPDiscoverySiteListResult; + +/** Optional parameters. */ +export interface SapDiscoverySitesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type SapDiscoverySitesListByResourceGroupResponse = + SAPDiscoverySiteListResult; + +/** Optional parameters. */ +export interface SapDiscoverySitesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SapDiscoverySitesGetResponse = SAPDiscoverySite; + +/** Optional parameters. */ +export interface SapDiscoverySitesCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type SapDiscoverySitesCreateResponse = SAPDiscoverySite; + +/** Optional parameters. */ +export interface SapDiscoverySitesUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type SapDiscoverySitesUpdateResponse = SAPDiscoverySite; + +/** Optional parameters. */ +export interface SapDiscoverySitesDeleteOptionalParams + 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 SapDiscoverySitesImportEntitiesOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the importEntities operation. */ +export type SapDiscoverySitesImportEntitiesResponse = OperationStatusResult; + +/** Optional parameters. */ +export interface SapDiscoverySitesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type SapDiscoverySitesListBySubscriptionNextResponse = + SAPDiscoverySiteListResult; + +/** Optional parameters. */ +export interface SapDiscoverySitesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type SapDiscoverySitesListByResourceGroupNextResponse = + SAPDiscoverySiteListResult; + +/** Optional parameters. */ +export interface SapInstancesListBySapDiscoverySiteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySapDiscoverySite operation. */ +export type SapInstancesListBySapDiscoverySiteResponse = SAPInstanceListResult; + +/** Optional parameters. */ +export interface SapInstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SapInstancesGetResponse = SAPInstance; + +/** Optional parameters. */ +export interface SapInstancesCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type SapInstancesCreateResponse = SAPInstance; + +/** Optional parameters. */ +export interface SapInstancesUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type SapInstancesUpdateResponse = SAPInstance; + +/** Optional parameters. */ +export interface SapInstancesDeleteOptionalParams + 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 SapInstancesListBySapDiscoverySiteNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySapDiscoverySiteNext operation. */ +export type SapInstancesListBySapDiscoverySiteNextResponse = + SAPInstanceListResult; + +/** Optional parameters. */ +export interface ServerInstancesListBySapInstanceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySapInstance operation. */ +export type ServerInstancesListBySapInstanceResponse = ServerInstanceListResult; + +/** Optional parameters. */ +export interface ServerInstancesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ServerInstancesGetResponse = ServerInstance; + +/** Optional parameters. */ +export interface ServerInstancesCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type ServerInstancesCreateResponse = ServerInstance; + +/** Optional parameters. */ +export interface ServerInstancesUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ServerInstancesUpdateResponse = ServerInstance; + +/** Optional parameters. */ +export interface ServerInstancesDeleteOptionalParams + 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 ServerInstancesListBySapInstanceNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySapInstanceNext operation. */ +export type ServerInstancesListBySapInstanceNextResponse = + ServerInstanceListResult; + +/** 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 WorkloadsClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/mappers.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/mappers.ts new file mode 100644 index 000000000000..7dbf35d74137 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/mappers.ts @@ -0,0 +1,1123 @@ +/* + * 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 SAPDiscoverySiteListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPDiscoverySiteListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SAPDiscoverySite", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SAPDiscoverySiteProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPDiscoverySiteProperties", + modelProperties: { + masterSiteId: { + serializedName: "masterSiteId", + type: { + name: "String", + }, + }, + migrateProjectId: { + serializedName: "migrateProjectId", + type: { + name: "String", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + errors: { + serializedName: "errors", + type: { + name: "Composite", + className: "SAPMigrateError", + }, + }, + }, + }, +}; + +export const SAPMigrateError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPMigrateError", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ErrorDefinition", + }, + }, + }, + }, +}; + +export const ErrorDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDefinition", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String", + }, + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String", + }, + }, + recommendation: { + serializedName: "recommendation", + readOnly: true, + type: { + name: "String", + }, + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDefinition", + }, + }, + }, + }, + }, + }, +}; + +export const ExtendedLocation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedLocation", + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String", + }, + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String", + }, + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData", + }, + }, + }, + }, +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String", + }, + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String", + }, + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime", + }, + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String", + }, + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String", + }, + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime", + }, + }, + }, + }, +}; + +export const 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 SAPDiscoverySiteTagsUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPDiscoverySiteTagsUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + }, + }, +}; + +export const OperationStatusResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatusResult", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String", + }, + }, + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String", + }, + }, + percentComplete: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0, + }, + serializedName: "percentComplete", + type: { + name: "Number", + }, + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime", + }, + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime", + }, + }, + operations: { + serializedName: "operations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationStatusResult", + }, + }, + }, + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail", + }, + }, + }, + }, +}; + +export const SAPInstanceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPInstanceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SAPInstance", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SAPInstanceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPInstanceProperties", + modelProperties: { + systemSid: { + serializedName: "systemSid", + readOnly: true, + type: { + name: "String", + }, + }, + environment: { + serializedName: "environment", + readOnly: true, + type: { + name: "String", + }, + }, + landscapeSid: { + serializedName: "landscapeSid", + readOnly: true, + type: { + name: "String", + }, + }, + application: { + serializedName: "application", + readOnly: true, + type: { + name: "String", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + errors: { + serializedName: "errors", + type: { + name: "Composite", + className: "SAPMigrateError", + }, + }, + }, + }, +}; + +export const SAPInstanceTagsUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPInstanceTagsUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } }, + }, + }, + }, + }, +}; + +export const ServerInstanceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerInstanceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServerInstance", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ServerInstanceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerInstanceProperties", + modelProperties: { + serverName: { + serializedName: "serverName", + readOnly: true, + type: { + name: "String", + }, + }, + sapInstanceType: { + serializedName: "sapInstanceType", + readOnly: true, + type: { + name: "String", + }, + }, + instanceSid: { + serializedName: "instanceSid", + readOnly: true, + type: { + name: "String", + }, + }, + sapProduct: { + serializedName: "sapProduct", + readOnly: true, + type: { + name: "String", + }, + }, + sapProductVersion: { + serializedName: "sapProductVersion", + readOnly: true, + type: { + name: "String", + }, + }, + operatingSystem: { + serializedName: "operatingSystem", + readOnly: true, + type: { + name: "String", + }, + }, + configurationData: { + serializedName: "configurationData", + type: { + name: "Composite", + className: "ConfigurationData", + }, + }, + performanceData: { + serializedName: "performanceData", + type: { + name: "Composite", + className: "PerformanceData", + }, + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + errors: { + serializedName: "errors", + type: { + name: "Composite", + className: "SAPMigrateError", + }, + }, + }, + }, +}; + +export const ConfigurationData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfigurationData", + modelProperties: { + saps: { + serializedName: "saps", + readOnly: true, + type: { + name: "Number", + }, + }, + cpu: { + serializedName: "cpu", + readOnly: true, + type: { + name: "Number", + }, + }, + cpuType: { + serializedName: "cpuType", + readOnly: true, + type: { + name: "String", + }, + }, + cpuInMhz: { + serializedName: "cpuInMhz", + readOnly: true, + type: { + name: "Number", + }, + }, + ram: { + serializedName: "ram", + readOnly: true, + type: { + name: "Number", + }, + }, + hardwareManufacturer: { + serializedName: "hardwareManufacturer", + readOnly: true, + type: { + name: "String", + }, + }, + model: { + serializedName: "model", + readOnly: true, + type: { + name: "String", + }, + }, + totalDiskSizeGB: { + serializedName: "totalDiskSizeGB", + readOnly: true, + type: { + name: "Number", + }, + }, + totalDiskIops: { + serializedName: "totalDiskIops", + readOnly: true, + type: { + name: "Number", + }, + }, + databaseType: { + serializedName: "databaseType", + readOnly: true, + type: { + name: "String", + }, + }, + targetHanaRamSizeGB: { + serializedName: "targetHanaRamSizeGB", + readOnly: true, + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const PerformanceData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PerformanceData", + uberParent: "PerformanceData", + polymorphicDiscriminator: { + serializedName: "dataSource", + clientName: "dataSource", + }, + modelProperties: { + dataSource: { + serializedName: "dataSource", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const UpdateServerInstanceRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateServerInstanceRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ServerInstanceProperties", + }, + }, + }, + }, +}; + +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 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 ExcelPerformanceData: coreClient.CompositeMapper = { + serializedName: "Excel", + type: { + name: "Composite", + className: "ExcelPerformanceData", + uberParent: "PerformanceData", + polymorphicDiscriminator: PerformanceData.type.polymorphicDiscriminator, + modelProperties: { + ...PerformanceData.type.modelProperties, + maxCpuLoad: { + serializedName: "maxCpuLoad", + readOnly: true, + type: { + name: "Number", + }, + }, + totalSourceDbSizeGB: { + serializedName: "totalSourceDbSizeGB", + readOnly: true, + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const NativePerformanceData: coreClient.CompositeMapper = { + serializedName: "Native", + type: { + name: "Composite", + className: "NativePerformanceData", + uberParent: "PerformanceData", + polymorphicDiscriminator: PerformanceData.type.polymorphicDiscriminator, + modelProperties: { + ...PerformanceData.type.modelProperties, + }, + }, +}; + +export const SAPDiscoverySite: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPDiscoverySite", + modelProperties: { + ...TrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SAPDiscoverySiteProperties", + }, + }, + extendedLocation: { + serializedName: "extendedLocation", + type: { + name: "Composite", + className: "ExtendedLocation", + }, + }, + }, + }, +}; + +export const SAPInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SAPInstance", + modelProperties: { + ...TrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "SAPInstanceProperties", + }, + }, + }, + }, +}; + +export const ServerInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerInstance", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ServerInstanceProperties", + }, + }, + }, + }, +}; + +export const SapDiscoverySitesCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapDiscoverySitesCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const SapDiscoverySitesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapDiscoverySitesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const SapDiscoverySitesImportEntitiesHeaders: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "SapDiscoverySitesImportEntitiesHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const SapInstancesCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapInstancesCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const SapInstancesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SapInstancesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ServerInstancesCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerInstancesCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + }, + }, +}; + +export const ServerInstancesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerInstancesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number", + }, + }, + location: { + serializedName: "location", + type: { + name: "String", + }, + }, + }, + }, +}; + +export let discriminators = { + PerformanceData: PerformanceData, + "PerformanceData.Excel": ExcelPerformanceData, + "PerformanceData.Native": NativePerformanceData, +}; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/parameters.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/parameters.ts new file mode 100644 index 000000000000..29bd1996cc69 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/models/parameters.ts @@ -0,0 +1,182 @@ +/* + * 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 { + SAPDiscoverySite as SAPDiscoverySiteMapper, + SAPDiscoverySiteTagsUpdate as SAPDiscoverySiteTagsUpdateMapper, + SAPInstance as SAPInstanceMapper, + SAPInstanceTagsUpdate as SAPInstanceTagsUpdateMapper, + ServerInstance as ServerInstanceMapper, + UpdateServerInstanceRequest as UpdateServerInstanceRequestMapper, +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String", + }, + }, +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2023-10-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const 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 sapDiscoverySiteName: OperationURLParameter = { + parameterPath: "sapDiscoverySiteName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_-]{0,78}[a-zA-Z0-9_]$"), + }, + serializedName: "sapDiscoverySiteName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String", + }, + }, +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: SAPDiscoverySiteMapper, +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: SAPDiscoverySiteTagsUpdateMapper, +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const sapInstanceName: OperationURLParameter = { + parameterPath: "sapInstanceName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_-]{0,78}[a-zA-Z0-9_]$"), + }, + serializedName: "sapInstanceName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: SAPInstanceMapper, +}; + +export const properties1: OperationParameter = { + parameterPath: "properties", + mapper: SAPInstanceTagsUpdateMapper, +}; + +export const serverInstanceName: OperationURLParameter = { + parameterPath: "serverInstanceName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9][a-zA-Z0-9_-]{0,78}[a-zA-Z0-9_]$"), + }, + serializedName: "serverInstanceName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const resource2: OperationParameter = { + parameterPath: "resource", + mapper: ServerInstanceMapper, +}; + +export const properties2: OperationParameter = { + parameterPath: "properties", + mapper: UpdateServerInstanceRequestMapper, +}; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/index.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/index.ts new file mode 100644 index 000000000000..430b3186b571 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./sapDiscoverySites"; +export * from "./sapInstances"; +export * from "./serverInstances"; +export * from "./operations"; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/operations.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/operations.ts new file mode 100644 index 000000000000..51ed166f0d30 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { WorkloadsClient } from "../workloadsClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse, +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Workloads/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/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapDiscoverySites.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapDiscoverySites.ts new file mode 100644 index 000000000000..19f9df943836 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapDiscoverySites.ts @@ -0,0 +1,756 @@ +/* + * 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 { SapDiscoverySites } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + SAPDiscoverySite, + SapDiscoverySitesListBySubscriptionNextOptionalParams, + SapDiscoverySitesListBySubscriptionOptionalParams, + SapDiscoverySitesListBySubscriptionResponse, + SapDiscoverySitesListByResourceGroupNextOptionalParams, + SapDiscoverySitesListByResourceGroupOptionalParams, + SapDiscoverySitesListByResourceGroupResponse, + SapDiscoverySitesGetOptionalParams, + SapDiscoverySitesGetResponse, + SapDiscoverySitesCreateOptionalParams, + SapDiscoverySitesCreateResponse, + SAPDiscoverySiteTagsUpdate, + SapDiscoverySitesUpdateOptionalParams, + SapDiscoverySitesUpdateResponse, + SapDiscoverySitesDeleteOptionalParams, + SapDiscoverySitesImportEntitiesOptionalParams, + SapDiscoverySitesImportEntitiesResponse, + SapDiscoverySitesListBySubscriptionNextResponse, + SapDiscoverySitesListByResourceGroupNextResponse, +} from "../models"; + +/// +/** Class containing SapDiscoverySites operations. */ +export class SapDiscoverySitesImpl implements SapDiscoverySites { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class SapDiscoverySites class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Gets all SAP Migration discovery site resources in a Subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: SapDiscoverySitesListBySubscriptionOptionalParams, + ): 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?: SapDiscoverySitesListBySubscriptionOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: SapDiscoverySitesListBySubscriptionResponse; + 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?: SapDiscoverySitesListBySubscriptionOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Gets all SAP Migration discovery site resources in a Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: SapDiscoverySitesListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings, + ); + }, + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: SapDiscoverySitesListByResourceGroupOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: SapDiscoverySitesListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: SapDiscoverySitesListByResourceGroupOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options, + )) { + yield* page; + } + } + + /** + * Gets all SAP Migration discovery site resources in a Subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: SapDiscoverySitesListBySubscriptionOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec, + ); + } + + /** + * Gets all SAP Migration discovery site resources in a Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: SapDiscoverySitesListByResourceGroupOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec, + ); + } + + /** + * Gets a SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, options }, + getOperationSpec, + ); + } + + /** + * Creates a discovery site resource for SAP Migration. This resource will be used to run system + * discovery and assessment with Azure Migrate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + resource: SAPDiscoverySite, + options?: SapDiscoverySitesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapDiscoverySitesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, sapDiscoverySiteName, resource, options }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + SapDiscoverySitesCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates a discovery site resource for SAP Migration. This resource will be used to run system + * discovery and assessment with Azure Migrate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + resource: SAPDiscoverySite, + options?: SapDiscoverySitesCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + sapDiscoverySiteName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Updates a SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + properties: SAPDiscoverySiteTagsUpdate, + options?: SapDiscoverySitesUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, properties, options }, + updateOperationSpec, + ); + } + + /** + * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP + * Instances and Server Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesDeleteOptionalParams, + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, sapDiscoverySiteName, options }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP + * Instances and Server Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + sapDiscoverySiteName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Import your SAP systems' inventory using the [Discovery + * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site + * resource and it's child resources, the SAP instances and Server instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + async beginImportEntities( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesImportEntitiesOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapDiscoverySitesImportEntitiesResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, sapDiscoverySiteName, options }, + spec: importEntitiesOperationSpec, + }); + const poller = await createHttpPoller< + SapDiscoverySitesImportEntitiesResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Import your SAP systems' inventory using the [Discovery + * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site + * resource and it's child resources, the SAP instances and Server instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + async beginImportEntitiesAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesImportEntitiesOptionalParams, + ): Promise { + const poller = await this.beginImportEntities( + resourceGroupName, + sapDiscoverySiteName, + 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?: SapDiscoverySitesListBySubscriptionNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec, + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: SapDiscoverySitesListByResourceGroupNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/sapDiscoverySites", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySiteListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySiteListResult, + }, + 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.Workloads/sapDiscoverySites/{sapDiscoverySiteName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + 201: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + 202: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + 204: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySite, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const importEntitiesOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/importEntities", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatusResult, + }, + 201: { + bodyMapper: Mappers.OperationStatusResult, + }, + 202: { + bodyMapper: Mappers.OperationStatusResult, + }, + 204: { + bodyMapper: Mappers.OperationStatusResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySiteListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPDiscoverySiteListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapInstances.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapInstances.ts new file mode 100644 index 000000000000..083d89c54666 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/sapInstances.ts @@ -0,0 +1,567 @@ +/* + * 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 { SapInstances } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + SAPInstance, + SapInstancesListBySapDiscoverySiteNextOptionalParams, + SapInstancesListBySapDiscoverySiteOptionalParams, + SapInstancesListBySapDiscoverySiteResponse, + SapInstancesGetOptionalParams, + SapInstancesGetResponse, + SapInstancesCreateOptionalParams, + SapInstancesCreateResponse, + SAPInstanceTagsUpdate, + SapInstancesUpdateOptionalParams, + SapInstancesUpdateResponse, + SapInstancesDeleteOptionalParams, + SapInstancesListBySapDiscoverySiteNextResponse, +} from "../models"; + +/// +/** Class containing SapInstances operations. */ +export class SapInstancesImpl implements SapInstances { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class SapInstances class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + public listBySapDiscoverySite( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapInstancesListBySapDiscoverySiteOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySapDiscoverySitePagingAll( + resourceGroupName, + sapDiscoverySiteName, + 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.listBySapDiscoverySitePagingPage( + resourceGroupName, + sapDiscoverySiteName, + options, + settings, + ); + }, + }; + } + + private async *listBySapDiscoverySitePagingPage( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapInstancesListBySapDiscoverySiteOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: SapInstancesListBySapDiscoverySiteResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySapDiscoverySite( + resourceGroupName, + sapDiscoverySiteName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySapDiscoverySiteNext( + resourceGroupName, + sapDiscoverySiteName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySapDiscoverySitePagingAll( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapInstancesListBySapDiscoverySiteOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySapDiscoverySitePagingPage( + resourceGroupName, + sapDiscoverySiteName, + options, + )) { + yield* page; + } + } + + /** + * Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + private _listBySapDiscoverySite( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapInstancesListBySapDiscoverySiteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, options }, + listBySapDiscoverySiteOperationSpec, + ); + } + + /** + * Gets the SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, sapInstanceName, options }, + getOperationSpec, + ); + } + + /** + * Creates the SAP Instance resource.

This will be used by service only. PUT operation on this + * resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + resource: SAPInstance, + options?: SapInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapInstancesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + resource, + options, + }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + SapInstancesCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates the SAP Instance resource.

This will be used by service only. PUT operation on this + * resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + resource: SAPInstance, + options?: SapInstancesCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Updates the SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + properties: SAPInstanceTagsUpdate, + options?: SapInstancesUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + properties, + options, + }, + updateOperationSpec, + ); + } + + /** + * Deletes the SAP Instance resource.

This will be used by service only. Delete operation on + * this resource by end user will return a Bad Request error. You can delete the parent resource, which + * is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesDeleteOptionalParams, + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + options, + }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes the SAP Instance resource.

This will be used by service only. Delete operation on + * this resource by end user will return a Bad Request error. You can delete the parent resource, which + * is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListBySapDiscoverySiteNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param nextLink The nextLink from the previous successful call to the ListBySapDiscoverySite method. + * @param options The options parameters. + */ + private _listBySapDiscoverySiteNext( + resourceGroupName: string, + sapDiscoverySiteName: string, + nextLink: string, + options?: SapInstancesListBySapDiscoverySiteNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, nextLink, options }, + listBySapDiscoverySiteNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySapDiscoverySiteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.SAPInstance, + }, + 201: { + bodyMapper: Mappers.SAPInstance, + }, + 202: { + bodyMapper: Mappers.SAPInstance, + }, + 204: { + bodyMapper: Mappers.SAPInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.SAPInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySapDiscoverySiteNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SAPInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.nextLink, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/serverInstances.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/serverInstances.ts new file mode 100644 index 000000000000..83f3034fe2a3 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operations/serverInstances.ts @@ -0,0 +1,616 @@ +/* + * 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 { ServerInstances } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { WorkloadsClient } from "../workloadsClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller, +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + ServerInstance, + ServerInstancesListBySapInstanceNextOptionalParams, + ServerInstancesListBySapInstanceOptionalParams, + ServerInstancesListBySapInstanceResponse, + ServerInstancesGetOptionalParams, + ServerInstancesGetResponse, + ServerInstancesCreateOptionalParams, + ServerInstancesCreateResponse, + UpdateServerInstanceRequest, + ServerInstancesUpdateOptionalParams, + ServerInstancesUpdateResponse, + ServerInstancesDeleteOptionalParams, + ServerInstancesListBySapInstanceNextResponse, +} from "../models"; + +/// +/** Class containing ServerInstances operations. */ +export class ServerInstancesImpl implements ServerInstances { + private readonly client: WorkloadsClient; + + /** + * Initialize a new instance of the class ServerInstances class. + * @param client Reference to the service client + */ + constructor(client: WorkloadsClient) { + this.client = client; + } + + /** + * Lists the Server Instance resources for the given SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + public listBySapInstance( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: ServerInstancesListBySapInstanceOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listBySapInstancePagingAll( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + 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.listBySapInstancePagingPage( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + options, + settings, + ); + }, + }; + } + + private async *listBySapInstancePagingPage( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: ServerInstancesListBySapInstanceOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ServerInstancesListBySapInstanceResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySapInstance( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + options, + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySapInstanceNext( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySapInstancePagingAll( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: ServerInstancesListBySapInstanceOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listBySapInstancePagingPage( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + options, + )) { + yield* page; + } + } + + /** + * Lists the Server Instance resources for the given SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + private _listBySapInstance( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: ServerInstancesListBySapInstanceOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, sapDiscoverySiteName, sapInstanceName, options }, + listBySapInstanceOperationSpec, + ); + } + + /** + * Gets the Server Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + options, + }, + getOperationSpec, + ); + } + + /** + * Creates the Server Instance resource.

;This will be used by service only. PUT operation on + * this resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + resource: ServerInstance, + options?: ServerInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ServerInstancesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + resource, + options, + }, + spec: createOperationSpec, + }); + const poller = await createHttpPoller< + ServerInstancesCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation", + }); + await poller.poll(); + return poller; + } + + /** + * Creates the Server Instance resource.

;This will be used by service only. PUT operation on + * this resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + resource: ServerInstance, + options?: ServerInstancesCreateOptionalParams, + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + resource, + options, + ); + return poller.pollUntilDone(); + } + + /** + * Updates the Server Instance resource. This operation on a resource by end user will return a Bad + * Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + properties: UpdateServerInstanceRequest, + options?: ServerInstancesUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + properties, + options, + }, + updateOperationSpec, + ); + } + + /** + * Deletes the Server Instance resource.

;This will be used by service only. Delete operation + * on this resource by end user will return a Bad Request error. You can delete the parent resource, + * which is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesDeleteOptionalParams, + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec, + ) => { + let currentRawResponse: coreClient.FullOperationResponse | undefined = + undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown, + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback, + }, + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON(), + }, + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + options, + }, + spec: deleteOperationSpec, + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location", + }); + await poller.poll(); + return poller; + } + + /** + * Deletes the Server Instance resource.

;This will be used by service only. Delete operation + * on this resource by end user will return a Bad Request error. You can delete the parent resource, + * which is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesDeleteOptionalParams, + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + serverInstanceName, + options, + ); + return poller.pollUntilDone(); + } + + /** + * ListBySapInstanceNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param nextLink The nextLink from the previous successful call to the ListBySapInstance method. + * @param options The options parameters. + */ + private _listBySapInstanceNext( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + nextLink: string, + options?: ServerInstancesListBySapInstanceNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + sapDiscoverySiteName, + sapInstanceName, + nextLink, + options, + }, + listBySapInstanceNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySapInstanceOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}/serverInstances", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServerInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}/serverInstances/{serverInstanceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServerInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + Parameters.serverInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}/serverInstances/{serverInstanceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ServerInstance, + }, + 201: { + bodyMapper: Mappers.ServerInstance, + }, + 202: { + bodyMapper: Mappers.ServerInstance, + }, + 204: { + bodyMapper: Mappers.ServerInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.resource2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + Parameters.serverInstanceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}/serverInstances/{serverInstanceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ServerInstance, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.properties2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + Parameters.serverInstanceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapDiscoverySites/{sapDiscoverySiteName}/sapInstances/{sapInstanceName}/serverInstances/{serverInstanceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.sapInstanceName, + Parameters.serverInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listBySapInstanceNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ServerInstanceListResult, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.sapDiscoverySiteName, + Parameters.nextLink, + Parameters.sapInstanceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/index.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..430b3186b571 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./sapDiscoverySites"; +export * from "./sapInstances"; +export * from "./serverInstances"; +export * from "./operations"; diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/operations.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..251f5f582e64 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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 { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams, + ): PagedAsyncIterableIterator; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapDiscoverySites.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapDiscoverySites.ts new file mode 100644 index 000000000000..086cfd1df101 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapDiscoverySites.ts @@ -0,0 +1,158 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + SAPDiscoverySite, + SapDiscoverySitesListBySubscriptionOptionalParams, + SapDiscoverySitesListByResourceGroupOptionalParams, + SapDiscoverySitesGetOptionalParams, + SapDiscoverySitesGetResponse, + SapDiscoverySitesCreateOptionalParams, + SapDiscoverySitesCreateResponse, + SAPDiscoverySiteTagsUpdate, + SapDiscoverySitesUpdateOptionalParams, + SapDiscoverySitesUpdateResponse, + SapDiscoverySitesDeleteOptionalParams, + SapDiscoverySitesImportEntitiesOptionalParams, + SapDiscoverySitesImportEntitiesResponse, +} from "../models"; + +/// +/** Interface representing a SapDiscoverySites. */ +export interface SapDiscoverySites { + /** + * Gets all SAP Migration discovery site resources in a Subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: SapDiscoverySitesListBySubscriptionOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets all SAP Migration discovery site resources in a Resource Group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: SapDiscoverySitesListByResourceGroupOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets a SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesGetOptionalParams, + ): Promise; + /** + * Creates a discovery site resource for SAP Migration. This resource will be used to run system + * discovery and assessment with Azure Migrate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + resource: SAPDiscoverySite, + options?: SapDiscoverySitesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapDiscoverySitesCreateResponse + > + >; + /** + * Creates a discovery site resource for SAP Migration. This resource will be used to run system + * discovery and assessment with Azure Migrate. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + resource: SAPDiscoverySite, + options?: SapDiscoverySitesCreateOptionalParams, + ): Promise; + /** + * Updates a SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + properties: SAPDiscoverySiteTagsUpdate, + options?: SapDiscoverySitesUpdateOptionalParams, + ): Promise; + /** + * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP + * Instances and Server Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesDeleteOptionalParams, + ): Promise, void>>; + /** + * Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP + * Instances and Server Instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesDeleteOptionalParams, + ): Promise; + /** + * Import your SAP systems' inventory using the [Discovery + * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site + * resource and it's child resources, the SAP instances and Server instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + beginImportEntities( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesImportEntitiesOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapDiscoverySitesImportEntitiesResponse + > + >; + /** + * Import your SAP systems' inventory using the [Discovery + * template](https://go.microsoft.com/fwlink/?linkid=2249111) into your SAP Migration discovery site + * resource and it's child resources, the SAP instances and Server instances. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + beginImportEntitiesAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapDiscoverySitesImportEntitiesOptionalParams, + ): Promise; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapInstances.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapInstances.ts new file mode 100644 index 000000000000..649966d52250 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/sapInstances.ts @@ -0,0 +1,133 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + SAPInstance, + SapInstancesListBySapDiscoverySiteOptionalParams, + SapInstancesGetOptionalParams, + SapInstancesGetResponse, + SapInstancesCreateOptionalParams, + SapInstancesCreateResponse, + SAPInstanceTagsUpdate, + SapInstancesUpdateOptionalParams, + SapInstancesUpdateResponse, + SapInstancesDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a SapInstances. */ +export interface SapInstances { + /** + * Lists the SAP Instance resources for the given SAP Migration discovery site resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param options The options parameters. + */ + listBySapDiscoverySite( + resourceGroupName: string, + sapDiscoverySiteName: string, + options?: SapInstancesListBySapDiscoverySiteOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets the SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesGetOptionalParams, + ): Promise; + /** + * Creates the SAP Instance resource.

This will be used by service only. PUT operation on this + * resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + resource: SAPInstance, + options?: SapInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + SapInstancesCreateResponse + > + >; + /** + * Creates the SAP Instance resource.

This will be used by service only. PUT operation on this + * resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + resource: SAPInstance, + options?: SapInstancesCreateOptionalParams, + ): Promise; + /** + * Updates the SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + properties: SAPInstanceTagsUpdate, + options?: SapInstancesUpdateOptionalParams, + ): Promise; + /** + * Deletes the SAP Instance resource.

This will be used by service only. Delete operation on + * this resource by end user will return a Bad Request error. You can delete the parent resource, which + * is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesDeleteOptionalParams, + ): Promise, void>>; + /** + * Deletes the SAP Instance resource.

This will be used by service only. Delete operation on + * this resource by end user will return a Bad Request error. You can delete the parent resource, which + * is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: SapInstancesDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/serverInstances.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/serverInstances.ts new file mode 100644 index 000000000000..c8a4a319692f --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/operationsInterfaces/serverInstances.ts @@ -0,0 +1,148 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + ServerInstance, + ServerInstancesListBySapInstanceOptionalParams, + ServerInstancesGetOptionalParams, + ServerInstancesGetResponse, + ServerInstancesCreateOptionalParams, + ServerInstancesCreateResponse, + UpdateServerInstanceRequest, + ServerInstancesUpdateOptionalParams, + ServerInstancesUpdateResponse, + ServerInstancesDeleteOptionalParams, +} from "../models"; + +/// +/** Interface representing a ServerInstances. */ +export interface ServerInstances { + /** + * Lists the Server Instance resources for the given SAP Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param options The options parameters. + */ + listBySapInstance( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + options?: ServerInstancesListBySapInstanceOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Gets the Server Instance resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesGetOptionalParams, + ): Promise; + /** + * Creates the Server Instance resource.

;This will be used by service only. PUT operation on + * this resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + resource: ServerInstance, + options?: ServerInstancesCreateOptionalParams, + ): Promise< + SimplePollerLike< + OperationState, + ServerInstancesCreateResponse + > + >; + /** + * Creates the Server Instance resource.

;This will be used by service only. PUT operation on + * this resource by end user will return a Bad Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + resource: ServerInstance, + options?: ServerInstancesCreateOptionalParams, + ): Promise; + /** + * Updates the Server Instance resource. This operation on a resource by end user will return a Bad + * Request error. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + properties: UpdateServerInstanceRequest, + options?: ServerInstancesUpdateOptionalParams, + ): Promise; + /** + * Deletes the Server Instance resource.

;This will be used by service only. Delete operation + * on this resource by end user will return a Bad Request error. You can delete the parent resource, + * which is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesDeleteOptionalParams, + ): Promise, void>>; + /** + * Deletes the Server Instance resource.

;This will be used by service only. Delete operation + * on this resource by end user will return a Bad Request error. You can delete the parent resource, + * which is the SAP Migration discovery site resource, using the delete operation on it. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param sapDiscoverySiteName The name of the discovery site resource for SAP Migration. + * @param sapInstanceName The name of SAP Instance resource for SAP Migration. + * @param serverInstanceName The name of the Server instance resource for SAP Migration. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + sapDiscoverySiteName: string, + sapInstanceName: string, + serverInstanceName: string, + options?: ServerInstancesDeleteOptionalParams, + ): Promise; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/pagingHelper.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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/migrationdiscovery/arm-migrationdiscoverysap/src/workloadsClient.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/workloadsClient.ts new file mode 100644 index 000000000000..ba803ba24d92 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/src/workloadsClient.ts @@ -0,0 +1,157 @@ +/* + * 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 { + SapDiscoverySitesImpl, + SapInstancesImpl, + ServerInstancesImpl, + OperationsImpl, +} from "./operations"; +import { + SapDiscoverySites, + SapInstances, + ServerInstances, + Operations, +} from "./operationsInterfaces"; +import { WorkloadsClientOptionalParams } from "./models"; + +export class WorkloadsClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the WorkloadsClient 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?: WorkloadsClientOptionalParams, + ) { + 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: WorkloadsClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials, + }; + + const packageDetails = `azsdk-js-arm-migrationdiscoverysap/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 || "2023-10-01-preview"; + this.sapDiscoverySites = new SapDiscoverySitesImpl(this); + this.sapInstances = new SapInstancesImpl(this); + this.serverInstances = new ServerInstancesImpl(this); + this.operations = new OperationsImpl(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); + } + + sapDiscoverySites: SapDiscoverySites; + sapInstances: SapInstances; + serverInstances: ServerInstances; + operations: Operations; +} diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/test/migrationdiscoverysap_operations_test.spec.ts b/sdk/migrationdiscovery/arm-migrationdiscoverysap/test/migrationdiscoverysap_operations_test.spec.ts new file mode 100644 index 000000000000..2fe20e42ccd9 --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/test/migrationdiscoverysap_operations_test.spec.ts @@ -0,0 +1,69 @@ +/* + * 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 { WorkloadsClient } from "../src/workloadsClient"; + +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("Workloads Migrationdiscoverysap test", () => { + let recorder: Recorder; + let subscriptionId: string; + let client: WorkloadsClient; + let location: string; + let resourceGroup: string; + let resourcename: string; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + subscriptionId = env.SUBSCRIPTION_ID || ''; + // This is an example of how the environment variables are used + const credential = createTestCredential(); + client = new WorkloadsClient(credential, subscriptionId, recorder.configureClientOptions({})); + location = "eastus"; + resourceGroup = "myjstest"; + resourcename = "resourcetest"; + + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("operations list test", async function () { + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + assert.notEqual(resArray.length, 0); + }); + +}) diff --git a/sdk/migrationdiscovery/arm-migrationdiscoverysap/tsconfig.json b/sdk/migrationdiscovery/arm-migrationdiscoverysap/tsconfig.json new file mode 100644 index 000000000000..7e398f0cee7c --- /dev/null +++ b/sdk/migrationdiscovery/arm-migrationdiscoverysap/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-migrationdiscoverysap": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/migrationdiscovery/ci.mgmt.yml b/sdk/migrationdiscovery/ci.mgmt.yml new file mode 100644 index 000000000000..c9edb70a6433 --- /dev/null +++ b/sdk/migrationdiscovery/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/migrationdiscovery/arm-migrationdiscoverysap + - sdk/migrationdiscovery/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/migrationdiscovery/arm-migrationdiscoverysap + - sdk/migrationdiscovery/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: migrationdiscovery + Artifacts: + - name: azure-arm-migrationdiscoverysap + safeName: azurearmmigrationdiscoverysap + \ No newline at end of file