From 9028a02872a168483ac9d36e62a058b8e41accf4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 17 May 2022 18:54:23 +0000 Subject: [PATCH] CodeGen from PR 18645 in Azure/azure-rest-api-specs Merge 175becd090de4eb2cf3fffdfa002050915d9c23c into d55b8005f05b040b852c15e74a0f3e36494a15e1 --- .../arm-webservices/CHANGELOG.md | 27 --- .../arm-webservices/_meta.json | 10 +- .../arm-webservices/package.json | 22 +-- .../node/my_test/recording_sample_test.js | 5 - .../arm-webservices/sample.env | 4 - .../webServicesCreateOrUpdateSample.ts | 157 ----------------- ...bServicesCreateRegionalPropertiesSample.ts | 38 ---- .../samples-dev/webServicesGetSample.ts | 36 ---- .../webServicesListByResourceGroupSample.ts | 37 ---- .../webServicesListBySubscriptionIdSample.ts | 34 ---- .../samples-dev/webServicesListKeysSample.ts | 36 ---- .../samples-dev/webServicesPatchSample.ts | 48 ----- .../samples-dev/webServicesRemoveSample.ts | 36 ---- .../samples/v1/javascript/README.md | 64 ------- .../samples/v1/javascript/package.json | 32 ---- .../samples/v1/javascript/sample.env | 4 - .../webServicesCreateOrUpdateSample.js | 153 ---------------- ...bServicesCreateRegionalPropertiesSample.js | 35 ---- .../v1/javascript/webServicesGetSample.js | 30 ---- .../webServicesListByResourceGroupSample.js | 32 ---- .../webServicesListBySubscriptionIdSample.js | 31 ---- .../javascript/webServicesListKeysSample.js | 30 ---- .../v1/javascript/webServicesPatchSample.js | 42 ----- .../v1/javascript/webServicesRemoveSample.js | 30 ---- .../samples/v1/typescript/README.md | 77 -------- .../samples/v1/typescript/package.json | 41 ----- .../samples/v1/typescript/sample.env | 4 - .../src/webServicesCreateOrUpdateSample.ts | 166 ------------------ ...bServicesCreateRegionalPropertiesSample.ts | 38 ---- .../v1/typescript/src/webServicesGetSample.ts | 36 ---- .../webServicesListByResourceGroupSample.ts | 37 ---- .../webServicesListBySubscriptionIdSample.ts | 34 ---- .../src/webServicesListKeysSample.ts | 36 ---- .../typescript/src/webServicesPatchSample.ts | 48 ----- .../typescript/src/webServicesRemoveSample.ts | 36 ---- .../samples/v1/typescript/tsconfig.json | 17 -- .../src/azureMLWebServicesManagementClient.ts | 36 +++- .../arm-webservices/test/sampleTest.ts | 39 ++-- .../arm-webservices/tsconfig.json | 11 +- 39 files changed, 68 insertions(+), 1561 deletions(-) delete mode 100644 sdk/machinelearning/arm-webservices/CHANGELOG.md delete mode 100644 sdk/machinelearning/arm-webservices/recordings/node/my_test/recording_sample_test.js delete mode 100644 sdk/machinelearning/arm-webservices/sample.env delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateOrUpdateSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateRegionalPropertiesSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesGetSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesListByResourceGroupSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesListBySubscriptionIdSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesListKeysSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesPatchSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples-dev/webServicesRemoveSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/README.md delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/package.json delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/sample.env delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateOrUpdateSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateRegionalPropertiesSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesGetSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListByResourceGroupSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListBySubscriptionIdSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListKeysSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesPatchSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesRemoveSample.js delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/README.md delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/package.json delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/sample.env delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateOrUpdateSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateRegionalPropertiesSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesGetSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListByResourceGroupSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListBySubscriptionIdSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListKeysSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesPatchSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesRemoveSample.ts delete mode 100644 sdk/machinelearning/arm-webservices/samples/v1/typescript/tsconfig.json diff --git a/sdk/machinelearning/arm-webservices/CHANGELOG.md b/sdk/machinelearning/arm-webservices/CHANGELOG.md deleted file mode 100644 index e85528301eec..000000000000 --- a/sdk/machinelearning/arm-webservices/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Release History - -## 1.0.2 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.1 (2022-04-24) - -**Features** - - - Bug fix - -## 1.0.0 (2022-01-19) - -The package of @azure/arm-webservices is using our next generation design principles since version 1.0.0, which contains breaking changes. - -To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). - -To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). - -To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/machinelearning/arm-webservices/_meta.json b/sdk/machinelearning/arm-webservices/_meta.json index 6889a98dfb30..ae4272d6691a 100644 --- a/sdk/machinelearning/arm-webservices/_meta.json +++ b/sdk/machinelearning/arm-webservices/_meta.json @@ -1,8 +1,8 @@ { - "commit": "1b0a465061c68175898f8f5d27f0301f42ce994c", - "readme": "specification\\machinelearning\\resource-manager\\readme.md", - "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\work\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\machinelearning\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "d582068ad0e9e484c07a2cc0d7782c80f092fc70", + "readme": "specification/machinelearning/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/machinelearning/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", - "use": "@autorest/typescript@6.0.0-alpha.19.20220408.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" } \ No newline at end of file diff --git a/sdk/machinelearning/arm-webservices/package.json b/sdk/machinelearning/arm-webservices/package.json index db9800a1f049..6d8e3df32ece 100644 --- a/sdk/machinelearning/arm-webservices/package.json +++ b/sdk/machinelearning/arm-webservices/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureMLWebServicesManagementClient.", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=12.0.0" }, @@ -40,9 +40,11 @@ "uglify-js": "^3.4.9", "rimraf": "^3.0.0", "@azure/identity": "^2.0.1", - "@azure-tools/test-recorder": "^1.0.0", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2" + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/machinelearning/arm-webservices", "repository": { @@ -93,7 +95,7 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", "integration-test:browser": "echo skipped", "docs": "echo skipped" }, @@ -106,13 +108,5 @@ } ] }, - "autoPublish": true, - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-webservices?view=azure-node-preview" - } -} + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/machinelearning/arm-webservices/recordings/node/my_test/recording_sample_test.js b/sdk/machinelearning/arm-webservices/recordings/node/my_test/recording_sample_test.js deleted file mode 100644 index 0f6ecb857acf..000000000000 --- a/sdk/machinelearning/arm-webservices/recordings/node/my_test/recording_sample_test.js +++ /dev/null @@ -1,5 +0,0 @@ -let nock = require('nock'); - -module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; - -module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/machinelearning/arm-webservices/sample.env b/sdk/machinelearning/arm-webservices/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/machinelearning/arm-webservices/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateOrUpdateSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateOrUpdateSample.ts deleted file mode 100644 index 3e8ea365ce73..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateOrUpdateSample.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - WebService, - AzureMLWebServicesManagementClient -} from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * - * @summary Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/putWebService.json - */ -async function putWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const createOrUpdatePayload: WebService = { - location: "West US", - properties: { - description: "Web Service Description", - assets: { - asset1: { - name: "Execute R Script", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-1" } - }, - asset2: { - name: "Import Data", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-2" } - } - }, - commitmentPlan: { - id: - "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.MachineLearning/commitmentPlans/commitmentPlanName" - }, - diagnostics: { level: "None" }, - exampleRequest: { - globalParameters: {}, - inputs: { - input1: [] - } - }, - exposeSampleData: true, - input: { - type: "object", - description: "", - properties: { - input1: { - type: "object", - description: "", - properties: { - columnName: { type: "String", xMsIsnullable: false } - }, - title: "" - } - }, - title: "" - }, - machineLearningWorkspace: { id: "workspaceId" }, - output: { - type: "object", - description: "", - properties: { - output1: { - type: "object", - description: "", - properties: { - age: { type: "Integer", format: "Int32", xMsIsnullable: true }, - workclass: { type: "String", xMsIsnullable: false } - }, - title: "" - } - }, - title: "" - }, - package: { - edges: [ - { - sourceNodeId: "node2", - sourcePortId: "Results dataset", - targetNodeId: "node1", - targetPortId: "Dataset2" - }, - { - sourceNodeId: "node3", - targetNodeId: "node1", - targetPortId: "Dataset1" - }, - { - sourceNodeId: "node1", - sourcePortId: "Result Dataset", - targetNodeId: "node4" - } - ], - graphParameters: {}, - nodes: { - node1: { - assetId: "asset1", - parameters: { - rScript: { certificateThumbprint: "" }, - rVersion: { certificateThumbprint: "" } - } - }, - node2: { - assetId: "asset2", - parameters: { - accountKey: { - certificateThumbprint: "TheThumbprint" - }, - accountName: { certificateThumbprint: "" }, - pleaseSpecifyAuthenticationType: { - certificateThumbprint: "" - }, - pleaseSpecifyDataSource: { - certificateThumbprint: "" - } - } - }, - node3: { inputId: "input1" }, - node4: { outputId: "output1" } - } - }, - packageType: "Graph", - parameters: {}, - payloadsInBlobStorage: false, - readOnly: false, - realtimeConfiguration: { maxConcurrentCalls: 4 }, - storageAccount: { name: "Storage_Name", key: "Storage_Key" }, - title: "Web Service Title" - }, - tags: { tag1: "value1", tag2: "value2" } - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginCreateOrUpdateAndWait( - resourceGroupName, - webServiceName, - createOrUpdatePayload - ); - console.log(result); -} - -putWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateRegionalPropertiesSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateRegionalPropertiesSample.ts deleted file mode 100644 index 64978a64fdd4..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesCreateRegionalPropertiesSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * - * @summary Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/createRegionalProperties.json - */ -async function createRegionalProperties() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const region = "Southeast Asia"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginCreateRegionalPropertiesAndWait( - resourceGroupName, - webServiceName, - region - ); - console.log(result); -} - -createRegionalProperties().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesGetSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesGetSample.ts deleted file mode 100644 index f64f50a8ab6b..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesGetSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * - * @summary Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebService.json - */ -async function getWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.get( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -getWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListByResourceGroupSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesListByResourceGroupSample.ts deleted file mode 100644 index f6d6527f9489..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListByResourceGroupSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the web services in the specified resource group. - * - * @summary Gets the web services in the specified resource group. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesByResourceGroup.json - */ -async function getWebServicesByResourceGroup() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.webServices.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesByResourceGroup().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListBySubscriptionIdSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesListBySubscriptionIdSample.ts deleted file mode 100644 index e31a951032d0..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListBySubscriptionIdSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the web services in the specified subscription. - * - * @summary Gets the web services in the specified subscription. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesBySubscriptionId.json - */ -async function getWebServicesBySubscriptionId() { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.webServices.listBySubscriptionId()) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesBySubscriptionId().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListKeysSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesListKeysSample.ts deleted file mode 100644 index 2c6be64f44ae..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesListKeysSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the access keys for the specified web service. - * - * @summary Gets the access keys for the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServiceKeys.json - */ -async function getWebServiceKeys() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.listKeys( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -getWebServiceKeys().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesPatchSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesPatchSample.ts deleted file mode 100644 index db4da1b0ebed..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesPatchSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - PatchedWebService, - AzureMLWebServicesManagementClient -} from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * - * @summary Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/patchWebService.json - */ -async function patchWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const patchPayload: PatchedWebService = { - location: "West US", - properties: { - description: "New Web Service Description", - packageType: "Graph", - title: "New Web Service Title" - } - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginPatchAndWait( - resourceGroupName, - webServiceName, - patchPayload - ); - console.log(result); -} - -patchWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples-dev/webServicesRemoveSample.ts b/sdk/machinelearning/arm-webservices/samples-dev/webServicesRemoveSample.ts deleted file mode 100644 index 4d461697b8b1..000000000000 --- a/sdk/machinelearning/arm-webservices/samples-dev/webServicesRemoveSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Deletes the specified web service. - * - * @summary Deletes the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/deleteWebService.json - */ -async function deleteWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginRemoveAndWait( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -deleteWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/README.md b/sdk/machinelearning/arm-webservices/samples/v1/javascript/README.md deleted file mode 100644 index 7b2f93611dd4..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# client library samples for JavaScript - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [webServicesCreateOrUpdateSample.js][webservicescreateorupdatesample] | Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/putWebService.json | -| [webServicesCreateRegionalPropertiesSample.js][webservicescreateregionalpropertiessample] | Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/createRegionalProperties.json | -| [webServicesGetSample.js][webservicesgetsample] | Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebService.json | -| [webServicesListByResourceGroupSample.js][webserviceslistbyresourcegroupsample] | Gets the web services in the specified resource group. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesByResourceGroup.json | -| [webServicesListBySubscriptionIdSample.js][webserviceslistbysubscriptionidsample] | Gets the web services in the specified subscription. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesBySubscriptionId.json | -| [webServicesListKeysSample.js][webserviceslistkeyssample] | Gets the access keys for the specified web service. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServiceKeys.json | -| [webServicesPatchSample.js][webservicespatchsample] | Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/patchWebService.json | -| [webServicesRemoveSample.js][webservicesremovesample] | Deletes the specified web service. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/deleteWebService.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). - -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 webServicesCreateOrUpdateSample.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 node webServicesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[webservicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateOrUpdateSample.js -[webservicescreateregionalpropertiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateRegionalPropertiesSample.js -[webservicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesGetSample.js -[webserviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListByResourceGroupSample.js -[webserviceslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListBySubscriptionIdSample.js -[webserviceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListKeysSample.js -[webservicespatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesPatchSample.js -[webservicesremovesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesRemoveSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-webservices?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/machinelearning/arm-webservices/README.md diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/package.json b/sdk/machinelearning/arm-webservices/samples/v1/javascript/package.json deleted file mode 100644 index 5f7c1bd99198..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-webservices-js", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript", - "engines": { - "node": ">=12.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/machinelearning/arm-webservices" - }, - "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/machinelearning/arm-webservices", - "dependencies": { - "@azure/arm-webservices": "latest", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - } -} diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/sample.env b/sdk/machinelearning/arm-webservices/samples/v1/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateOrUpdateSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateOrUpdateSample.js deleted file mode 100644 index 9b58047c5812..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateOrUpdateSample.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * - * @summary Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/putWebService.json - */ -async function putWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const createOrUpdatePayload = { - location: "West US", - properties: { - description: "Web Service Description", - assets: { - asset1: { - name: "Execute R Script", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-1" }, - }, - asset2: { - name: "Import Data", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-2" }, - }, - }, - commitmentPlan: { - id: "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.MachineLearning/commitmentPlans/commitmentPlanName", - }, - diagnostics: { level: "None" }, - exampleRequest: { - globalParameters: {}, - inputs: { - input1: [["age"], ["workclass"], ["fnlwgt"], ["education"], ["education-num"]], - }, - }, - exposeSampleData: true, - input: { - type: "object", - description: "", - properties: { - input1: { - type: "object", - description: "", - properties: { - columnName: { type: "String", xMsIsnullable: false }, - }, - title: "", - }, - }, - title: "", - }, - machineLearningWorkspace: { id: "workspaceId" }, - output: { - type: "object", - description: "", - properties: { - output1: { - type: "object", - description: "", - properties: { - age: { type: "Integer", format: "Int32", xMsIsnullable: true }, - workclass: { type: "String", xMsIsnullable: false }, - }, - title: "", - }, - }, - title: "", - }, - package: { - edges: [ - { - sourceNodeId: "node2", - sourcePortId: "Results dataset", - targetNodeId: "node1", - targetPortId: "Dataset2", - }, - { - sourceNodeId: "node3", - targetNodeId: "node1", - targetPortId: "Dataset1", - }, - { - sourceNodeId: "node1", - sourcePortId: "Result Dataset", - targetNodeId: "node4", - }, - ], - graphParameters: {}, - nodes: { - node1: { - assetId: "asset1", - parameters: { - rScript: { certificateThumbprint: "", value: "The R Script" }, - rVersion: { certificateThumbprint: "", value: "CRAN R 3.1.0" }, - }, - }, - node2: { - assetId: "asset2", - parameters: { - accountKey: { - certificateThumbprint: "TheThumbprint", - value: "Encrypted Key", - }, - accountName: { certificateThumbprint: "", value: "accountName" }, - pleaseSpecifyAuthenticationType: { - certificateThumbprint: "", - value: "Account", - }, - pleaseSpecifyDataSource: { - certificateThumbprint: "", - value: "AzureBlobStorage", - }, - }, - }, - node3: { inputId: "input1" }, - node4: { outputId: "output1" }, - }, - }, - packageType: "Graph", - parameters: {}, - payloadsInBlobStorage: false, - readOnly: false, - realtimeConfiguration: { maxConcurrentCalls: 4 }, - storageAccount: { name: "Storage_Name", key: "Storage_Key" }, - title: "Web Service Title", - }, - tags: { tag1: "value1", tag2: "value2" }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.beginCreateOrUpdateAndWait( - resourceGroupName, - webServiceName, - createOrUpdatePayload - ); - console.log(result); -} - -putWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateRegionalPropertiesSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateRegionalPropertiesSample.js deleted file mode 100644 index 48a1f63a233e..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesCreateRegionalPropertiesSample.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * - * @summary Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/createRegionalProperties.json - */ -async function createRegionalProperties() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const region = "Southeast Asia"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.beginCreateRegionalPropertiesAndWait( - resourceGroupName, - webServiceName, - region - ); - console.log(result); -} - -createRegionalProperties().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesGetSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesGetSample.js deleted file mode 100644 index b38971207233..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesGetSample.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * - * @summary Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebService.json - */ -async function getWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.get(resourceGroupName, webServiceName); - console.log(result); -} - -getWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListByResourceGroupSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListByResourceGroupSample.js deleted file mode 100644 index 04468a5fe9e4..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListByResourceGroupSample.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Gets the web services in the specified resource group. - * - * @summary Gets the web services in the specified resource group. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesByResourceGroup.json - */ -async function getWebServicesByResourceGroup() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.webServices.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesByResourceGroup().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListBySubscriptionIdSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListBySubscriptionIdSample.js deleted file mode 100644 index b9a00d04f8f0..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListBySubscriptionIdSample.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Gets the web services in the specified subscription. - * - * @summary Gets the web services in the specified subscription. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesBySubscriptionId.json - */ -async function getWebServicesBySubscriptionId() { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.webServices.listBySubscriptionId()) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesBySubscriptionId().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListKeysSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListKeysSample.js deleted file mode 100644 index 5207c3468f28..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesListKeysSample.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Gets the access keys for the specified web service. - * - * @summary Gets the access keys for the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServiceKeys.json - */ -async function getWebServiceKeys() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.listKeys(resourceGroupName, webServiceName); - console.log(result); -} - -getWebServiceKeys().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesPatchSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesPatchSample.js deleted file mode 100644 index 7ef48e11e06a..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesPatchSample.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * - * @summary Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/patchWebService.json - */ -async function patchWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const patchPayload = { - location: "West US", - properties: { - description: "New Web Service Description", - packageType: "Graph", - title: "New Web Service Title", - }, - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.beginPatchAndWait( - resourceGroupName, - webServiceName, - patchPayload - ); - console.log(result); -} - -patchWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesRemoveSample.js b/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesRemoveSample.js deleted file mode 100644 index 1b8f85941b1c..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/javascript/webServicesRemoveSample.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureMLWebServicesManagementClient } = require("@azure/arm-webservices"); -const { DefaultAzureCredential } = require("@azure/identity"); - -/** - * This sample demonstrates how to Deletes the specified web service. - * - * @summary Deletes the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/deleteWebService.json - */ -async function deleteWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient(credential, subscriptionId); - const result = await client.webServices.beginRemoveAndWait(resourceGroupName, webServiceName); - console.log(result); -} - -deleteWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/README.md b/sdk/machinelearning/arm-webservices/samples/v1/typescript/README.md deleted file mode 100644 index d0be35e39000..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# client library samples for TypeScript - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [webServicesCreateOrUpdateSample.ts][webservicescreateorupdatesample] | Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/putWebService.json | -| [webServicesCreateRegionalPropertiesSample.ts][webservicescreateregionalpropertiessample] | Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/createRegionalProperties.json | -| [webServicesGetSample.ts][webservicesgetsample] | Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebService.json | -| [webServicesListByResourceGroupSample.ts][webserviceslistbyresourcegroupsample] | Gets the web services in the specified resource group. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesByResourceGroup.json | -| [webServicesListBySubscriptionIdSample.ts][webserviceslistbysubscriptionidsample] | Gets the web services in the specified subscription. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesBySubscriptionId.json | -| [webServicesListKeysSample.ts][webserviceslistkeyssample] | Gets the access keys for the specified web service. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServiceKeys.json | -| [webServicesPatchSample.ts][webservicespatchsample] | Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/patchWebService.json | -| [webServicesRemoveSample.ts][webservicesremovesample] | Deletes the specified web service. x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/deleteWebService.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). - -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/webServicesCreateOrUpdateSample.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 node dist/webServicesCreateOrUpdateSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[webservicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateOrUpdateSample.ts -[webservicescreateregionalpropertiessample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateRegionalPropertiesSample.ts -[webservicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesGetSample.ts -[webserviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListByResourceGroupSample.ts -[webserviceslistbysubscriptionidsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListBySubscriptionIdSample.ts -[webserviceslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListKeysSample.ts -[webservicespatchsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesPatchSample.ts -[webservicesremovesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesRemoveSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-webservices?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/machinelearning/arm-webservices/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/package.json b/sdk/machinelearning/arm-webservices/samples/v1/typescript/package.json deleted file mode 100644 index f1b1aa638a41..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-webservices-ts", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript", - "engines": { - "node": ">=12.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/machinelearning/arm-webservices" - }, - "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/machinelearning/arm-webservices", - "dependencies": { - "@azure/arm-webservices": "latest", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - }, - "devDependencies": { - "@types/node": "^12.0.0", - "typescript": "~4.4.0", - "rimraf": "latest" - } -} diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/sample.env b/sdk/machinelearning/arm-webservices/samples/v1/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateOrUpdateSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateOrUpdateSample.ts deleted file mode 100644 index ccbb3feeeadd..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateOrUpdateSample.ts +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - WebService, - AzureMLWebServicesManagementClient -} from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * - * @summary Create or update a web service. This call will overwrite an existing web service. Note that there is no warning or confirmation. This is a nonrecoverable operation. If your intent is to create a new web service, call the Get operation first to verify that it does not exist. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/putWebService.json - */ -async function putWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const createOrUpdatePayload: WebService = { - location: "West US", - properties: { - description: "Web Service Description", - assets: { - asset1: { - name: "Execute R Script", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-1" } - }, - asset2: { - name: "Import Data", - type: "Module", - locationInfo: { credentials: "", uri: "aml://module/moduleId-2" } - } - }, - commitmentPlan: { - id: - "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.MachineLearning/commitmentPlans/commitmentPlanName" - }, - diagnostics: { level: "None" }, - exampleRequest: { - globalParameters: {}, - inputs: { - input1: [ - ["age"], - ["workclass"], - ["fnlwgt"], - ["education"], - ["education-num"] - ] - } - }, - exposeSampleData: true, - input: { - type: "object", - description: "", - properties: { - input1: { - type: "object", - description: "", - properties: { - columnName: { type: "String", xMsIsnullable: false } - }, - title: "" - } - }, - title: "" - }, - machineLearningWorkspace: { id: "workspaceId" }, - output: { - type: "object", - description: "", - properties: { - output1: { - type: "object", - description: "", - properties: { - age: { type: "Integer", format: "Int32", xMsIsnullable: true }, - workclass: { type: "String", xMsIsnullable: false } - }, - title: "" - } - }, - title: "" - }, - package: { - edges: [ - { - sourceNodeId: "node2", - sourcePortId: "Results dataset", - targetNodeId: "node1", - targetPortId: "Dataset2" - }, - { - sourceNodeId: "node3", - targetNodeId: "node1", - targetPortId: "Dataset1" - }, - { - sourceNodeId: "node1", - sourcePortId: "Result Dataset", - targetNodeId: "node4" - } - ], - graphParameters: {}, - nodes: { - node1: { - assetId: "asset1", - parameters: { - rScript: { certificateThumbprint: "", value: "The R Script" }, - rVersion: { certificateThumbprint: "", value: "CRAN R 3.1.0" } - } - }, - node2: { - assetId: "asset2", - parameters: { - accountKey: { - certificateThumbprint: "TheThumbprint", - value: "Encrypted Key" - }, - accountName: { certificateThumbprint: "", value: "accountName" }, - pleaseSpecifyAuthenticationType: { - certificateThumbprint: "", - value: "Account" - }, - pleaseSpecifyDataSource: { - certificateThumbprint: "", - value: "AzureBlobStorage" - } - } - }, - node3: { inputId: "input1" }, - node4: { outputId: "output1" } - } - }, - packageType: "Graph", - parameters: {}, - payloadsInBlobStorage: false, - readOnly: false, - realtimeConfiguration: { maxConcurrentCalls: 4 }, - storageAccount: { name: "Storage_Name", key: "Storage_Key" }, - title: "Web Service Title" - }, - tags: { tag1: "value1", tag2: "value2" } - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginCreateOrUpdateAndWait( - resourceGroupName, - webServiceName, - createOrUpdatePayload - ); - console.log(result); -} - -putWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateRegionalPropertiesSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateRegionalPropertiesSample.ts deleted file mode 100644 index 64978a64fdd4..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesCreateRegionalPropertiesSample.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * - * @summary Creates an encrypted credentials parameter blob for the specified region. To get the web service from a region other than the region in which it has been created, you must first call Create Regional Web Services Properties to create a copy of the encrypted credential parameter blob in that region. You only need to do this before the first time that you get the web service in the new region. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/createRegionalProperties.json - */ -async function createRegionalProperties() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const region = "Southeast Asia"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginCreateRegionalPropertiesAndWait( - resourceGroupName, - webServiceName, - region - ); - console.log(result); -} - -createRegionalProperties().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesGetSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesGetSample.ts deleted file mode 100644 index f64f50a8ab6b..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesGetSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * - * @summary Gets the Web Service Definition as specified by a subscription, resource group, and name. Note that the storage credentials and web service keys are not returned by this call. To get the web service access keys, call List Keys. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebService.json - */ -async function getWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.get( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -getWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListByResourceGroupSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListByResourceGroupSample.ts deleted file mode 100644 index f6d6527f9489..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListByResourceGroupSample.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the web services in the specified resource group. - * - * @summary Gets the web services in the specified resource group. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesByResourceGroup.json - */ -async function getWebServicesByResourceGroup() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.webServices.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesByResourceGroup().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListBySubscriptionIdSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListBySubscriptionIdSample.ts deleted file mode 100644 index e31a951032d0..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListBySubscriptionIdSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the web services in the specified subscription. - * - * @summary Gets the web services in the specified subscription. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServicesBySubscriptionId.json - */ -async function getWebServicesBySubscriptionId() { - const subscriptionId = "subscription-id"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const resArray = new Array(); - for await (let item of client.webServices.listBySubscriptionId()) { - resArray.push(item); - } - console.log(resArray); -} - -getWebServicesBySubscriptionId().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListKeysSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListKeysSample.ts deleted file mode 100644 index 2c6be64f44ae..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesListKeysSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Gets the access keys for the specified web service. - * - * @summary Gets the access keys for the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/getWebServiceKeys.json - */ -async function getWebServiceKeys() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.listKeys( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -getWebServiceKeys().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesPatchSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesPatchSample.ts deleted file mode 100644 index db4da1b0ebed..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesPatchSample.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { - PatchedWebService, - AzureMLWebServicesManagementClient -} from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * - * @summary Modifies an existing web service resource. The PATCH API call is an asynchronous operation. To determine whether it has completed successfully, you must perform a Get operation. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/patchWebService.json - */ -async function patchWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const patchPayload: PatchedWebService = { - location: "West US", - properties: { - description: "New Web Service Description", - packageType: "Graph", - title: "New Web Service Title" - } - }; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginPatchAndWait( - resourceGroupName, - webServiceName, - patchPayload - ); - console.log(result); -} - -patchWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesRemoveSample.ts b/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesRemoveSample.ts deleted file mode 100644 index 4d461697b8b1..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/src/webServicesRemoveSample.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureMLWebServicesManagementClient } from "@azure/arm-webservices"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to Deletes the specified web service. - * - * @summary Deletes the specified web service. - * x-ms-original-file: specification/machinelearning/resource-manager/Microsoft.MachineLearning/stable/2017-01-01/examples/deleteWebService.json - */ -async function deleteWebService() { - const subscriptionId = "subscription-id"; - const resourceGroupName = "OneResourceGroupName"; - const webServiceName = "TargetWebServiceName"; - const credential = new DefaultAzureCredential(); - const client = new AzureMLWebServicesManagementClient( - credential, - subscriptionId - ); - const result = await client.webServices.beginRemoveAndWait( - resourceGroupName, - webServiceName - ); - console.log(result); -} - -deleteWebService().catch(console.error); diff --git a/sdk/machinelearning/arm-webservices/samples/v1/typescript/tsconfig.json b/sdk/machinelearning/arm-webservices/samples/v1/typescript/tsconfig.json deleted file mode 100644 index 416c2dd82e00..000000000000 --- a/sdk/machinelearning/arm-webservices/samples/v1/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2018", - "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/machinelearning/arm-webservices/src/azureMLWebServicesManagementClient.ts b/sdk/machinelearning/arm-webservices/src/azureMLWebServicesManagementClient.ts index d786f1e1f528..2f583fde4ee6 100644 --- a/sdk/machinelearning/arm-webservices/src/azureMLWebServicesManagementClient.ts +++ b/sdk/machinelearning/arm-webservices/src/azureMLWebServicesManagementClient.ts @@ -8,6 +8,11 @@ import * as coreClient from "@azure/core-client"; import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; import { OperationsImpl, WebServicesImpl } from "./operations"; import { Operations, WebServices } from "./operationsInterfaces"; @@ -45,7 +50,7 @@ export class AzureMLWebServicesManagementClient extends coreClient.ServiceClient credential: credentials }; - const packageDetails = `azsdk-js-arm-webservices/1.0.2`; + const packageDetails = `azsdk-js-arm-webservices/1.0.3`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -95,6 +100,35 @@ export class AzureMLWebServicesManagementClient extends coreClient.ServiceClient this.apiVersion = options.apiVersion || "2017-01-01"; this.operations = new OperationsImpl(this); this.webServices = new WebServicesImpl(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 item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); } operations: Operations; diff --git a/sdk/machinelearning/arm-webservices/test/sampleTest.ts b/sdk/machinelearning/arm-webservices/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/machinelearning/arm-webservices/test/sampleTest.ts +++ b/sdk/machinelearning/arm-webservices/test/sampleTest.ts @@ -7,35 +7,30 @@ */ import { - env, - record, - RecorderEnvironmentSetup, - Recorder + Recorder, + RecorderStartOptions, + env } from "@azure-tools/test-recorder"; -import * as assert from "assert"; +import { assert } from "chai"; +import { Context } from "mocha"; -const recorderEnvSetup: RecorderEnvironmentSetup = { - replaceableVariables: { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" - }, - customizationsOnRecordings: [ - (recording: any): any => - recording.replace( - /"access_token":"[^"]*"/g, - `"access_token":"access_token"` - ) - ], - queryParametersToSkip: [] +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 }; describe("My test", () => { let recorder: Recorder; - beforeEach(async function() { - recorder = record(this, recorderEnvSetup); + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); }); afterEach(async function() { diff --git a/sdk/machinelearning/arm-webservices/tsconfig.json b/sdk/machinelearning/arm-webservices/tsconfig.json index bf15bf0361cd..69cd824d326e 100644 --- a/sdk/machinelearning/arm-webservices/tsconfig.json +++ b/sdk/machinelearning/arm-webservices/tsconfig.json @@ -15,19 +15,14 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-webservices": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules" ] -} +} \ No newline at end of file