From d4abfb7305cd89d5b67f1d7e8644a596b5474409 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Mon, 4 Jul 2022 13:28:43 +0800 Subject: [PATCH] refresh managementpartner package (#22413) * refresh managementpartner package * update files * Update package.json * Update aCEProvisioningManagementPartnerAPI.ts * update files * regenerate managementpartner Co-authored-by: ZiWei Chen (WICRESOFT NORTH AMERICA LTD) --- common/config/rush/pnpm-lock.yaml | 11 +-- .../arm-managementpartner/CHANGELOG.md | 12 +++ .../arm-managementpartner/README.md | 14 ++-- .../arm-managementpartner/_meta.json | 10 +-- .../arm-managementpartner/package.json | 17 ++-- .../node/my_test/recording_sample_test.js | 5 -- .../node/my_test/recording_sample_test.json | 4 + .../review/arm-managementpartner.api.md | 16 ++-- .../samples-dev/deletePartnerDetails.ts | 28 ------- .../samples-dev/getOperations.ts | 30 ------- .../samples-dev/getPartnerDetails.ts | 27 ------ .../samples-dev/patchPartnerDetails.ts | 28 ------- .../samples-dev/putPartnerDetails.ts | 28 ------- .../samples/v2/javascript/README.md | 70 ---------------- .../v2/javascript/deletePartnerDetails.js | 28 ------- .../samples/v2/javascript/getOperations.js | 30 ------- .../v2/javascript/getPartnerDetails.js | 27 ------ .../v2/javascript/patchPartnerDetails.js | 28 ------- .../v2/javascript/putPartnerDetails.js | 28 ------- .../samples/v2/typescript/README.md | 83 ------------------- .../v2/typescript/src/deletePartnerDetails.ts | 28 ------- .../v2/typescript/src/getOperations.ts | 30 ------- .../v2/typescript/src/getPartnerDetails.ts | 27 ------ .../v2/typescript/src/patchPartnerDetails.ts | 28 ------- .../v2/typescript/src/putPartnerDetails.ts | 28 ------- .../samples/v3/javascript/README.md | 60 ++++++++++++++ .../javascript/operationListSample.js | 0 .../{v2 => v3}/javascript/package.json | 0 .../javascript/partnerCreateSample.js | 0 .../javascript/partnerDeleteSample.js | 0 .../{v2 => v3}/javascript/partnerGetSample.js | 0 .../javascript/partnerUpdateSample.js | 0 .../javascript/partnersGetSample.js | 0 .../samples/{v2 => v3}/javascript/sample.env | 0 .../samples/v3/typescript/README.md | 73 ++++++++++++++++ .../{v2 => v3}/typescript/package.json | 0 .../samples/{v2 => v3}/typescript/sample.env | 0 .../typescript/src/operationListSample.ts | 0 .../typescript/src/partnerCreateSample.ts | 0 .../typescript/src/partnerDeleteSample.ts | 0 .../typescript/src/partnerGetSample.ts | 0 .../typescript/src/partnerUpdateSample.ts | 0 .../typescript/src/partnersGetSample.ts | 0 .../{v2 => v3}/typescript/tsconfig.json | 0 .../aCEProvisioningManagementPartnerAPI.ts | 36 +++++++- .../arm-managementpartner/src/models/index.ts | 29 +++++-- .../src/models/mappers.ts | 12 --- .../arm-managementpartner/test/sampleTest.ts | 39 ++++----- 48 files changed, 264 insertions(+), 650 deletions(-) delete mode 100644 sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.json delete mode 100644 sdk/managementpartner/arm-managementpartner/samples-dev/deletePartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples-dev/getOperations.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples-dev/getPartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples-dev/patchPartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples-dev/putPartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/README.md delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/deletePartnerDetails.js delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getOperations.js delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getPartnerDetails.js delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/patchPartnerDetails.js delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/javascript/putPartnerDetails.js delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/README.md delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/deletePartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getOperations.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getPartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/patchPartnerDetails.ts delete mode 100644 sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/putPartnerDetails.ts create mode 100644 sdk/managementpartner/arm-managementpartner/samples/v3/javascript/README.md rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/operationListSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/package.json (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/partnerCreateSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/partnerDeleteSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/partnerGetSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/partnerUpdateSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/partnersGetSample.js (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/javascript/sample.env (100%) create mode 100644 sdk/managementpartner/arm-managementpartner/samples/v3/typescript/README.md rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/package.json (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/sample.env (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/operationListSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/partnerCreateSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/partnerDeleteSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/partnerGetSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/partnerUpdateSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/src/partnersGetSample.ts (100%) rename sdk/managementpartner/arm-managementpartner/samples/{v2 => v3}/typescript/tsconfig.json (100%) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 95cd8495df9b..12d56201acc0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3945,7 +3945,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.8.0-dev.20220629 + typescript: 4.8.0-dev.20220630 dev: false /downlevel-dts/0.4.0: @@ -8755,8 +8755,8 @@ packages: hasBin: true dev: false - /typescript/4.8.0-dev.20220629: - resolution: {integrity: sha512-QEp1M6iqlYpQXFF2f9ucXMkXbYcAoXcG0ws0IG8bWd7mjPGf8R5iVCbQVSm1dzV/GoOy0PsvfNe5/uL6D9TSPA==} + /typescript/4.8.0-dev.20220630: + resolution: {integrity: sha512-wyFZIoUdTqDrKU3XfDx+pylAEIhlmpbsbicFXuvggpKeSWiPeUrMiSRqeXBnAjXiD6kn2Anmw+c3eyX3A2WdUw==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -12402,7 +12402,7 @@ packages: dev: false file:projects/arm-managementpartner.tgz: - resolution: {integrity: sha512-sP7x1wf3eZSkxtXqWPCZ0HA4c3dzLfT4/PzPx2cZGlGQWhZAFQduhN52I2AX9voHqLStRUp/gVNWX7ODTqCW5w==, tarball: file:projects/arm-managementpartner.tgz} + resolution: {integrity: sha512-JtmaYcTbaFscO53An8VISC1K+XjKl6Fd69Z4QqVumlJxDwmD2svTNFqNIFutWwRGhzYtuC740SHeKxX0SPx7TQ==, tarball: file:projects/arm-managementpartner.tgz} name: '@rush-temp/arm-managementpartner' version: 0.0.0 dependencies: @@ -12413,6 +12413,8 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.74.1 '@rollup/plugin-multi-entry': 4.1.0_rollup@2.74.1 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.74.1 + '@types/chai': 4.3.1 + chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 @@ -12425,7 +12427,6 @@ packages: transitivePeerDependencies: - '@types/node' - debug - - encoding - supports-color dev: false diff --git a/sdk/managementpartner/arm-managementpartner/CHANGELOG.md b/sdk/managementpartner/arm-managementpartner/CHANGELOG.md index 1bcd882d0a66..33d6ddd455b7 100644 --- a/sdk/managementpartner/arm-managementpartner/CHANGELOG.md +++ b/sdk/managementpartner/arm-managementpartner/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History + +## 3.0.0 (2022-07-04) + +**Features** + - Added Type Alias ErrorResponseCode + - Added Enum KnownErrorResponseCode + +**Breaking Changes** + + - Interface ErrorModel no longer has parameter code + - Interface ErrorModel no longer has parameter message + ## 2.0.1 (2022-04-24) **Features** diff --git a/sdk/managementpartner/arm-managementpartner/README.md b/sdk/managementpartner/arm-managementpartner/README.md index 7444eeb2f5c1..3a4b3bd0f36a 100644 --- a/sdk/managementpartner/arm-managementpartner/README.md +++ b/sdk/managementpartner/arm-managementpartner/README.md @@ -1,6 +1,6 @@ -# Azure Service client library for JavaScript +# Azure AceProvisioningManagementPartnerApi client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure AceProvisioningManagementPartnerApi client. This API describe ACE Provisioning ManagementPartner @@ -24,7 +24,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP ### Install the `@azure/arm-managementpartner` package -Install the Azure Service client library for JavaScript with `npm`: +Install the Azure AceProvisioningManagementPartnerApi client library for JavaScript with `npm`: ```bash npm install @azure/arm-managementpartner @@ -32,8 +32,8 @@ npm install @azure/arm-managementpartner ### Create and authenticate a `ACEProvisioningManagementPartnerAPI` -To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. +To create a client object to access the Azure AceProvisioningManagementPartnerApi API, you will need the `endpoint` of your Azure AceProvisioningManagementPartnerApi resource and a `credential`. The Azure AceProvisioningManagementPartnerApi client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure AceProvisioningManagementPartnerApi resource in the [Azure Portal][azure_portal]. You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). @@ -43,7 +43,7 @@ To use the [DefaultAzureCredential][defaultazurecredential] provider shown below npm install @azure/identity ``` -You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +You will also need to **register a new AAD application and grant access to Azure AceProvisioningManagementPartnerApi** 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). @@ -72,7 +72,7 @@ To use this client library in the browser, first you need to use a bundler. For ### ACEProvisioningManagementPartnerAPI -`ACEProvisioningManagementPartnerAPI` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access. +`ACEProvisioningManagementPartnerAPI` is the primary interface for developers using the Azure AceProvisioningManagementPartnerApi client library. Explore the methods on this client object to understand the different features of the Azure AceProvisioningManagementPartnerApi service that you can access. ## Troubleshooting diff --git a/sdk/managementpartner/arm-managementpartner/_meta.json b/sdk/managementpartner/arm-managementpartner/_meta.json index 7b1aeed1b471..e3ef51d4028d 100644 --- a/sdk/managementpartner/arm-managementpartner/_meta.json +++ b/sdk/managementpartner/arm-managementpartner/_meta.json @@ -1,8 +1,8 @@ { - "commit": "184b23b63ee3a79fb41ca3aa55a31a8d9e636772", - "readme": "specification\\managementpartner\\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\\managementpartner\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220408.1 --generate-sample=true", + "commit": "d967edeee8fd6af6d40bffe53cceed1bd053d7ad", + "readme": "specification/managementpartner/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:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\managementpartner\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1 --generate-sample=true --azure-arm=true", "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.2", + "use": "@autorest/typescript@6.0.0-rc.1" } \ No newline at end of file diff --git a/sdk/managementpartner/arm-managementpartner/package.json b/sdk/managementpartner/arm-managementpartner/package.json index 7184406577e7..5aa8a19d4430 100644 --- a/sdk/managementpartner/arm-managementpartner/package.json +++ b/sdk/managementpartner/arm-managementpartner/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for ACEProvisioningManagementPartnerAPI.", - "version": "2.0.1", + "version": "3.0.0", "engines": { "node": ">=12.0.0" }, @@ -38,9 +38,13 @@ "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" + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementpartner/arm-managementpartner", "repository": { @@ -91,9 +95,8 @@ "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", "unit-test:browser": "echo skipped", "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", - "integration-test:browser": "echo skipped", - "docs": "echo skipped" + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" }, "sideEffects": false, "//metadata": { @@ -113,4 +116,4 @@ "disableDocsMs": true, "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-managementpartner?view=azure-node-preview" } -} +} \ No newline at end of file diff --git a/sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.js b/sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.js deleted file mode 100644 index 0f6ecb857acf..000000000000 --- a/sdk/managementpartner/arm-managementpartner/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/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.json b/sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 000000000000..f721723386d8 --- /dev/null +++ b/sdk/managementpartner/arm-managementpartner/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/managementpartner/arm-managementpartner/review/arm-managementpartner.api.md b/sdk/managementpartner/arm-managementpartner/review/arm-managementpartner.api.md index 69ac1c42cef6..a9188cd251e7 100644 --- a/sdk/managementpartner/arm-managementpartner/review/arm-managementpartner.api.md +++ b/sdk/managementpartner/arm-managementpartner/review/arm-managementpartner.api.md @@ -32,22 +32,28 @@ export interface ACEProvisioningManagementPartnerAPIOptionalParams extends coreC // @public export interface ErrorModel { - code?: string; error?: ExtendedErrorInfo; - message?: string; } +// @public +export type ErrorResponseCode = string; + // @public export interface ExtendedErrorInfo { - code?: string; + code?: ErrorResponseCode; message?: string; } +// @public +export enum KnownErrorResponseCode { + BadRequest = "BadRequest", + Conflict = "Conflict", + NotFound = "NotFound" +} + // @public export enum KnownManagementPartnerState { - // (undocumented) Active = "Active", - // (undocumented) Deleted = "Deleted" } diff --git a/sdk/managementpartner/arm-managementpartner/samples-dev/deletePartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples-dev/deletePartnerDetails.ts deleted file mode 100644 index 77e1b82f8903..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples-dev/deletePartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Delete the management partner for the objectId and tenantId. - * - * @summary Delete the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function deletePartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.delete(partnerId); - console.log(result); -} - -deletePartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples-dev/getOperations.ts b/sdk/managementpartner/arm-managementpartner/samples-dev/getOperations.ts deleted file mode 100644 index 4b9ca36e0ea3..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples-dev/getOperations.ts +++ /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. -/** - * This sample demonstrates how to List all the operations. - * - * @summary List all the operations. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function getOperations() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const resArray = new Array(); - for await (let item of client.operation.list()) { - resArray.push(item); - } - console.log(resArray); -} - -getOperations().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples-dev/getPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples-dev/getPartnerDetails.ts deleted file mode 100644 index 5fabe406c978..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples-dev/getPartnerDetails.ts +++ /dev/null @@ -1,27 +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. -/** - * This sample demonstrates how to Get the management partner using the objectId and tenantId. - * - * @summary Get the management partner using the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function getPartnerDetails() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partners.get(); - console.log(result); -} - -getPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples-dev/patchPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples-dev/patchPartnerDetails.ts deleted file mode 100644 index 4d1e5627f59b..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples-dev/patchPartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Update the management partner for the objectId and tenantId. - * - * @summary Update the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function patchPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.update(partnerId); - console.log(result); -} - -patchPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples-dev/putPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples-dev/putPartnerDetails.ts deleted file mode 100644 index c983fd425775..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples-dev/putPartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Create a management partner for the objectId and tenantId. - * - * @summary Create a management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function putPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.create(partnerId); - console.log(result); -} - -putPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/README.md b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/README.md deleted file mode 100644 index 9cff652044ac..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/README.md +++ /dev/null @@ -1,70 +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** | -| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [deletePartnerDetails.js][deletepartnerdetails] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | -| [getOperations.js][getoperations] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | -| [getPartnerDetails.js][getpartnerdetails] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json | -| [operationListSample.js][operationlistsample] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | -| [partnerCreateSample.js][partnercreatesample] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json | -| [partnerDeleteSample.js][partnerdeletesample] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | -| [partnerGetSample.js][partnergetsample] | Get the management partner using the partnerId, objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json | -| [partnerUpdateSample.js][partnerupdatesample] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | -| [partnersGetSample.js][partnersgetsample] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json | -| [patchPartnerDetails.js][patchpartnerdetails] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | -| [putPartnerDetails.js][putpartnerdetails] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.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 deletePartnerDetails.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 deletePartnerDetails.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[deletepartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/deletePartnerDetails.js -[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getOperations.js -[getpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getPartnerDetails.js -[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/operationListSample.js -[partnercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerCreateSample.js -[partnerdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerDeleteSample.js -[partnergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerGetSample.js -[partnerupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerUpdateSample.js -[partnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnersGetSample.js -[patchpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/patchPartnerDetails.js -[putpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/putPartnerDetails.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-managementpartner?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementpartner/arm-managementpartner/README.md diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/deletePartnerDetails.js b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/deletePartnerDetails.js deleted file mode 100644 index e4c0eec01a17..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/deletePartnerDetails.js +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Delete the management partner for the objectId and tenantId. - * - * @summary Delete the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json - */ -const { ACEProvisioningManagementPartnerAPI } = require("@azure/arm-managementpartner"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function deletePartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.delete(partnerId); - console.log(result); -} - -deletePartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getOperations.js b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getOperations.js deleted file mode 100644 index 1a7bf170cf42..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getOperations.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. -/** - * This sample demonstrates how to List all the operations. - * - * @summary List all the operations. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json - */ -const { ACEProvisioningManagementPartnerAPI } = require("@azure/arm-managementpartner"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function getOperations() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const resArray = new Array(); - for await (let item of client.operation.list()) { - resArray.push(item); - } - console.log(resArray); -} - -getOperations().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getPartnerDetails.js b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getPartnerDetails.js deleted file mode 100644 index ecca4c3f2601..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/getPartnerDetails.js +++ /dev/null @@ -1,27 +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. -/** - * This sample demonstrates how to Get the management partner using the objectId and tenantId. - * - * @summary Get the management partner using the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json - */ -const { ACEProvisioningManagementPartnerAPI } = require("@azure/arm-managementpartner"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function getPartnerDetails() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partners.get(); - console.log(result); -} - -getPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/patchPartnerDetails.js b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/patchPartnerDetails.js deleted file mode 100644 index 51b7e0fbbff7..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/patchPartnerDetails.js +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Update the management partner for the objectId and tenantId. - * - * @summary Update the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json - */ -const { ACEProvisioningManagementPartnerAPI } = require("@azure/arm-managementpartner"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function patchPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.update(partnerId); - console.log(result); -} - -patchPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/putPartnerDetails.js b/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/putPartnerDetails.js deleted file mode 100644 index 31eeaecdd564..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/putPartnerDetails.js +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Create a management partner for the objectId and tenantId. - * - * @summary Create a management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json - */ -const { ACEProvisioningManagementPartnerAPI } = require("@azure/arm-managementpartner"); -const { DefaultAzureCredential } = require("@azure/identity"); - -async function putPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.create(partnerId); - console.log(result); -} - -putPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/README.md b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/README.md deleted file mode 100644 index 819896d6cc0a..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/README.md +++ /dev/null @@ -1,83 +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** | -| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [deletePartnerDetails.ts][deletepartnerdetails] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | -| [getOperations.ts][getoperations] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | -| [getPartnerDetails.ts][getpartnerdetails] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json | -| [operationListSample.ts][operationlistsample] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | -| [partnerCreateSample.ts][partnercreatesample] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json | -| [partnerDeleteSample.ts][partnerdeletesample] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | -| [partnerGetSample.ts][partnergetsample] | Get the management partner using the partnerId, objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json | -| [partnerUpdateSample.ts][partnerupdatesample] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | -| [partnersGetSample.ts][partnersgetsample] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json | -| [patchPartnerDetails.ts][patchpartnerdetails] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | -| [putPartnerDetails.ts][putpartnerdetails] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.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/deletePartnerDetails.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/deletePartnerDetails.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[deletepartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/deletePartnerDetails.ts -[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getOperations.ts -[getpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getPartnerDetails.ts -[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/operationListSample.ts -[partnercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerCreateSample.ts -[partnerdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerDeleteSample.ts -[partnergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerGetSample.ts -[partnerupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerUpdateSample.ts -[partnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnersGetSample.ts -[patchpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/patchPartnerDetails.ts -[putpartnerdetails]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/putPartnerDetails.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-managementpartner?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementpartner/arm-managementpartner/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/deletePartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/deletePartnerDetails.ts deleted file mode 100644 index 77e1b82f8903..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/deletePartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Delete the management partner for the objectId and tenantId. - * - * @summary Delete the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function deletePartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.delete(partnerId); - console.log(result); -} - -deletePartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getOperations.ts b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getOperations.ts deleted file mode 100644 index 4b9ca36e0ea3..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getOperations.ts +++ /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. -/** - * This sample demonstrates how to List all the operations. - * - * @summary List all the operations. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function getOperations() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const resArray = new Array(); - for await (let item of client.operation.list()) { - resArray.push(item); - } - console.log(resArray); -} - -getOperations().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getPartnerDetails.ts deleted file mode 100644 index 5fabe406c978..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/getPartnerDetails.ts +++ /dev/null @@ -1,27 +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. -/** - * This sample demonstrates how to Get the management partner using the objectId and tenantId. - * - * @summary Get the management partner using the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function getPartnerDetails() { - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partners.get(); - console.log(result); -} - -getPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/patchPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/patchPartnerDetails.ts deleted file mode 100644 index 4d1e5627f59b..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/patchPartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Update the management partner for the objectId and tenantId. - * - * @summary Update the management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function patchPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.update(partnerId); - console.log(result); -} - -patchPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/putPartnerDetails.ts b/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/putPartnerDetails.ts deleted file mode 100644 index c983fd425775..000000000000 --- a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/putPartnerDetails.ts +++ /dev/null @@ -1,28 +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. -/** - * This sample demonstrates how to Create a management partner for the objectId and tenantId. - * - * @summary Create a management partner for the objectId and tenantId. - * x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json - */ -import { ACEProvisioningManagementPartnerAPI } from "@azure/arm-managementpartner"; -import { DefaultAzureCredential } from "@azure/identity"; - -async function putPartnerDetails() { - const partnerId = "123456"; - const credential = new DefaultAzureCredential(); - const client = new ACEProvisioningManagementPartnerAPI(credential); - const result = await client.partner.create(partnerId); - console.log(result); -} - -putPartnerDetails().catch(console.error); diff --git a/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/README.md b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/README.md new file mode 100644 index 000000000000..af913be801f1 --- /dev/null +++ b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/README.md @@ -0,0 +1,60 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationListSample.js][operationlistsample] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | +| [partnerCreateSample.js][partnercreatesample] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json | +| [partnerDeleteSample.js][partnerdeletesample] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | +| [partnerGetSample.js][partnergetsample] | Get the management partner using the partnerId, objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json | +| [partnerUpdateSample.js][partnerupdatesample] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | +| [partnersGetSample.js][partnersgetsample] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.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 operationListSample.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 operationListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/operationListSample.js +[partnercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerCreateSample.js +[partnerdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerDeleteSample.js +[partnergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerGetSample.js +[partnerupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerUpdateSample.js +[partnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnersGetSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-managementpartner?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementpartner/arm-managementpartner/README.md diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/operationListSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/operationListSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/operationListSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/operationListSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/package.json b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/package.json similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/package.json rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/package.json diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerCreateSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerCreateSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerCreateSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerCreateSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerDeleteSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerDeleteSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerDeleteSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerDeleteSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerGetSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerGetSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerGetSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerGetSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerUpdateSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerUpdateSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnerUpdateSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnerUpdateSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnersGetSample.js b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnersGetSample.js similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/partnersGetSample.js rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/partnersGetSample.js diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/javascript/sample.env b/sdk/managementpartner/arm-managementpartner/samples/v3/javascript/sample.env similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/javascript/sample.env rename to sdk/managementpartner/arm-managementpartner/samples/v3/javascript/sample.env diff --git a/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/README.md b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/README.md new file mode 100644 index 000000000000..2c08a8d5f1db --- /dev/null +++ b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/README.md @@ -0,0 +1,73 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationListSample.ts][operationlistsample] | List all the operations. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetOperations.json | +| [partnerCreateSample.ts][partnercreatesample] | Create a management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PutPartnerDetails.json | +| [partnerDeleteSample.ts][partnerdeletesample] | Delete the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/DeletePartnerDetails.json | +| [partnerGetSample.ts][partnergetsample] | Get the management partner using the partnerId, objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetails.json | +| [partnerUpdateSample.ts][partnerupdatesample] | Update the management partner for the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/PatchPartnerDetails.json | +| [partnersGetSample.ts][partnersgetsample] | Get the management partner using the objectId and tenantId. x-ms-original-file: specification/managementpartner/resource-manager/Microsoft.ManagementPartner/preview/2018-02-01/examples/GetPartnerDetailsNoPartnerId.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/operationListSample.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/operationListSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/operationListSample.ts +[partnercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerCreateSample.ts +[partnerdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerDeleteSample.ts +[partnergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerGetSample.ts +[partnerupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerUpdateSample.ts +[partnersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnersGetSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-managementpartner?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managementpartner/arm-managementpartner/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/package.json b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/package.json similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/package.json rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/package.json diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/sample.env b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/sample.env similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/sample.env rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/sample.env diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/operationListSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/operationListSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/operationListSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/operationListSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerCreateSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerCreateSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerCreateSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerCreateSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerDeleteSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerDeleteSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerDeleteSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerDeleteSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerGetSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerGetSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerGetSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerGetSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerUpdateSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerUpdateSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnerUpdateSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnerUpdateSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnersGetSample.ts b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnersGetSample.ts similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/src/partnersGetSample.ts rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/src/partnersGetSample.ts diff --git a/sdk/managementpartner/arm-managementpartner/samples/v2/typescript/tsconfig.json b/sdk/managementpartner/arm-managementpartner/samples/v3/typescript/tsconfig.json similarity index 100% rename from sdk/managementpartner/arm-managementpartner/samples/v2/typescript/tsconfig.json rename to sdk/managementpartner/arm-managementpartner/samples/v3/typescript/tsconfig.json diff --git a/sdk/managementpartner/arm-managementpartner/src/aCEProvisioningManagementPartnerAPI.ts b/sdk/managementpartner/arm-managementpartner/src/aCEProvisioningManagementPartnerAPI.ts index 19bdd26464a1..5c1d73ba059f 100644 --- a/sdk/managementpartner/arm-managementpartner/src/aCEProvisioningManagementPartnerAPI.ts +++ b/sdk/managementpartner/arm-managementpartner/src/aCEProvisioningManagementPartnerAPI.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 { PartnerImpl, OperationImpl, PartnersImpl } from "./operations"; import { Partner, Operation, Partners } from "./operationsInterfaces"; @@ -39,7 +44,7 @@ export class ACEProvisioningManagementPartnerAPI extends coreClient.ServiceClien credential: credentials }; - const packageDetails = `azsdk-js-arm-managementpartner/2.0.1`; + const packageDetails = `azsdk-js-arm-managementpartner/3.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -88,6 +93,35 @@ export class ACEProvisioningManagementPartnerAPI extends coreClient.ServiceClien this.partner = new PartnerImpl(this); this.operation = new OperationImpl(this); this.partners = new PartnersImpl(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); } partner: Partner; diff --git a/sdk/managementpartner/arm-managementpartner/src/models/index.ts b/sdk/managementpartner/arm-managementpartner/src/models/index.ts index 89606a174579..e39cdbab3b63 100644 --- a/sdk/managementpartner/arm-managementpartner/src/models/index.ts +++ b/sdk/managementpartner/arm-managementpartner/src/models/index.ts @@ -49,16 +49,12 @@ export interface PartnerResponse { export interface ErrorModel { /** this is the ExtendedErrorInfo property */ error?: ExtendedErrorInfo; - /** this is the error response code */ - code?: string; - /** this is the extended error info message */ - message?: string; } /** this is the extended error info */ export interface ExtendedErrorInfo { /** this is the error response code */ - code?: string; + code?: ErrorResponseCode; /** this is the extended error info message */ message?: string; } @@ -95,7 +91,9 @@ export interface OperationDisplay { /** Known values of {@link ManagementPartnerState} that the service accepts. */ export enum KnownManagementPartnerState { + /** Active */ Active = "Active", + /** Deleted */ Deleted = "Deleted" } @@ -109,6 +107,27 @@ export enum KnownManagementPartnerState { */ export type ManagementPartnerState = string; +/** Known values of {@link ErrorResponseCode} that the service accepts. */ +export enum KnownErrorResponseCode { + /** NotFound */ + NotFound = "NotFound", + /** Conflict */ + Conflict = "Conflict", + /** BadRequest */ + BadRequest = "BadRequest" +} + +/** + * Defines values for ErrorResponseCode. \ + * {@link KnownErrorResponseCode} can be used interchangeably with ErrorResponseCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotFound** \ + * **Conflict** \ + * **BadRequest** + */ +export type ErrorResponseCode = string; + /** Optional parameters. */ export interface PartnerGetOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/managementpartner/arm-managementpartner/src/models/mappers.ts b/sdk/managementpartner/arm-managementpartner/src/models/mappers.ts index a514a3ef70da..dd4a4c3b467a 100644 --- a/sdk/managementpartner/arm-managementpartner/src/models/mappers.ts +++ b/sdk/managementpartner/arm-managementpartner/src/models/mappers.ts @@ -103,18 +103,6 @@ export const ErrorModel: coreClient.CompositeMapper = { name: "Composite", className: "ExtendedErrorInfo" } - }, - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } } } } diff --git a/sdk/managementpartner/arm-managementpartner/test/sampleTest.ts b/sdk/managementpartner/arm-managementpartner/test/sampleTest.ts index 7ed89b043e1b..25aeb3ebcc36 100644 --- a/sdk/managementpartner/arm-managementpartner/test/sampleTest.ts +++ b/sdk/managementpartner/arm-managementpartner/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() {